Git Product home page Git Product logo

jflow's People

Contributors

hdkwon2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jflow's Issues

Pretty print the mods/refs from PipelineStage

Find a way to pretty print, store, filter, etc of the potentially 1000's of PointerKeys. We need to make sense of this so that we can decide if it is possible to parallelize. Some of the JDK classes are definitely safe to point to but we need to get the list first. We will focus on Lire since that is our real application for now.

Create custom IR for the linked list example

There are currently too many things in the WALA IR (SSA form, Phi nodes, etc) that make it hard to test my dataflow solver. Create a simplified version of the IR that mimics what we have in the paper Solving Shape-Analysis Problems in Languages with Destructive Updating and then proceed from there.

Refactor tests to use ONE canonical call graph (and IR)

All interprocedural analysis, e.g., modref rely on the call graph. However, nodes in the call graph, CGNode are compared for equality using reference equality (!). This means that if we construct two different call graphs (at two different times) we are going to run into issues of not being able to locate certain values properly.

As a concrete example, consider points-to-set. It takes a PointerKey. Some PointerKeys such as LocalPointerKey take the CGNode into consideration. Thus, when we compare them we have to take CGNode equality into consideration. This happens many times especially when PointerKeys (the KEY in the name) implies that it will be used as they key to some map.

Additionally, the IRs must probably match too since instructions can also be factored in when doing a comparison.

See also #45 and the weird issues of points-to-set being empty that we were having.

Detect all the "copy-in" for selected statements

This must also include fields (current class, superclasses, ancestors). Basically this should capture the full dependence list of variables that need to be "copied-in" like the OpenMP directive. By determining the copy-in variables, we can then decide on how to schedule the execution of different tasks.

This will probably be done using the JDT infrastructure since it is cleaner when trying to identify the right variable (no need to worry about mapping back from WALA IR).

Write unit tests for the PDG

Let's have some simple automated tests for different scenarios so we can verify certain weird situations with PDGs (e.g., method params, variable names, etc).

The tests must evolve since at this time, the interface to the PDG is not stable yet.

Make heap dependencies be program point specific

If we have a statements like such:

Object a;  // 1
a.doSomething(); // 2
a.doSomethingElse(); // 3
someMethod(a); // 4

Currently, on line 4, the a is still data dependent only on the a object on line 1. This is correct. But we want something a bit more program point specific โ€“ almost like SSA for heap variables. So that anytime a statement accesses (modifies, if we can be that precise because reads are safe) a heap object, we should have a dependency on the heap object at that point.

The ability to store the program point where the last access happened is very useful when we start splitting things into threads since we need to track which thread wrote which value and compute some ordering.

Liveness Analysis

Does WALA come with a Liveness Analysis that we can leverage? Or does its internal SSA form help us enough with liveness analysis?

Visualize Pointer Analysis using WALAViewer

Useful to be able to follow some of the pointers in an interactive manner using the WALAViewer. Since WALAViewer is written using Swing and we are using SWT (because we need an instance of Eclipse running for JDTSourceAnalysisEngine), we need to change the way WALAViewer is invoked.

See [http://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html]

Investigate whether we can use neo4j as a backend for analysis

One of the problems with static analysis is the scalability. Sometimes this scalability problem arises just because we run out of memory. However, implementing parsimonious data structures is difficult. What if we could just use one of the existing solutions, e.g., in-memory databases?

Other researchers have used some query languages on top of effective data structures in the past:

  1. bddbddb: Using Datalog and BDDs for Program Analysis
  2. Points-to analysis using BDDs

Instead of using a research project (slightly less unsupported or tested) to do this, can we use a commercial product such as neo4j or even datomic? neo4j is preferred since it uses Java whereas datomic is mostly clojure.

Clean up WALA Program Dependence Graph View

I need to compare this view to our own PDG view. To make the comparison fair I should only enable data dependencies on Wala's PDG and disable control dependencies.

I should also clean up the view so that we are not displaying the full context until mouse hover.

PDG View doesn't work when you don't select the method name

If you just select a particular statement in the method that you are interested in, the PDG will display the nodes but the edges are missing.

You also see the following trace:

!STACK 0
java.lang.NullPointerException
    at edu.illinois.jflow.ui.tools.pdg.PDGLabelProvider.getText(PDGLabelProvider.java:45)
    at org.eclipse.zest.core.viewers.internal.GraphItemStyler.styleItem(GraphItemStyler.java:83)
    at org.eclipse.zest.core.viewers.internal.AbstractStylingModelFactory.styleItem(AbstractStylingModelFactory.java:121)
    at org.eclipse.zest.core.viewers.internal.AbstractStylingModelFactory.createConnection(AbstractStylingModelFactory.java:182)
    at org.eclipse.zest.core.viewers.internal.GraphModelEntityFactory.doBuildGraph(GraphModelEntityFactory.java:98)
    at org.eclipse.zest.core.viewers.internal.AbstractStylingModelFactory.refreshGraph(AbstractStylingModelFactory.java:288)
    at org.eclipse.zest.core.viewers.AbstractStructuredGraphViewer.internalRefresh(AbstractStructuredGraphViewer.java:359)
    at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1508)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1443)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1404)
    at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1506)
    at org.eclipse.zest.core.viewers.GraphViewer.refresh(GraphViewer.java:307)
    at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1465)
    at edu.illinois.jflow.ui.tools.pdg.PDGContentProvider.inputChanged(PDGContentProvider.java:23)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:276)
    at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1690)
    at edu.illinois.jflow.wala.ui.tools.graph.view.WalaGraphView.updateGraph(WalaGraphView.java:50)
    at edu.illinois.jflow.ui.tools.pdg.ViewPDGAction.run(ViewPDGAction.java:38)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
...

Add dependency edges between method parameters

When a method has parameters, we should add those dependencies. This is particularly important for virtual methods where the "this" parameter is implicitly passed as the first parameter.

Select feasible lines in the Eclipse editor and have their dependencies calculated

Basically, this is similar to Extract Method except that we will also include dependencies from fields (Extract Method does not by default). We will replace the flow analyzer from Eclipse with the one that we have built using Wala.

  1. First handle the case where we are just doing the selection for one set of lines. Determine it's copy-in and copy-out values and connect them.
  2. Then, handle the case where there is an existing closure that also needs to forward some of its variables. This might be handled already by the mechanics of step 1 but let's split them up for now to make it easier to prototype/reason.

Print out the original names of the variables in the IR PDF

This will give me some chance to experiment with how the SSA form in WALA works. Some questions that I have:

  1. How can I determine what variable in the original source code is actually referred to by the SSA variables?
  2. What happens during a phi-instruction?
  3. How can we perform shape-analysis on this representation?

Create a partitioner based on our PDG and modref analysis

Technically we can extract a closure without doing modref analysis since everything is local. But if we don't incorporate modref analysis early, we could end up with closures that cannot be parallelized later. So we should somehow try to incorporate this analysis early. Might even decide to use //placemarkers to extract the closures.

// Stage
statement
statement
// End stage

// Stage
statement
statement
// End stage

Setup custom dataflow solver for shape analysis

This will be similar to the BitVectorFramework that already exists for Java except that we will be operating on the join complete semi-lattice of static shape graphs. The ordering and join follow the definitions in the paper Solving Shape-Analysis Problems in Languages with Destructive Updating.

Create shape analysis of the typical linked list example

Example

  1. Create a program that reverses a list
  2. Use only basic classes (don't use Lists, Vector, etc)
  3. Visualize the IR of the program

Shape analysis infrastructure

  1. Create the data structures to support the static shape graph (and hook it into WALA).

Unexpected type: class com.ibm.wala.analysis.typeInference.JavaPrimitiveType

Here's the stack trace

Caused by: com.ibm.wala.util.debug.UnimplementedError: Unexpected type: class com.ibm.wala.analysis.typeInference.JavaPrimitiveType
    at com.ibm.wala.util.debug.Assertions.UNREACHABLE(Assertions.java:55)
    at com.ibm.wala.analysis.typeInference.PointType.meet(PointType.java:69)
    at com.ibm.wala.analysis.typeInference.TypeInference$PrimitivePropagateOperator.evaluate(TypeInference.java:392)
    at com.ibm.wala.cast.java.analysis.typeInference.AstJavaTypeInference$PrimAndStringOp.evaluate(AstJavaTypeInference.java:142)
    at com.ibm.wala.analysis.typeInference.TypeInference$PrimitivePropagateOperator.evaluate(TypeInference.java:1)
    at com.ibm.wala.fixedpoint.impl.GeneralStatement.evaluate(GeneralStatement.java:36)
    at com.ibm.wala.fixedpoint.impl.AbstractFixedPointSolver.solve(AbstractFixedPointSolver.java:149)
    at com.ibm.wala.analysis.typeInference.TypeInference.solve(TypeInference.java:126)
    at com.ibm.wala.analysis.typeInference.TypeInference.solve(TypeInference.java:117)
    at com.ibm.wala.analysis.typeInference.TypeInference.<init>(TypeInference.java:113)
    at com.ibm.wala.cast.analysis.typeInference.AstTypeInference.<init>(AstTypeInference.java:70)
    at com.ibm.wala.cast.java.analysis.typeInference.AstJavaTypeInference.<init>(AstJavaTypeInference.java:98)
    at edu.illinois.jflow.jflow.wala.dataflowanalysis.ProgramDependenceGraph.<init>(ProgramDependenceGraph.java:80)
    at edu.illinois.jflow.jflow.wala.dataflowanalysis.ProgramDependenceGraph.makeWithSourceCode(ProgramDependenceGraph.java:65)
    at edu.illinois.jflow.core.transformations.code.ExtractClosureRefactoring.createPDGAnalyzer(ExtractClosureRefactoring.java:302)

Here's the offending code:

package extractclosure;

public class Project1 {
    public static void main(String[] args) {
        int a = producer(1);
        /*[*/
        int b = producer(a);
        int c = producer(b);
        System.out.println("a: " + a + ", c: " + c); // <--- This line here, if we remove it al is well.
        /*]*/
    }

    static int producer(int input) {
        return input + 2;
    }
}

Try out how accurate the type inference is for WALA IR

When we are doing an extract method, it is important to be able to get the type of the variable. In JDT land, this information is quite easily obtained through an IVariableBinding. How can we get the information for WALA IR?

Does the TypeInference class in WALA work properly? Incorporate into our PDG and try it out.

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.