Skip to content

Commit 9377920

Browse files
committed
added assignment 6 materials and skeleton code
1 parent 5f940d8 commit 9377920

File tree

100 files changed

+9392
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+9392
-0
lines changed

Diff for: assignment6.pdf

271 KB
Binary file not shown.

Diff for: assignment6_latex.zip

5.71 KB
Binary file not shown.

Diff for: com.se421.slice/.atlas-settings/noIndex

Whitespace-only changes.

Diff for: com.se421.slice/.classpath

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>

Diff for: com.se421.slice/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

Diff for: com.se421.slice/.project

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>com.se421.slice</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.pde.PluginNature</nature>
26+
<nature>org.eclipse.jdt.core.javanature</nature>
27+
</natures>
28+
</projectDescription>

Diff for: com.se421.slice/.settings/org.eclipse.jdt.core.prefs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.8

Diff for: com.se421.slice/META-INF/MANIFEST.MF

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: Slicing Toolbox
4+
Bundle-SymbolicName: com.se421.slice;singleton:=true
5+
Bundle-Version: 3.3.7.qualifier
6+
Bundle-Vendor: SE421
7+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
8+
Require-Bundle: org.eclipse.ui,
9+
org.eclipse.core.runtime,
10+
org.eclipse.core.resources,
11+
com.ensoftcorp.atlas.core;bundle-version="3.3.6",
12+
com.ensoftcorp.atlas.ui;bundle-version="3.3.6",
13+
com.ensoftcorp.atlas.ui.shell;bundle-version="3.3.6"
14+
Bundle-ActivationPolicy: lazy
15+
Bundle-ClassPath: .
16+
Bundle-Activator: com.se421.slice.Activator
17+
Export-Package: com.se421.slice.analysis;
18+
uses:="com.ensoftcorp.atlas.core.db.set,
19+
com.ensoftcorp.atlas.core.query,
20+
com.ensoftcorp.atlas.core.highlight,
21+
com.ensoftcorp.atlas.core.db.graph,
22+
com.ensoftcorp.atlas.core.markup",
23+
com.se421.slice.analysis.utilities,
24+
com.se421.slice.analysis.utilities.dominance
25+
Automatic-Module-Name: com.ensoftcorp.open.slice

Diff for: com.se421.slice/build.properties

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = plugin.xml,\
4+
META-INF/,\
5+
.,\
6+
src/
7+
jars.compile.order = .
8+

Diff for: com.se421.slice/plugin.xml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
5+
<!-- create an initializer extension to initialize preferences -->
6+
<extension
7+
point="org.eclipse.equinox.preferences.preferences">
8+
<initializer
9+
class="com.se421.slice.preferences.SlicePreferences">
10+
</initializer>
11+
</extension>
12+
13+
<!-- adds a post code map hook for running slicing analysis automatically -->
14+
<extension
15+
point="com.ensoftcorp.atlas.core.ToolboxExtensionPoint">
16+
<indexer
17+
class="com.se421.slice.codemap.PDGCodemapStage">
18+
</indexer>
19+
</extension>
20+
21+
<!-- add smart views definitons -->
22+
<extension point="com.ensoftcorp.atlas.ui.smartViewScript">
23+
<!-- dominance smart views -->
24+
<script class="com.se421.slice.ui.smart.ControlFlowDominanceFrontierSmartView" />
25+
<script class="com.se421.slice.ui.smart.ControlFlowDominanceTreeSmartView" />
26+
<script class="com.se421.slice.ui.smart.ControlFlowPostDominanceFrontierSmartView" />
27+
<script class="com.se421.slice.ui.smart.ControlFlowPostDominanceTreeSmartView" />
28+
29+
<!-- slicing smart views -->
30+
<script class="com.se421.slice.ui.smart.ControlDependenceSliceSmartView"></script>
31+
<script class="com.se421.slice.ui.smart.DataDependenceSliceSmartView"></script>
32+
<script class="com.se421.slice.ui.smart.ProgramDependenceSliceSmartView"></script>
33+
</extension>
34+
35+
</plugin>

Diff for: com.se421.slice/src/com/se421/slice/Activator.java

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.se421.slice;
2+
3+
import org.eclipse.ui.plugin.AbstractUIPlugin;
4+
import org.osgi.framework.BundleContext;
5+
6+
/**
7+
* The activator class controls the plug-in life cycle
8+
*/
9+
public class Activator extends AbstractUIPlugin {
10+
11+
// The plug-in ID
12+
public static final String PLUGIN_ID = "com.se421.slice"; //$NON-NLS-1$
13+
14+
// The shared instance
15+
private static Activator plugin;
16+
17+
/**
18+
* The constructor
19+
*/
20+
public Activator() {
21+
}
22+
23+
/*
24+
* (non-Javadoc)
25+
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
26+
*/
27+
public void start(BundleContext context) throws Exception {
28+
super.start(context);
29+
plugin = this;
30+
}
31+
32+
/*
33+
* (non-Javadoc)
34+
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
35+
*/
36+
public void stop(BundleContext context) throws Exception {
37+
plugin = null;
38+
super.stop(context);
39+
}
40+
41+
/**
42+
* Returns the shared instance
43+
*
44+
* @return the shared instance
45+
*/
46+
public static Activator getDefault() {
47+
return plugin;
48+
}
49+
50+
}
51+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package com.se421.slice.analysis;
2+
3+
import com.ensoftcorp.atlas.core.db.graph.Edge;
4+
import com.ensoftcorp.atlas.core.db.graph.Graph;
5+
import com.ensoftcorp.atlas.core.db.graph.Node;
6+
import com.ensoftcorp.atlas.core.db.set.AtlasHashSet;
7+
import com.ensoftcorp.atlas.core.db.set.AtlasSet;
8+
import com.ensoftcorp.atlas.core.query.Q;
9+
import com.ensoftcorp.atlas.core.query.Query;
10+
import com.ensoftcorp.atlas.core.script.Common;
11+
import com.ensoftcorp.atlas.core.xcsg.XCSG;
12+
import com.se421.slice.codemap.DominanceAnalysis;
13+
14+
/**
15+
* Constructs the Control Dependence Graph (CGD) from a given Control Flow Graph (CFG)
16+
*
17+
* Instead of computing control dependence using the Ferrante, Ottenstein, and Warren algorithm
18+
* this uses the post-dominance frontier to compute the dominance edges.
19+
*
20+
* Reference:
21+
* 1) http://www.cc.gatech.edu/~harrold/6340/cs6340_fall2009/Slides/BasicAnalysis4.pdf
22+
* 2) https://www.cc.gatech.edu/~harrold/6340/cs6340_fall2009/Slides/BasicAnalysis5.pdf
23+
* 3) http://www.cs.utexas.edu/~pingali/CS380C/2016-fall/lectures/Dominators.pdf
24+
*
25+
* @author Ben Holland
26+
*/
27+
public class ControlDependenceGraph extends DependenceGraph {
28+
29+
/**
30+
* Used to tag the edges between nodes that contain a control dependence
31+
*/
32+
public static final String CONTROL_DEPENDENCE_EDGE = "control-dependence";
33+
34+
private Graph cfg;
35+
private Graph cdg;
36+
37+
public ControlDependenceGraph(Graph cfg){
38+
// sanity checks
39+
if(cfg.nodes().isEmpty() || cfg.edges().isEmpty()){
40+
this.cdg = Common.toQ(cfg).eval();
41+
this.cfg = Common.toQ(cfg).eval();
42+
return;
43+
}
44+
45+
46+
AtlasSet<Edge> controlDependenceEdgeSet = new AtlasHashSet<Edge>();
47+
AtlasSet<Edge> dominanceFrontierEdges = DominanceAnalysis.getPostDominanceFrontierEdges().eval().edges();
48+
49+
// TODO: implement
50+
// for each edge in the dominance frontier edges (x --pdomf--> y)
51+
// find or create a a control dependence edge from the successor to the predecessor (y --control-dependence--> x)
52+
// add the resulting edge to the controlDependenceEdgeSet
53+
54+
this.cdg = Common.toQ(controlDependenceEdgeSet).eval();
55+
}
56+
57+
/**
58+
* Finds or creates a control dependence edge
59+
* @param controlDependenceEdgeSet
60+
* @param fromStatement
61+
* @param toStatement
62+
*/
63+
private Edge findOrCreateControlDependenceEdge(Node fromStatement, Node toStatement) {
64+
Q controlDependenceEdges = Query.universe().edges(CONTROL_DEPENDENCE_EDGE);
65+
Edge controlDependenceEdge = controlDependenceEdges.betweenStep(Common.toQ(fromStatement), Common.toQ(toStatement)).eval().edges().one();
66+
if(controlDependenceEdge == null){
67+
controlDependenceEdge = Graph.U.createEdge(fromStatement, toStatement);
68+
controlDependenceEdge.tag(CONTROL_DEPENDENCE_EDGE);
69+
controlDependenceEdge.putAttr(XCSG.name, CONTROL_DEPENDENCE_EDGE);
70+
}
71+
return controlDependenceEdge;
72+
}
73+
74+
public Q getControlFlowGraph(){
75+
return Common.toQ(cfg);
76+
}
77+
78+
public Q getGraph(){
79+
return Common.toQ(cdg);
80+
}
81+
82+
}

0 commit comments

Comments
 (0)