Giter VIP home page Giter VIP logo

insane's Introduction

INSANE

Static program analysis techniques working on object-oriented languages require precise knowledge of the aliasing relation between variables. This knowledge is important to, among other things, understand the read and write effects of method calls on objects.

INSANE is a combination of a pointer analysis with a memory effect analysis for the Scala programming language. Our analysis is based on abstract interpretation, it is inter-procedural and flow sensitive. The analysis, aimed at higher order programs, computes compositional summaries using a very expressive representation of effects and does not require annotations. This analysis is implement within a Scala compiler plugin.

What does it do?

Insane performs a compositional effect analysis of arbitrary Scala programs and compute per-method (and per call-context) effect summaries in the form of local heap transformers. There transformers are expressed as graphs.

Insane is a Scala compiler plugin running late in the compiling stage (just before cleanup), and is itself composed of multiple sub phases:

  • Contracts Extraction
  • Control Flow Graphs Generation
  • Class Hierarchy Computation
  • Type Analysis
  • Pointer/Effect Analysis

How to install/use

  • Make sure you have sbt-extras installed
  • Make sure you have a recent Scala build (>=2.10.0-M3) installed at some path P
  • Clone colder/insane
  • Update insane's build.sbt to reflect the path to which you have a recent scala, P
  • run "path/to/sbt-extras/sbt -sbt-version 0.12.0-M2 update compile script"
  • Use "./scalac-insane yourfiles.scala"
  • Run "./scalac-insane --help" for usage options:
$ ./scalac-insane --help
Usage: scalac-insane <options> <source files>

where standard options include:
 Output Control:
  --ondemand=s1:s2          Only analyze the specified symbols and their dependencies, _ for all
  --dumpcfg=s1:s2           Dumps CFG for the given symbols, _ for all
  --dumppt=s1:s2            Dumps Point-to graphs for the given symbols, _ for all
  --displayta=s1:s2         Displays Type Analysis results for the given symbols, _ for all
  --displaypure=s1:s2       Displays Purity info for the given symbols, _ for all
  --dumphierarchy           Dumps class hierarchy graph
  --dumpcallgraph           Dumps call graph resulting of class analysis
  --dumpcallstats           Dumps stats on call targets refinement
  --verbosity=normal        Sets verbosity (quiet < normal < verbose < debug)
  --verbose                 Sets verbosity to verbose
  --quiet                   Sets verbosity to quiet
  --debug                   Sets verbosity to debug

 Analysis Settings:
  --depthresolution=n       Allocation-site uniqueness depth-resolution, defaults to 1
  --openworld               Do not assume closed world
  --considerpure=s1:s2      Mark certain methods as pure for the analysis
  --considerarbitrary=s1:s2 Flag certain methods as unanalyzable, delaying their analysis
  --inlineStrategy=strat    Use a certain strategy for handling method calls
       Possible Strategies:
         - smart            Delay based on heuristic depending on the precision of a method call
         - inline           Always inline calls => "full" re-usability and efficiency
         - delay            Always delay the analysis =>  "full" precision

 Setting up the environment:
  --config=cfg.xml          Use the provided xml file to configure the access to the database
  --mehrasure               Disable erasure (this will fail rapidly, so beware)

 Miscellaneous:
  --help                 Displays this help

insane's People

Contributors

colder avatar psuter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

insane's Issues

How to use INSANE

I followed the steps to install/use INSANE, but I can't get it to work. I installed sbt-extras. I have installed Scala from the official site. Cloned colder/insane. Then I had to update insane' s build.sbt, which I did as shown below.

scalacOptions += "-deprecation"

scalacOptions += "-feature"

scalacOptions += "-unchecked"

scalaVersion := "2.10.0"

scalaHome := Some(file("/opt/scala-2.11.6/"))

// libraryDependencies += "org.squeryl" %% "squeryl" % "0.9.4"

libraryDependencies += "com.h2database" % "h2" % "1.2.127"

libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.15"

libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.10.0"

(scalaSource in Compile) <<= sourceDirectory apply { bd =>   bd / "insane" }

Afterwards, I ran sbt -sbt-version 0.12.0-M2 update compile script in insane's project folder (/home/awzang/code/insane) , which gives me the following error: https://gist.github.com/awzang/9fd84b487f489e0668bd. How can I fix this?

[may be a bug] Can't dump

Hi, when I run ./scalac-insane --dumpcallstats ./demos/inlining.scala, I can't get any info about the callstats, Is there something wrong~?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.