mistupv / JavaSlicer

A program slicer for Java, based on the system dependence graph (SDG).
https://mist.dsic.upv.es/JavaSlicer/demo/
GNU Affero General Public License v3.0
52 stars 18 forks source link

Data dependency is broken after merging with more_graphs #22

Closed jacosro closed 4 years ago

jacosro commented 4 years ago

Caused by #16

When a PDG is generated, some data dependencies are not shown in the generated images

cargaji commented 4 years ago

Related but probably not the cause: we are using DefaultDirectedGraph, but we should be using a DirectedPseudograph as our base graph:

Class Directed Self loops Repeated edges Weights
DefaultDirectedGraph
DirectedPseudograph

Source: JGraphT docs

cargaji commented 4 years ago

The other problem is that DataDependencyBuilder bases its analysis on Graph#findNodeByASTNode(Node), which compares each vertex until it finds the first node that equals the argument. This is a problem in programs with multiple instructions that are fundamentally the same, such as the following:

void f() {
  int x = 0;
  x++;
  x++;
}

Possible solution: assuming we have range data (start and end of the instruction) in the AST, we could compare the ranges of both objects, to make sure they are the same element. In reality, the real solution will be solving #18.