Merge branch 'master' of https://github.com/wala/WALA
Conflicts: com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTestBase.java com.ibm.wala.ide.jdt.test/launchers/JDTJava15IRTests.launch
This commit is contained in:
commit
6c47da8091
|
@ -1,15 +1,37 @@
|
||||||
target/
|
*.DS_Store
|
||||||
|
*.class
|
||||||
|
*.out
|
||||||
|
*.swp
|
||||||
*/bin/
|
*/bin/
|
||||||
com.ibm.wala.cast.js.rhino/lib/
|
*/bin/*
|
||||||
com.ibm.wala.cast.js/lib/
|
*~
|
||||||
|
.metadata/
|
||||||
|
com.ibm.wala.cast.java.jdt.test/
|
||||||
com.ibm.wala.cast.java.polyglot/lib/
|
com.ibm.wala.cast.java.polyglot/lib/
|
||||||
com.ibm.wala.cast.java.test.data/src/JLex/
|
com.ibm.wala.cast.java.test.data/src/JLex/
|
||||||
.metadata/
|
com.ibm.wala.cast.java.test/testdata/
|
||||||
*~
|
|
||||||
com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
|
|
||||||
com.ibm.wala.core.testdata/@dot/
|
|
||||||
com.ibm.wala.core.testdata/*.jar
|
|
||||||
com.ibm.wala.core/dat/wala.properties
|
|
||||||
com.ibm.wala.core.tests/dat/wala.examples.properties
|
|
||||||
com.ibm.wala.cast.js.html.nu_validator/lib/
|
com.ibm.wala.cast.js.html.nu_validator/lib/
|
||||||
|
com.ibm.wala.cast.js.rhino.test/*.dump
|
||||||
|
com.ibm.wala.cast.js.rhino.test/*.html*
|
||||||
|
com.ibm.wala.cast.js.rhino.test/2009_swine_flu_outbreak
|
||||||
|
com.ibm.wala.cast.js.rhino.test/?game*
|
||||||
|
com.ibm.wala.cast.js.rhino.test/BunnyHunt
|
||||||
|
com.ibm.wala.cast.js.rhino.test/digg_attack
|
||||||
|
com.ibm.wala.cast.js.rhino.test/game.php*
|
||||||
|
com.ibm.wala.cast.js.rhino.test/xxxx
|
||||||
|
com.ibm.wala.cast.js.rhino/lib/
|
||||||
|
com.ibm.wala.cast.js.test.data/examples-src/ajaxslt/
|
||||||
|
com.ibm.wala.cast.js.test/examples-src/ajaxslt/
|
||||||
|
com.ibm.wala.cast.js/lib/
|
||||||
|
com.ibm.wala.core.testdata/*.jar
|
||||||
|
com.ibm.wala.core.testdata/@dot/
|
||||||
|
com.ibm.wala.core.testdata/lib/
|
||||||
|
com.ibm.wala.core.tests/dat/wala.examples.properties
|
||||||
|
com.ibm.wala.core.tests/report
|
||||||
|
com.ibm.wala.core/@dot
|
||||||
|
com.ibm.wala.core/com.ibm.wala.core*.jar
|
||||||
|
com.ibm.wala.core/dat/wala.properties
|
||||||
|
com.ibm.wala.dalvik/src/logback.xml
|
||||||
com.ibm.wala.ide.jdt.test/testdata/
|
com.ibm.wala.ide.jdt.test/testdata/
|
||||||
|
edu.kit.wala.smali.test/out/
|
||||||
|
target/
|
||||||
|
|
15
README.md
15
README.md
|
@ -1,2 +1,13 @@
|
||||||
This is the main source repository for WALA. For more details on WALA, see <a
|
# About WALA
|
||||||
href="http://wala.sourceforge.net">the WALA home page</a>.
|
|
||||||
|
This is a fork of the program analysis framework WALA. The original framework can be found at <a href="http://wala.sourceforge.net">wala.sourceforge.net</a> and <a href="https://github.com/wala/WALA">github.com/wala/WALA</a>.
|
||||||
|
|
||||||
|
This version is tailored for the information flow control framework JOANA. See <a href="http://joana.ipd.kit.edu">joana.ipd.kit.edu</a> and <a href="https://github.com/jgf/joana">github.com/jgf/joana</a> for details.
|
||||||
|
|
||||||
|
This fork includes some additional features:
|
||||||
|
- null-pointer detection that removes spurious CFG edges.
|
||||||
|
- it includes the code for a dalivk bytecode frontend copied and integrated from <a href="https://github.com/SCanDroid/SCanDroid">github.com/SCanDroid/SCanDroid</a>.
|
||||||
|
- configuration/property files are loaded from current directory, with an automatic fallback to load from .jar.
|
||||||
|
- SDG implementation that has different edge types for control and data dependencies.
|
||||||
|
- every SSAInstrution knows its index.
|
||||||
|
- many other minor changes.
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.ibm.wala.ide.jdt.test</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -15,5 +15,5 @@ Require-Bundle: com.ibm.wala.cast;bundle-version="1.0.0",
|
||||||
com.ibm.wala.cast.java.polyglot;bundle-version="1.0.0",
|
com.ibm.wala.cast.java.polyglot;bundle-version="1.0.0",
|
||||||
org.junit;bundle-version="4.0.0",
|
org.junit;bundle-version="4.0.0",
|
||||||
com.ibm.wala.cast.java.test.data;bundle-version="1.3.4"
|
com.ibm.wala.cast.java.test.data;bundle-version="1.3.4"
|
||||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
<listEntry value="1"/>
|
<listEntry value="1"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
|
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
|
||||||
|
<mapEntry key="[run]" value="org.eclipse.jdt.junit.launchconfig"/>
|
||||||
|
</mapAttribute>
|
||||||
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="/tmp/console.txt"/>
|
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="/tmp/console.txt"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="source"/>
|
<classpathentry kind="src" path="source"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/polyglot.jar"/>
|
|
||||||
<classpathentry exported="true" kind="lib" path="lib/java_cup.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/java_cup.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/polyglot.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -11,7 +11,7 @@ Require-Bundle: com.ibm.wala.cast.java,
|
||||||
com.ibm.wala.shrike,
|
com.ibm.wala.shrike,
|
||||||
org.eclipse.jdt.core,
|
org.eclipse.jdt.core,
|
||||||
org.eclipse.core.resources
|
org.eclipse.core.resources
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.ibm.wala.cast.java.translator.polyglot;
|
Export-Package: com.ibm.wala.cast.java.translator.polyglot;
|
||||||
uses:="com.ibm.wala.types,
|
uses:="com.ibm.wala.types,
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2002 - 2014 IBM Corporation.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
Binary file not shown.
|
@ -4,5 +4,5 @@ Bundle-Name: Data Plug-in
|
||||||
Bundle-SymbolicName: com.ibm.wala.cast.java.test.data
|
Bundle-SymbolicName: com.ibm.wala.cast.java.test.data
|
||||||
Bundle-Version: 1.3.4.qualifier
|
Bundle-Version: 1.3.4.qualifier
|
||||||
Bundle-Vendor: IBM
|
Bundle-Vendor: IBM
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
<property name="javacVerbose" value="false"/>
|
<property name="javacVerbose" value="false"/>
|
||||||
<property name="logExtension" value=".log"/>
|
<property name="logExtension" value=".log"/>
|
||||||
<property name="compilerArg" value=""/>
|
<property name="compilerArg" value=""/>
|
||||||
<property name="javacSource" value="1.5"/>
|
<property name="javacSource" value="1.7"/>
|
||||||
<property name="javacTarget" value="1.5"/>
|
<property name="javacTarget" value="1.7"/>
|
||||||
<!-- This property has been updated to correspond to the paths used by the latest Java update
|
<!-- This property has been updated to correspond to the paths used by the latest Java update
|
||||||
on Mac OS X 10.6 (Java version 1.6.0_22). If you are not using this version of Mac OS X or Java,
|
on Mac OS X 10.6 (Java version 1.6.0_22). If you are not using this version of Mac OS X or Java,
|
||||||
try changing the value of the property to "${java.home}/../../../Classes" -->
|
try changing the value of the property to "${java.home}/../../../Classes" -->
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="jar" depends="compile,testdatadir">
|
<target name="jar" depends="compile,testdatadir">
|
||||||
<jar destfile="${basedir}/../com.ibm.wala.ide.jdt.test/testdata/test_project.zip" basedir="${basedir}"/>
|
<jar destfile="${basedir}/../com.ibm.wala.ide.jdt.test/testdata/test_project.zip" manifest="${basedir}/META-INF/MANIFEST.MF" basedir="${basedir}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="init" depends="properties">
|
<target name="init" depends="properties">
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -14,4 +14,4 @@ Require-Bundle: com.ibm.wala.core.tests,
|
||||||
org.junit;bundle-version="4.0.0"
|
org.junit;bundle-version="4.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.ibm.wala.cast.java.test
|
Export-Package: com.ibm.wala.cast.java.test
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
|
|
@ -40,6 +40,8 @@ import com.ibm.wala.classLoader.SourceFileModule;
|
||||||
import com.ibm.wala.client.AbstractAnalysisEngine;
|
import com.ibm.wala.client.AbstractAnalysisEngine;
|
||||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||||
import com.ibm.wala.properties.WalaProperties;
|
import com.ibm.wala.properties.WalaProperties;
|
||||||
import com.ibm.wala.ssa.IR;
|
import com.ibm.wala.ssa.IR;
|
||||||
|
@ -344,8 +346,8 @@ public abstract class IRTests {
|
||||||
|
|
||||||
protected abstract AbstractAnalysisEngine getAnalysisEngine(String[] mainClassDescriptors, Collection<String> sources, List<String> libs);
|
protected abstract AbstractAnalysisEngine getAnalysisEngine(String[] mainClassDescriptors, Collection<String> sources, List<String> libs);
|
||||||
|
|
||||||
public Pair runTest(Collection<String> sources, List<String> libs, String[] mainClassDescriptors, List<? extends IRAssertion> ca,
|
public Pair<CallGraph, PointerAnalysis<InstanceKey>> runTest(Collection<String> sources, List<String> libs,
|
||||||
boolean assertReachable) {
|
String[] mainClassDescriptors, List<? extends IRAssertion> ca, boolean assertReachable) {
|
||||||
AbstractAnalysisEngine engine = getAnalysisEngine(mainClassDescriptors, sources, libs);
|
AbstractAnalysisEngine engine = getAnalysisEngine(mainClassDescriptors, sources, libs);
|
||||||
|
|
||||||
CallGraph callGraph;
|
CallGraph callGraph;
|
||||||
|
|
|
@ -379,12 +379,13 @@ public abstract class JavaIRTests extends IRTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testInnerClassA() {
|
@Test public void testInnerClassA() {
|
||||||
Pair x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true);
|
Pair<CallGraph, PointerAnalysis<InstanceKey>> x =
|
||||||
|
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true);
|
||||||
|
|
||||||
// can't do an IRAssertion() -- we need the pointer analysis
|
// can't do an IRAssertion() -- we need the pointer analysis
|
||||||
|
|
||||||
CallGraph cg = (CallGraph) x.fst;
|
CallGraph cg = x.fst;
|
||||||
PointerAnalysis pa = (PointerAnalysis) x.snd;
|
PointerAnalysis<InstanceKey> pa = x.snd;
|
||||||
|
|
||||||
Iterator<CGNode> iter = cg.iterator();
|
Iterator<CGNode> iter = cg.iterator();
|
||||||
while ( iter.hasNext() ) {
|
while ( iter.hasNext() ) {
|
||||||
|
@ -437,12 +438,13 @@ public abstract class JavaIRTests extends IRTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testInnerClassSuper() {
|
@Test public void testInnerClassSuper() {
|
||||||
Pair x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true);
|
Pair<CallGraph, PointerAnalysis<InstanceKey>> x =
|
||||||
|
runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), new ArrayList<IRAssertion>(), true);
|
||||||
|
|
||||||
// can't do an IRAssertion() -- we need the pointer analysis
|
// can't do an IRAssertion() -- we need the pointer analysis
|
||||||
|
|
||||||
CallGraph cg = (CallGraph) x.fst;
|
CallGraph cg = x.fst;
|
||||||
PointerAnalysis pa = (PointerAnalysis) x.snd;
|
PointerAnalysis<InstanceKey> pa = x.snd;
|
||||||
|
|
||||||
Iterator<CGNode> iter = cg.iterator();
|
Iterator<CGNode> iter = cg.iterator();
|
||||||
while ( iter.hasNext() ) {
|
while ( iter.hasNext() ) {
|
||||||
|
@ -594,10 +596,10 @@ public abstract class JavaIRTests extends IRTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testMiniaturSliceBug() throws IllegalArgumentException, CancelException {
|
@Test public void testMiniaturSliceBug() throws IllegalArgumentException, CancelException {
|
||||||
Pair<?, ?> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
|
Pair<CallGraph, PointerAnalysis<InstanceKey>> x = runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), emptyList, true);
|
||||||
|
|
||||||
PointerAnalysis pa = (PointerAnalysis) x.snd;
|
PointerAnalysis<InstanceKey> pa = x.snd;
|
||||||
CallGraph cg = (CallGraph) x.fst;
|
CallGraph cg = x.fst;
|
||||||
|
|
||||||
// test partial slice
|
// test partial slice
|
||||||
MethodReference sliceRootRef = getSliceRootReference("MiniaturSliceBug", "validNonDispatchedCall", "(LIntWrapper;)V");
|
MethodReference sliceRootRef = getSliceRootReference("MiniaturSliceBug", "validNonDispatchedCall", "(LIntWrapper;)V");
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore
|
|
@ -23,4 +23,4 @@ Export-Package: com.ibm.wala.cast.java,
|
||||||
com.ibm.wala.cast.java.translator,
|
com.ibm.wala.cast.java.translator,
|
||||||
com.ibm.wala.cast.java.types
|
com.ibm.wala.cast.java.types
|
||||||
Bundle-ClassPath: .
|
Bundle-ClassPath: .
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.ibm.wala.cast.java.ssa.AstJavaInstructionVisitor;
|
||||||
import com.ibm.wala.cast.java.ssa.AstJavaInvokeInstruction;
|
import com.ibm.wala.cast.java.ssa.AstJavaInvokeInstruction;
|
||||||
import com.ibm.wala.cast.java.ssa.EnclosingObjectReference;
|
import com.ibm.wala.cast.java.ssa.EnclosingObjectReference;
|
||||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
|
||||||
import com.ibm.wala.ipa.modref.ExtendedHeapModel;
|
import com.ibm.wala.ipa.modref.ExtendedHeapModel;
|
||||||
|
@ -29,7 +30,7 @@ public class AstJavaModRef extends AstModRef {
|
||||||
implements AstJavaInstructionVisitor
|
implements AstJavaInstructionVisitor
|
||||||
{
|
{
|
||||||
|
|
||||||
protected AstJavaRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, ExtendedHeapModel h) {
|
protected AstJavaRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, ExtendedHeapModel h) {
|
||||||
super(n, result, pa, (AstHeapModel)h);
|
super(n, result, pa, (AstHeapModel)h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ public class AstJavaModRef extends AstModRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RefVisitor makeRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, ExtendedHeapModel h) {
|
protected RefVisitor makeRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, ExtendedHeapModel h) {
|
||||||
return new AstJavaRefVisitor(n, result, pa, h);
|
return new AstJavaRefVisitor(n, result, pa, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public class AstJavaModRef extends AstModRef {
|
||||||
implements AstJavaInstructionVisitor
|
implements AstJavaInstructionVisitor
|
||||||
{
|
{
|
||||||
|
|
||||||
protected AstJavaModVisitor(CGNode n, Collection<PointerKey> result, ExtendedHeapModel h, PointerAnalysis pa) {
|
protected AstJavaModVisitor(CGNode n, Collection<PointerKey> result, ExtendedHeapModel h, PointerAnalysis<InstanceKey> pa) {
|
||||||
super(n, result, (AstHeapModel)h, pa);
|
super(n, result, (AstHeapModel)h, pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ public class AstJavaModRef extends AstModRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ModVisitor makeModVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, ExtendedHeapModel h, boolean ignoreAllocHeapDefs) {
|
protected ModVisitor makeModVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, ExtendedHeapModel h, boolean ignoreAllocHeapDefs) {
|
||||||
return new AstJavaModVisitor(n, result, h, pa);
|
return new AstJavaModVisitor(n, result, h, pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.ibm.wala.cast.java.ipa.modref.AstJavaModRef;
|
||||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||||
import com.ibm.wala.ipa.callgraph.impl.PartialCallGraph;
|
import com.ibm.wala.ipa.callgraph.impl.PartialCallGraph;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.slicer.NormalStatement;
|
import com.ibm.wala.ipa.slicer.NormalStatement;
|
||||||
import com.ibm.wala.ipa.slicer.SDG;
|
import com.ibm.wala.ipa.slicer.SDG;
|
||||||
|
@ -111,7 +112,7 @@ public class AstJavaSlicer extends Slicer {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pair<Collection<Statement>, SDG> computeAssertionSlice(CallGraph CG, PointerAnalysis pa,
|
public static Pair<Collection<Statement>, SDG> computeAssertionSlice(CallGraph CG, PointerAnalysis<InstanceKey> pa,
|
||||||
Collection<CGNode> partialRoots, boolean multiThreadedCode) throws IllegalArgumentException, CancelException {
|
Collection<CGNode> partialRoots, boolean multiThreadedCode) throws IllegalArgumentException, CancelException {
|
||||||
CallGraph pcg = PartialCallGraph.make(CG, new LinkedHashSet<CGNode>(partialRoots));
|
CallGraph pcg = PartialCallGraph.make(CG, new LinkedHashSet<CGNode>(partialRoots));
|
||||||
SDG sdg = new SDG(pcg, pa, new AstJavaModRef(), DataDependenceOptions.FULL, ControlDependenceOptions.FULL);
|
SDG sdg = new SDG(pcg, pa, new AstJavaModRef(), DataDependenceOptions.FULL, ControlDependenceOptions.FULL);
|
||||||
|
|
|
@ -87,6 +87,9 @@ import com.ibm.wala.util.strings.Atom;
|
||||||
*/
|
*/
|
||||||
public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
||||||
public Map<CAstEntity, IClass> fTypeMap = HashMapFactory.make();
|
public Map<CAstEntity, IClass> fTypeMap = HashMapFactory.make();
|
||||||
|
/** BEGIN Custom change: Common superclass is optional */
|
||||||
|
private final boolean existsCommonSuperclass; // extension to deal with X10 that has no common superclass
|
||||||
|
/** END Custom change: Common superclass is optional */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WALA representation of a Java class residing in a source file
|
* WALA representation of a Java class residing in a source file
|
||||||
|
@ -135,7 +138,10 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
||||||
// The following test allows the root class to reside in source; without
|
// The following test allows the root class to reside in source; without
|
||||||
// it, the assertion requires all classes represented by a JavaClass to
|
// it, the assertion requires all classes represented by a JavaClass to
|
||||||
// have a superclass.
|
// have a superclass.
|
||||||
if (!getName().equals(JavaSourceLoaderImpl.this.getLanguage().getRootType().getName()) && !excludedSupertype) {
|
/** BEGIN Custom change: Common superclass is optional */
|
||||||
|
// Is no longer true in new X10 - no common object super class
|
||||||
|
if (existsCommonSuperclass && !getName().equals(JavaSourceLoaderImpl.this.getLanguage().getRootType().getName()) && !excludedSupertype) {
|
||||||
|
/** END Custom change: Common superclass is optional */
|
||||||
Assertions.UNREACHABLE("Cannot find super class for " + this + " in " + superTypeNames);
|
Assertions.UNREACHABLE("Cannot find super class for " + this + " in " + superTypeNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,10 +483,19 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) throws IOException {
|
/** BEGIN Custom change: Common superclass is optional */
|
||||||
|
public JavaSourceLoaderImpl(boolean existsCommonSuperClass, ClassLoaderReference loaderRef, IClassLoader parent,
|
||||||
|
SetOfClasses exclusions, IClassHierarchy cha) throws IOException {
|
||||||
super(loaderRef, cha.getScope().getArrayClassLoader(), parent, cha.getScope().getExclusions(), cha);
|
super(loaderRef, cha.getScope().getArrayClassLoader(), parent, cha.getScope().getExclusions(), cha);
|
||||||
|
this.existsCommonSuperclass = existsCommonSuperClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JavaSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) throws IOException {
|
||||||
|
// standard case: we have a common super class
|
||||||
|
this(true, loaderRef, parent, exclusions, cha);
|
||||||
|
}
|
||||||
|
/** END Custom change: Common superclass is optional */
|
||||||
|
|
||||||
public IClassHierarchy getClassHierarchy() {
|
public IClassHierarchy getClassHierarchy() {
|
||||||
return cha;
|
return cha;
|
||||||
}
|
}
|
||||||
|
@ -491,12 +506,20 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract SourceModuleTranslator getTranslator();
|
protected abstract SourceModuleTranslator getTranslator();
|
||||||
|
/** BEGIN Custom change: Optional deletion of fTypeMap */
|
||||||
|
public static volatile boolean deleteTypeMapAfterInit = true;
|
||||||
|
/** END Custom change: Optional deletion of fTypeMap */
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(List<Module> modules) throws IOException {
|
public void init(List<Module> modules) throws IOException {
|
||||||
super.init(modules);
|
super.init(modules);
|
||||||
|
/** BEGIN Custom change: Optional deletion of fTypeMap */
|
||||||
|
if (deleteTypeMapAfterInit) {
|
||||||
fTypeMap = null;
|
fTypeMap = null;
|
||||||
}
|
}
|
||||||
|
/** END Custom change: Optional deletion of fTypeMap */
|
||||||
|
}
|
||||||
|
|
||||||
public void defineFunction(CAstEntity n, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
public void defineFunction(CAstEntity n, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||||
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||||
|
@ -541,107 +564,107 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
||||||
public static class InstructionFactory extends JavaInstructionFactory implements AstJavaInstructionFactory {
|
public static class InstructionFactory extends JavaInstructionFactory implements AstJavaInstructionFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.ibm.wala.cast.java.ssa.EnclosingObjectReference EnclosingObjectReference(int lval, TypeReference type) {
|
public com.ibm.wala.cast.java.ssa.EnclosingObjectReference EnclosingObjectReference(int iindex, int lval, TypeReference type) {
|
||||||
return new EnclosingObjectReference(lval, type);
|
return new EnclosingObjectReference(iindex, lval, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstJavaNewEnclosingInstruction JavaNewEnclosingInstruction(int result, NewSiteReference site, int enclosing) {
|
public AstJavaNewEnclosingInstruction JavaNewEnclosingInstruction(int iindex, int result, NewSiteReference site, int enclosing) {
|
||||||
return new AstJavaNewEnclosingInstruction(result, site, enclosing);
|
return new AstJavaNewEnclosingInstruction(iindex, result, site, enclosing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstJavaInvokeInstruction JavaInvokeInstruction(int result[], int[] params, int exception, CallSiteReference site) {
|
public AstJavaInvokeInstruction JavaInvokeInstruction(int iindex, int result[], int[] params, int exception, CallSiteReference site) {
|
||||||
return result == null ? new AstJavaInvokeInstruction(params, exception, site) : new AstJavaInvokeInstruction(result[0],
|
return result == null ? new AstJavaInvokeInstruction(iindex, params, exception, site) : new AstJavaInvokeInstruction(iindex, result[0],
|
||||||
params, exception, site);
|
params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstAssertInstruction AssertInstruction(int value, boolean fromSpecification) {
|
public AstAssertInstruction AssertInstruction(int iindex, int value, boolean fromSpecification) {
|
||||||
return new AstAssertInstruction(value, fromSpecification);
|
return new AstAssertInstruction(iindex, value, fromSpecification);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.ibm.wala.cast.ir.ssa.AssignInstruction AssignInstruction(int result, int val) {
|
public com.ibm.wala.cast.ir.ssa.AssignInstruction AssignInstruction(int iindex, int result, int val) {
|
||||||
return new AssignInstruction(result, val);
|
return new AssignInstruction(iindex, result, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.ibm.wala.cast.ir.ssa.EachElementGetInstruction EachElementGetInstruction(int value, int objectRef) {
|
public com.ibm.wala.cast.ir.ssa.EachElementGetInstruction EachElementGetInstruction(int iindex, int value, int objectRef) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction EachElementHasNextInstruction(int value, int objectRef) {
|
public com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction EachElementHasNextInstruction(int iindex, int value, int objectRef) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstEchoInstruction EchoInstruction(int[] rvals) {
|
public AstEchoInstruction EchoInstruction(int iindex, int[] rvals) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstGlobalRead GlobalRead(int lhs, FieldReference global) {
|
public AstGlobalRead GlobalRead(int iindex, int lhs, FieldReference global) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstGlobalWrite GlobalWrite(FieldReference global, int rhs) {
|
public AstGlobalWrite GlobalWrite(int iindex, FieldReference global, int rhs) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, int fieldVal, FieldReference fieldRef) {
|
public AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, int fieldVal, FieldReference fieldRef) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, FieldReference fieldRef) {
|
public AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, FieldReference fieldRef) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, int fieldVal) {
|
public AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, int fieldVal) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval) {
|
public AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalRead LexicalRead(Access[] accesses) {
|
public AstLexicalRead LexicalRead(int iindex, Access[] accesses) {
|
||||||
return new AstLexicalRead(accesses);
|
return new AstLexicalRead(iindex, accesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalRead LexicalRead(Access access) {
|
public AstLexicalRead LexicalRead(int iindex, Access access) {
|
||||||
return new AstLexicalRead(access);
|
return new AstLexicalRead(iindex, access);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalRead LexicalRead(int lhs, String definer, String globalName, TypeReference type) {
|
public AstLexicalRead LexicalRead(int iindex, int lhs, String definer, String globalName, TypeReference type) {
|
||||||
return new AstLexicalRead(lhs, definer, globalName, type);
|
return new AstLexicalRead(iindex, lhs, definer, globalName, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalWrite LexicalWrite(Access[] accesses) {
|
public AstLexicalWrite LexicalWrite(int iindex, Access[] accesses) {
|
||||||
return new AstLexicalWrite(accesses);
|
return new AstLexicalWrite(iindex, accesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalWrite LexicalWrite(Access access) {
|
public AstLexicalWrite LexicalWrite(int iindex, Access access) {
|
||||||
return new AstLexicalWrite(access);
|
return new AstLexicalWrite(iindex, access);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalWrite LexicalWrite(String definer, String globalName, TypeReference type, int rhs) {
|
public AstLexicalWrite LexicalWrite(int iindex, String definer, String globalName, TypeReference type, int rhs) {
|
||||||
return new AstLexicalWrite(definer, globalName, type, rhs);
|
return new AstLexicalWrite(iindex, definer, globalName, type, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SSAThrowInstruction NonExceptingThrowInstruction(int exception) {
|
public SSAThrowInstruction NonExceptingThrowInstruction(int iindex, int exception) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@ import com.ibm.wala.types.TypeReference;
|
||||||
|
|
||||||
public interface AstJavaInstructionFactory extends AstInstructionFactory {
|
public interface AstJavaInstructionFactory extends AstInstructionFactory {
|
||||||
|
|
||||||
AstJavaInvokeInstruction JavaInvokeInstruction(int result[], int[] params, int exception, CallSiteReference site);
|
AstJavaInvokeInstruction JavaInvokeInstruction(int iindex, int result[], int[] params, int exception, CallSiteReference site);
|
||||||
|
|
||||||
EnclosingObjectReference EnclosingObjectReference(int lval, TypeReference type);
|
EnclosingObjectReference EnclosingObjectReference(int iindex, int lval, TypeReference type);
|
||||||
|
|
||||||
AstJavaNewEnclosingInstruction JavaNewEnclosingInstruction(int result, NewSiteReference site, int enclosing);
|
AstJavaNewEnclosingInstruction JavaNewEnclosingInstruction(int iindex, int result, NewSiteReference site, int enclosing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,25 +22,25 @@ import com.ibm.wala.types.TypeReference;
|
||||||
|
|
||||||
public class AstJavaInvokeInstruction extends FixedParametersInvokeInstruction {
|
public class AstJavaInvokeInstruction extends FixedParametersInvokeInstruction {
|
||||||
|
|
||||||
protected AstJavaInvokeInstruction(int results[], int[] params, int exception, CallSiteReference site) {
|
protected AstJavaInvokeInstruction(int iindex, int results[], int[] params, int exception, CallSiteReference site) {
|
||||||
super(results, params, exception, site);
|
super(iindex, results, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstJavaInvokeInstruction(int result, int[] params, int exception, CallSiteReference site) {
|
public AstJavaInvokeInstruction(int iindex, int result, int[] params, int exception, CallSiteReference site) {
|
||||||
this(new int[] { result }, params, exception, site);
|
this(iindex, new int[] { result }, params, exception, site);
|
||||||
SSAInvokeInstruction.assertParamsKosher(result, params, site);
|
SSAInvokeInstruction.assertParamsKosher(result, params, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor InvokeInstruction. This case for void return values
|
* Constructor InvokeInstruction. This case for void return values
|
||||||
*/
|
*/
|
||||||
public AstJavaInvokeInstruction(int[] params, int exception, CallSiteReference site) {
|
public AstJavaInvokeInstruction(int iindex, int[] params, int exception, CallSiteReference site) {
|
||||||
this(null, params, exception, site);
|
this(iindex, null, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SSAInstruction copyInstruction(SSAInstructionFactory insts, int results[], int[] params, int exception) {
|
protected SSAInstruction copyInstruction(SSAInstructionFactory insts, int results[], int[] params, int exception) {
|
||||||
return ((AstJavaInstructionFactory) insts).JavaInvokeInstruction(results, params, exception, getCallSite());
|
return ((AstJavaInstructionFactory) insts).JavaInvokeInstruction(iindex, results, params, exception, getCallSite());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,8 +35,8 @@ public class AstJavaNewEnclosingInstruction extends SSANewInstruction {
|
||||||
return enclosing;
|
return enclosing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstJavaNewEnclosingInstruction(int result, NewSiteReference site, int enclosing) throws IllegalArgumentException {
|
public AstJavaNewEnclosingInstruction(int iindex, int result, NewSiteReference site, int enclosing) throws IllegalArgumentException {
|
||||||
super(result, site);
|
super(iindex, result, site);
|
||||||
this.enclosing = enclosing;
|
this.enclosing = enclosing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class AstJavaNewEnclosingInstruction extends SSANewInstruction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstJavaInstructionFactory)insts).JavaNewEnclosingInstruction(defs==null? getDef(0): defs[0], getNewSite(), uses==null? enclosing: uses[0]);
|
return ((AstJavaInstructionFactory)insts).JavaNewEnclosingInstruction(iindex, defs==null? getDef(0): defs[0], getNewSite(), uses==null? enclosing: uses[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,7 +30,8 @@ public class EnclosingObjectReference extends SSAInstruction {
|
||||||
|
|
||||||
private final int lval;
|
private final int lval;
|
||||||
|
|
||||||
public EnclosingObjectReference(int lval, TypeReference type) {
|
public EnclosingObjectReference(int iindex, int lval, TypeReference type) {
|
||||||
|
super(iindex);
|
||||||
this.lval = lval;
|
this.lval = lval;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +64,7 @@ public class EnclosingObjectReference extends SSAInstruction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstJavaInstructionFactory) insts).EnclosingObjectReference(defs == null ? lval : defs[0], type);
|
return ((AstJavaInstructionFactory) insts).EnclosingObjectReference(iindex, defs == null ? lval : defs[0], type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -98,13 +98,13 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doThrow(WalkContext context, int exception) {
|
protected void doThrow(WalkContext context, int exception) {
|
||||||
context.cfg().addInstruction(insts.ThrowInstruction(exception));
|
context.cfg().addInstruction(insts.ThrowInstruction(context.cfg().getCurrentInstruction(), exception));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doArrayRead(WalkContext context, int result, int arrayValue, CAstNode arrayRefNode, int[] dimValues) {
|
public void doArrayRead(WalkContext context, int result, int arrayValue, CAstNode arrayRefNode, int[] dimValues) {
|
||||||
TypeReference arrayTypeRef = (TypeReference) arrayRefNode.getChild(1).getValue();
|
TypeReference arrayTypeRef = (TypeReference) arrayRefNode.getChild(1).getValue();
|
||||||
context.cfg().addInstruction(insts.ArrayLoadInstruction(result, arrayValue, dimValues[0], arrayTypeRef));
|
context.cfg().addInstruction(insts.ArrayLoadInstruction(context.cfg().getCurrentInstruction(), result, arrayValue, dimValues[0], arrayTypeRef));
|
||||||
processExceptions(arrayRefNode, context);
|
processExceptions(arrayRefNode, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
TypeReference arrayTypeRef = arrayRefNode.getKind() == CAstNode.ARRAY_LITERAL ? ((TypeReference) arrayRefNode.getChild(0)
|
TypeReference arrayTypeRef = arrayRefNode.getKind() == CAstNode.ARRAY_LITERAL ? ((TypeReference) arrayRefNode.getChild(0)
|
||||||
.getChild(0).getValue()).getArrayElementType() : (TypeReference) arrayRefNode.getChild(1).getValue();
|
.getChild(0).getValue()).getArrayElementType() : (TypeReference) arrayRefNode.getChild(1).getValue();
|
||||||
|
|
||||||
context.cfg().addInstruction(insts.ArrayStoreInstruction(arrayValue, dimValues[0], rval, arrayTypeRef));
|
context.cfg().addInstruction(insts.ArrayStoreInstruction(context.cfg().getCurrentInstruction(), arrayValue, dimValues[0], rval, arrayTypeRef));
|
||||||
|
|
||||||
processExceptions(arrayRefNode, context);
|
processExceptions(arrayRefNode, context);
|
||||||
}
|
}
|
||||||
|
@ -125,9 +125,9 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
|
|
||||||
if (receiver == -1) { // a static field: AstTranslator.getValue() produces
|
if (receiver == -1) { // a static field: AstTranslator.getValue() produces
|
||||||
// -1 for null, we hope
|
// -1 for null, we hope
|
||||||
context.cfg().addInstruction(insts.GetInstruction(result, fieldRef));
|
context.cfg().addInstruction(insts.GetInstruction(context.cfg().getCurrentInstruction(), result, fieldRef));
|
||||||
} else {
|
} else {
|
||||||
context.cfg().addInstruction(insts.GetInstruction(result, receiver, fieldRef));
|
context.cfg().addInstruction(insts.GetInstruction(context.cfg().getCurrentInstruction(), result, receiver, fieldRef));
|
||||||
processExceptions(parent, context);
|
processExceptions(parent, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,9 +138,9 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
|
|
||||||
if (receiver == -1) { // a static field: AstTranslator.getValue() produces
|
if (receiver == -1) { // a static field: AstTranslator.getValue() produces
|
||||||
// -1 for null, we hope
|
// -1 for null, we hope
|
||||||
context.cfg().addInstruction(insts.PutInstruction(rval, fieldRef));
|
context.cfg().addInstruction(insts.PutInstruction(context.cfg().getCurrentInstruction(), rval, fieldRef));
|
||||||
} else {
|
} else {
|
||||||
context.cfg().addInstruction(insts.PutInstruction(receiver, rval, fieldRef));
|
context.cfg().addInstruction(insts.PutInstruction(context.cfg().getCurrentInstruction(), receiver, rval, fieldRef));
|
||||||
processExceptions(parent, context);
|
processExceptions(parent, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,10 +158,10 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
NewSiteReference site = NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef);
|
NewSiteReference site = NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef);
|
||||||
|
|
||||||
if (newNode.getKind() == CAstNode.NEW_ENCLOSING) {
|
if (newNode.getKind() == CAstNode.NEW_ENCLOSING) {
|
||||||
context.cfg().addInstruction(new AstJavaNewEnclosingInstruction(result, site, arguments[0]));
|
context.cfg().addInstruction(new AstJavaNewEnclosingInstruction(context.cfg().getCurrentInstruction(), result, site, arguments[0]));
|
||||||
} else {
|
} else {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
(arguments == null) ? insts.NewInstruction(result, site) : insts.NewInstruction(result, site, arguments));
|
(arguments == null) ? insts.NewInstruction(context.cfg().getCurrentInstruction(), result, site) : insts.NewInstruction(context.cfg().getCurrentInstruction(), result, site, arguments));
|
||||||
}
|
}
|
||||||
processExceptions(newNode, context);
|
processExceptions(newNode, context);
|
||||||
}
|
}
|
||||||
|
@ -197,9 +197,9 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
CallSiteReference realSiteRef = CallSiteReference.make(pc, dummySiteRef.getDeclaredTarget(), dummySiteRef.getInvocationCode());
|
CallSiteReference realSiteRef = CallSiteReference.make(pc, dummySiteRef.getDeclaredTarget(), dummySiteRef.getInvocationCode());
|
||||||
|
|
||||||
if (realSiteRef.getDeclaredTarget().getReturnType().equals(TypeReference.Void))
|
if (realSiteRef.getDeclaredTarget().getReturnType().equals(TypeReference.Void))
|
||||||
context.cfg().addInstruction(new AstJavaInvokeInstruction(realArgs, exception, realSiteRef));
|
context.cfg().addInstruction(new AstJavaInvokeInstruction(context.cfg().getCurrentInstruction(), realArgs, exception, realSiteRef));
|
||||||
else
|
else
|
||||||
context.cfg().addInstruction(new AstJavaInvokeInstruction(result, realArgs, exception, realSiteRef));
|
context.cfg().addInstruction(new AstJavaInvokeInstruction(context.cfg().getCurrentInstruction(), result, realArgs, exception, realSiteRef));
|
||||||
processExceptions(call, context);
|
processExceptions(call, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
} else {
|
} else {
|
||||||
int result = c.currentScope().allocateTempValue();
|
int result = c.currentScope().allocateTempValue();
|
||||||
c.setValue(n, result);
|
c.setValue(n, result);
|
||||||
c.cfg().addInstruction(new EnclosingObjectReference(result, (TypeReference) n.getChild(0).getValue()));
|
c.cfg().addInstruction(new EnclosingObjectReference(c.cfg().getCurrentInstruction(), result, (TypeReference) n.getChild(0).getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,21 +353,22 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
if (toRef.isPrimitiveType()) {
|
if (toRef.isPrimitiveType()) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.ConversionInstruction(
|
insts.ConversionInstruction(
|
||||||
|
context.cfg().getCurrentInstruction(),
|
||||||
result,
|
result,
|
||||||
context.getValue(n.getChild(1)),
|
context.getValue(n.getChild(1)),
|
||||||
fromRef,
|
fromRef,
|
||||||
toRef,
|
toRef,
|
||||||
false));
|
false));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.CheckCastInstruction(
|
insts.CheckCastInstruction(
|
||||||
|
context.cfg().getCurrentInstruction(),
|
||||||
result,
|
result,
|
||||||
context.getValue(n.getChild(1)),
|
context.getValue(n.getChild(1)),
|
||||||
toRef,
|
toRef,
|
||||||
true));
|
true));
|
||||||
|
|
||||||
processExceptions(n, context);
|
processExceptions(n, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,6 +387,7 @@ processExceptions(n, context);
|
||||||
TypeReference ref = makeType( type );
|
TypeReference ref = makeType( type );
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.InstanceofInstruction(
|
insts.InstanceofInstruction(
|
||||||
|
context.cfg().getCurrentInstruction(),
|
||||||
result,
|
result,
|
||||||
context.getValue(n.getChild(1)),
|
context.getValue(n.getChild(1)),
|
||||||
ref));
|
ref));
|
||||||
|
@ -395,13 +397,13 @@ processExceptions(n, context);
|
||||||
protected boolean doVisit(CAstNode n, WalkContext wc, CAstVisitor<WalkContext> visitor) {
|
protected boolean doVisit(CAstNode n, WalkContext wc, CAstVisitor<WalkContext> visitor) {
|
||||||
if (n.getKind() == CAstNode.MONITOR_ENTER) {
|
if (n.getKind() == CAstNode.MONITOR_ENTER) {
|
||||||
visitor.visit(n.getChild(0), wc, visitor);
|
visitor.visit(n.getChild(0), wc, visitor);
|
||||||
wc.cfg().addInstruction(insts.MonitorInstruction(wc.getValue(n.getChild(0)), true));
|
wc.cfg().addInstruction(insts.MonitorInstruction(wc.cfg().getCurrentInstruction(), wc.getValue(n.getChild(0)), true));
|
||||||
processExceptions(n, wc);
|
processExceptions(n, wc);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (n.getKind() == CAstNode.MONITOR_EXIT) {
|
} else if (n.getKind() == CAstNode.MONITOR_EXIT) {
|
||||||
visitor.visit(n.getChild(0), wc, visitor);
|
visitor.visit(n.getChild(0), wc, visitor);
|
||||||
wc.cfg().addInstruction(insts.MonitorInstruction(wc.getValue(n.getChild(0)), false));
|
wc.cfg().addInstruction(insts.MonitorInstruction(wc.cfg().getCurrentInstruction(), wc.getValue(n.getChild(0)), false));
|
||||||
processExceptions(n, wc);
|
processExceptions(n, wc);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="tests"/>
|
<classpathentry kind="src" path="tests"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
|
||||||
<classpathentry kind="lib" path="lib/htmlparser-1.4.jar"/>
|
<classpathentry kind="lib" path="lib/htmlparser-1.4.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -12,6 +12,6 @@ Require-Bundle: com.ibm.wala.cast.js;bundle-version="1.0.0",
|
||||||
com.ibm.wala.core.tests;bundle-version="1.1.3",
|
com.ibm.wala.core.tests;bundle-version="1.1.3",
|
||||||
com.ibm.wala.core;bundle-version="1.1.3",
|
com.ibm.wala.core;bundle-version="1.1.3",
|
||||||
org.junit;bundle-version="4.8.1"
|
org.junit;bundle-version="4.8.1"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Bundle-ClassPath: .,
|
Bundle-ClassPath: .,
|
||||||
lib/htmlparser-1.4.jar
|
lib/htmlparser-1.4.jar
|
||||||
|
|
|
@ -13,7 +13,7 @@ Require-Bundle: com.ibm.wala.cast.js.rhino;bundle-version="1.0.0",
|
||||||
com.ibm.wala.core.tests;bundle-version="1.1.3",
|
com.ibm.wala.core.tests;bundle-version="1.1.3",
|
||||||
com.ibm.wala.cast.js.test.data;bundle-version="1.3.4",
|
com.ibm.wala.cast.js.test.data;bundle-version="1.3.4",
|
||||||
org.junit;bundle-version="4.0.0"
|
org.junit;bundle-version="4.0.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test,
|
Export-Package: com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test,
|
||||||
com.ibm.wala.cast.js.rhino.test,
|
com.ibm.wala.cast.js.rhino.test,
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilderCancelException;
|
import com.ibm.wala.ipa.callgraph.CallGraphBuilderCancelException;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||||
import com.ibm.wala.util.NullProgressMonitor;
|
import com.ibm.wala.util.NullProgressMonitor;
|
||||||
|
@ -59,7 +60,7 @@ public class HTMLCGBuilder {
|
||||||
public JSCFABuilder builder;
|
public JSCFABuilder builder;
|
||||||
|
|
||||||
/** pointer analysis results; partial if {@link #construction_time} is {@code -1} */
|
/** pointer analysis results; partial if {@link #construction_time} is {@code -1} */
|
||||||
public PointerAnalysis pa;
|
public PointerAnalysis<InstanceKey> pa;
|
||||||
|
|
||||||
/** call graph; partial if {@link #construction_time} is {@code -1} */
|
/** call graph; partial if {@link #construction_time} is {@code -1} */
|
||||||
public CallGraph cg;
|
public CallGraph cg;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.junit.Test;
|
||||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
||||||
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||||
import com.ibm.wala.cast.js.util.Util;
|
import com.ibm.wala.cast.js.util.Util;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder;
|
import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder;
|
||||||
import com.ibm.wala.util.CancelException;
|
import com.ibm.wala.util.CancelException;
|
||||||
|
@ -39,7 +40,7 @@ public class TestSimpleCallGraphShapeRhino extends TestSimpleCallGraphShape {
|
||||||
public void test214631() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
public void test214631() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||||
JSCFABuilder b = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "214631.js");
|
JSCFABuilder b = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "214631.js");
|
||||||
b.makeCallGraph(b.getOptions());
|
b.makeCallGraph(b.getOptions());
|
||||||
PointerAnalysis PA = b.getPointerAnalysis();
|
PointerAnalysis<InstanceKey> PA = b.getPointerAnalysis();
|
||||||
// just make sure this does not crash
|
// just make sure this does not crash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||||
import com.ibm.wala.classLoader.SourceFileModule;
|
import com.ibm.wala.classLoader.SourceFileModule;
|
||||||
import com.ibm.wala.classLoader.SourceModule;
|
import com.ibm.wala.classLoader.SourceModule;
|
||||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||||
import com.ibm.wala.util.CancelException;
|
import com.ibm.wala.util.CancelException;
|
||||||
|
@ -57,7 +58,7 @@ public class JsViewerDriver extends JSCallGraphBuilderUtil {
|
||||||
builder.setBaseURL(url);
|
builder.setBaseURL(url);
|
||||||
|
|
||||||
CallGraph cg = builder.makeCallGraph(builder.getOptions());
|
CallGraph cg = builder.makeCallGraph(builder.getOptions());
|
||||||
PointerAnalysis pa = builder.getPointerAnalysis();
|
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||||
|
|
||||||
new JsViewer(cg, pa);
|
new JsViewer(cg, pa);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="source"/>
|
<classpathentry kind="src" path="source"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
|
||||||
<classpathentry kind="lib" path="lib/rhino-1.7R3.jar"/>
|
<classpathentry kind="lib" path="lib/rhino-1.7R3.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
com.ibm.wala.cast;bundle-version="1.0.0",
|
com.ibm.wala.cast;bundle-version="1.0.0",
|
||||||
com.ibm.wala.cast.js;bundle-version="1.0.0",
|
com.ibm.wala.cast.js;bundle-version="1.0.0",
|
||||||
com.ibm.wala.core;bundle-version="1.1.3"
|
com.ibm.wala.core;bundle-version="1.1.3"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.ibm.wala.cast.js.translator,
|
Export-Package: com.ibm.wala.cast.js.translator,
|
||||||
com.ibm.wala.js.rhino,
|
com.ibm.wala.js.rhino,
|
||||||
|
|
|
@ -8,4 +8,4 @@ Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-ClassPath: examples-src/
|
Bundle-ClassPath: examples-src/
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="harness-src"/>
|
<classpathentry kind="src" path="harness-src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -15,4 +15,4 @@ Require-Bundle: com.ibm.wala.cast.js,
|
||||||
org.junit;bundle-version="4.0.0"
|
org.junit;bundle-version="4.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.ibm.wala.cast.js.test
|
Export-Package: com.ibm.wala.cast.js.test
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
<listEntry value="1"/>
|
<listEntry value="1"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
|
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
|
||||||
|
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
|
||||||
|
<mapEntry key="[run]" value="org.eclipse.jdt.junit.launchconfig"/>
|
||||||
|
</mapAttribute>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<classpathentry kind="src" path="dat"/>
|
<classpathentry kind="src" path="dat"/>
|
||||||
<classpathentry kind="lib" path="lib/jericho-html-3.2.jar"/>
|
<classpathentry kind="lib" path="lib/jericho-html-3.2.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-io-2.4.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -4,8 +4,7 @@ Bundle-Name: JavaScript Plug-in
|
||||||
Bundle-SymbolicName: com.ibm.wala.cast.js;singleton:=true
|
Bundle-SymbolicName: com.ibm.wala.cast.js;singleton:=true
|
||||||
Bundle-Version: 1.3.4.qualifier
|
Bundle-Version: 1.3.4.qualifier
|
||||||
Bundle-ClassPath: .,
|
Bundle-ClassPath: .,
|
||||||
lib/jericho-html-3.2.jar,
|
lib/jericho-html-3.2.jar
|
||||||
lib/commons-io-2.4.jar
|
|
||||||
Bundle-Activator: com.ibm.wala.cast.js.JavaScriptPlugin
|
Bundle-Activator: com.ibm.wala.cast.js.JavaScriptPlugin
|
||||||
Bundle-Vendor: IBM
|
Bundle-Vendor: IBM
|
||||||
Export-Package: .,
|
Export-Package: .,
|
||||||
|
@ -38,4 +37,4 @@ Require-Bundle: com.ibm.wala.cast,
|
||||||
org.eclipse.core.runtime;bundle-version="3.4.0",
|
org.eclipse.core.runtime;bundle-version="3.4.0",
|
||||||
org.apache.commons.logging
|
org.apache.commons.logging
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
bin.includes = .,\
|
bin.includes = .,\
|
||||||
META-INF/,\
|
META-INF/,\
|
||||||
lib/,\
|
lib/,\
|
||||||
lib/commons-io-2.4.jar,\
|
|
||||||
lib/jericho-html-3.2.jar
|
lib/jericho-html-3.2.jar
|
||||||
source.. = source/,\
|
source.. = source/,\
|
||||||
dat/
|
dat/
|
||||||
|
|
|
@ -36,10 +36,6 @@
|
||||||
<available file="${plugin.destination}/lib/jericho-html-3.2.jar" property="jericho.present"/>
|
<available file="${plugin.destination}/lib/jericho-html-3.2.jar" property="jericho.present"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="CommonsIoPresent" depends="init">
|
|
||||||
<available file="${plugin.destination}/lib/commons-io-2.4.jar" property="commons.io.present"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="fetchJericho" depends="JerichoPresent" unless="jericho.present">
|
<target name="fetchJericho" depends="JerichoPresent" unless="jericho.present">
|
||||||
<delete dir="${temp.folder}"/>
|
<delete dir="${temp.folder}"/>
|
||||||
<mkdir dir="${temp.folder}"/>
|
<mkdir dir="${temp.folder}"/>
|
||||||
|
@ -49,17 +45,7 @@
|
||||||
<delete dir="${temp.folder}"/>
|
<delete dir="${temp.folder}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="fetchCommonsIo" depends="CommonsIoPresent" unless="commons.io.present">
|
<target name="getJars" depends="fetchJericho" />
|
||||||
<delete dir="${temp.folder}"/>
|
|
||||||
<mkdir dir="${temp.folder}"/>
|
|
||||||
<get src="http://apache.petsads.us/commons/io/binaries/commons-io-2.4-bin.zip" dest="${temp.folder}/commons-io-2.4.zip"/>
|
|
||||||
<unzip src="${temp.folder}/commons-io-2.4.zip" dest="${temp.folder}"/>
|
|
||||||
<copy file="${temp.folder}/commons-io-2.4/commons-io-2.4.jar" tofile="${plugin.destination}/lib/commons-io-2.4.jar" />
|
|
||||||
<delete dir="${temp.folder}"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
|
|
||||||
<target name="getJars" depends="fetchJericho,fetchCommonsIo" />
|
|
||||||
|
|
||||||
<target name="init" depends="properties">
|
<target name="init" depends="properties">
|
||||||
<condition property="pluginTemp" value="${buildTempFolder}/plugins">
|
<condition property="pluginTemp" value="${buildTempFolder}/plugins">
|
||||||
|
|
|
@ -22,13 +22,6 @@
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<artifactItems>
|
<artifactItems>
|
||||||
<artifactItem>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<version>2.4</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<overWrite>false</overWrite>
|
|
||||||
</artifactItem>
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>net.htmlparser.jericho</groupId>
|
<groupId>net.htmlparser.jericho</groupId>
|
||||||
<artifactId>jericho-html</artifactId>
|
<artifactId>jericho-html</artifactId>
|
||||||
|
|
|
@ -104,7 +104,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
||||||
/**
|
/**
|
||||||
* Main entry point: builds a flow graph, then extracts a call graph and returns it.
|
* Main entry point: builds a flow graph, then extracts a call graph and returns it.
|
||||||
*/
|
*/
|
||||||
public Pair<JSCallGraph,PointerAnalysis> buildCallGraph(Iterable<Entrypoint> eps, IProgressMonitor monitor) throws CancelException {
|
public Pair<JSCallGraph,PointerAnalysis<FuncVertex>> buildCallGraph(Iterable<Entrypoint> eps, IProgressMonitor monitor) throws CancelException {
|
||||||
long fgBegin, fgEnd, cgBegin, cgEnd;
|
long fgBegin, fgEnd, cgBegin, cgEnd;
|
||||||
|
|
||||||
if(LOG_TIMINGS) fgBegin = System.currentTimeMillis();
|
if(LOG_TIMINGS) fgBegin = System.currentTimeMillis();
|
||||||
|
|
|
@ -141,11 +141,11 @@ public class FlowGraph implements Iterable<Vertex> {
|
||||||
return graph.iterator();
|
return graph.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointerAnalysis getPointerAnalysis(final IProgressMonitor monitor) {
|
public PointerAnalysis<FuncVertex> getPointerAnalysis(final IProgressMonitor monitor) {
|
||||||
return new PointerAnalysis() {
|
return new PointerAnalysis<FuncVertex>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrdinalSet<? extends InstanceKey> getPointsToSet(PointerKey key) {
|
public OrdinalSet<FuncVertex> getPointsToSet(PointerKey key) {
|
||||||
if (key instanceof LocalPointerKey) {
|
if (key instanceof LocalPointerKey) {
|
||||||
CGNode node = ((LocalPointerKey)key).getNode();
|
CGNode node = ((LocalPointerKey)key).getNode();
|
||||||
FuncVertex fn = factory.makeFuncVertex(node.getMethod().getDeclaringClass());
|
FuncVertex fn = factory.makeFuncVertex(node.getMethod().getDeclaringClass());
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class WebPageLoaderFactory extends JavaScriptLoaderFactory {
|
||||||
context.currentScope().getConstantValue(name);
|
context.currentScope().getConstantValue(name);
|
||||||
doIsFieldDefined(context, isDefined, windowVal, Ast.makeConstant(name));
|
doIsFieldDefined(context, isDefined, windowVal, Ast.makeConstant(name));
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
insts.ConditionalBranchInstruction(
|
insts.ConditionalBranchInstruction(context.cfg().getCurrentInstruction(),
|
||||||
translateConditionOpcode(CAstOperator.OP_NE),
|
translateConditionOpcode(CAstOperator.OP_NE),
|
||||||
null,
|
null,
|
||||||
isDefined,
|
isDefined,
|
||||||
|
@ -75,16 +75,16 @@ public class WebPageLoaderFactory extends JavaScriptLoaderFactory {
|
||||||
|
|
||||||
// field lookup of value
|
// field lookup of value
|
||||||
context.cfg().newBlock(true);
|
context.cfg().newBlock(true);
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).GetInstruction(result, windowVal, name));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).GetInstruction(context.cfg().getCurrentInstruction(), result, windowVal, name));
|
||||||
context.cfg().newBlock(true);
|
context.cfg().newBlock(true);
|
||||||
context.cfg().addInstruction(insts.GotoInstruction(-1));
|
context.cfg().addInstruction(insts.GotoInstruction(context.cfg().getCurrentInstruction(), -1));
|
||||||
PreBasicBlock trueB = context.cfg().getCurrentBlock();
|
PreBasicBlock trueB = context.cfg().getCurrentBlock();
|
||||||
|
|
||||||
// read global
|
// read global
|
||||||
context.cfg().newBlock(false);
|
context.cfg().newBlock(false);
|
||||||
PreBasicBlock falseB = context.cfg().getCurrentBlock();
|
PreBasicBlock falseB = context.cfg().getCurrentBlock();
|
||||||
int sr = super.doGlobalRead(n, context, name, type);
|
int sr = super.doGlobalRead(n, context, name, type);
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).AssignInstruction(result, sr));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).AssignInstruction(context.cfg().getCurrentInstruction(), result, sr));
|
||||||
|
|
||||||
// end
|
// end
|
||||||
context.cfg().newBlock(true);
|
context.cfg().newBlock(true);
|
||||||
|
@ -104,7 +104,7 @@ public class WebPageLoaderFactory extends JavaScriptLoaderFactory {
|
||||||
if (isNestedWithinScriptBody(context) && ! "$$undefined".equals(nm) && !"window".equals(nm) && !nm.startsWith("$$destructure")) {
|
if (isNestedWithinScriptBody(context) && ! "$$undefined".equals(nm) && !"window".equals(nm) && !nm.startsWith("$$destructure")) {
|
||||||
int windowVal = super.doLocalRead(context, "this", type);
|
int windowVal = super.doLocalRead(context, "this", type);
|
||||||
context.currentScope().getConstantValue(nm);
|
context.currentScope().getConstantValue(nm);
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).PutInstruction(windowVal, rval, nm));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).PutInstruction(context.cfg().getCurrentInstruction(), windowVal, rval, nm));
|
||||||
}
|
}
|
||||||
|
|
||||||
super.doLocalWrite(context, nm, type, rval);
|
super.doLocalWrite(context, nm, type, rval);
|
||||||
|
@ -118,7 +118,7 @@ public class WebPageLoaderFactory extends JavaScriptLoaderFactory {
|
||||||
int fnValue = context.currentScope().lookup(fn.getName()).valueNumber();
|
int fnValue = context.currentScope().lookup(fn.getName()).valueNumber();
|
||||||
assert fnValue > 0;
|
assert fnValue > 0;
|
||||||
int windowVal = super.doLocalRead(context, "this", JavaScriptTypes.Function);
|
int windowVal = super.doLocalRead(context, "this", JavaScriptTypes.Function);
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).PutInstruction(windowVal, fnValue, fn.getName()));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).PutInstruction(context.cfg().getCurrentInstruction(), windowVal, fnValue, fn.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class JSCallGraph extends AstCallGraph {
|
||||||
if (cha.isSubclassOf(cha.lookupClass(T), cha.lookupClass(JavaScriptTypes.Root))) {
|
if (cha.isSubclassOf(cha.lookupClass(T), cha.lookupClass(JavaScriptTypes.Root))) {
|
||||||
int instance = nextLocal++;
|
int instance = nextLocal++;
|
||||||
NewSiteReference ref = NewSiteReference.make(statements.size(), T);
|
NewSiteReference ref = NewSiteReference.make(statements.size(), T);
|
||||||
SSANewInstruction result = getDeclaringClass().getClassLoader().getInstructionFactory().NewInstruction(instance, ref);
|
SSANewInstruction result = getDeclaringClass().getClassLoader().getInstructionFactory().NewInstruction(statements.size(), instance, ref);
|
||||||
statements.add(result);
|
statements.add(result);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
|
@ -72,7 +72,7 @@ public class JSCallGraph extends AstCallGraph {
|
||||||
public SSAAbstractInvokeInstruction addDirectCall(int function, int[] params, CallSiteReference site) {
|
public SSAAbstractInvokeInstruction addDirectCall(int function, int[] params, CallSiteReference site) {
|
||||||
CallSiteReference newSite = new JSCallSiteReference(statements.size());
|
CallSiteReference newSite = new JSCallSiteReference(statements.size());
|
||||||
|
|
||||||
JavaScriptInvoke s = new JavaScriptInvoke(function, nextLocal++, params, nextLocal++, newSite);
|
JavaScriptInvoke s = new JavaScriptInvoke(statements.size(), function, nextLocal++, params, nextLocal++, newSite);
|
||||||
statements.add(s);
|
statements.add(s);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -381,7 +381,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
||||||
protected PropagationSystem makeSystem(AnalysisOptions options) {
|
protected PropagationSystem makeSystem(AnalysisOptions options) {
|
||||||
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory) {
|
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory) {
|
||||||
@Override
|
@Override
|
||||||
public PointerAnalysis makePointerAnalysis(PropagationCallGraphBuilder builder) {
|
public PointerAnalysis<InstanceKey> makePointerAnalysis(PropagationCallGraphBuilder builder) {
|
||||||
return new JSPointerAnalysisImpl(builder, cg, pointsToMap, instanceKeys, pointerKeyFactory, instanceKeyFactory);
|
return new JSPointerAnalysisImpl(builder, cg, pointsToMap, instanceKeys, pointerKeyFactory, instanceKeyFactory);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -110,10 +110,10 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
||||||
// function being invoked is in v2
|
// function being invoked is in v2
|
||||||
int resultVal = curValNum++;
|
int resultVal = curValNum++;
|
||||||
int excVal = curValNum++;
|
int excVal = curValNum++;
|
||||||
S.addStatement(insts.Invoke(2, resultVal, paramsToPassToInvoked, excVal, cs));
|
S.addStatement(insts.Invoke(S.getNumberOfStatements(), 2, resultVal, paramsToPassToInvoked, excVal, cs));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(resultVal, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), resultVal, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
JavaScriptSummarizedFunction t = new JavaScriptSummarizedFunction(ref, S, declaringClass);
|
JavaScriptSummarizedFunction t = new JavaScriptSummarizedFunction(ref, S, declaringClass);
|
||||||
|
@ -125,11 +125,11 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
||||||
// read an arbitrary property name via EachElementGet
|
// read an arbitrary property name via EachElementGet
|
||||||
int curValNum = nargs + 2;
|
int curValNum = nargs + 2;
|
||||||
int eachElementGetResult = curValNum++;
|
int eachElementGetResult = curValNum++;
|
||||||
S.addStatement(insts.EachElementGetInstruction(eachElementGetResult, 4));
|
S.addStatement(insts.EachElementGetInstruction(S.getNumberOfStatements(), eachElementGetResult, 4));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
// read value from the arbitrary property name
|
// read value from the arbitrary property name
|
||||||
int propertyReadResult = curValNum++;
|
int propertyReadResult = curValNum++;
|
||||||
S.addStatement(insts.PropertyRead(propertyReadResult, 4, eachElementGetResult));
|
S.addStatement(insts.PropertyRead(S.getNumberOfStatements(), propertyReadResult, 4, eachElementGetResult));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
for (int i = 1; i < paramsToPassToInvoked.length; i++) {
|
for (int i = 1; i < paramsToPassToInvoked.length; i++) {
|
||||||
paramsToPassToInvoked[i] = propertyReadResult;
|
paramsToPassToInvoked[i] = propertyReadResult;
|
||||||
|
@ -150,7 +150,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
||||||
S.addConstant(constVN, new ConstantValue(i-1));
|
S.addConstant(constVN, new ConstantValue(i-1));
|
||||||
int propertyReadResult = curValNum++;
|
int propertyReadResult = curValNum++;
|
||||||
// 4 is position of arguments array
|
// 4 is position of arguments array
|
||||||
S.addStatement(insts.PropertyRead(propertyReadResult, 4, constVN));
|
S.addStatement(insts.PropertyRead(S.getNumberOfStatements(), propertyReadResult, 4, constVN));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
paramsToPassToInvoked[i] = propertyReadResult;
|
paramsToPassToInvoked[i] = propertyReadResult;
|
||||||
}
|
}
|
||||||
|
@ -173,10 +173,10 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
||||||
int[] params = new int[1];
|
int[] params = new int[1];
|
||||||
params[0] = 3;
|
params[0] = 3;
|
||||||
// function being invoked is in v2
|
// function being invoked is in v2
|
||||||
S.addStatement(insts.Invoke(2, resultVal, params, resultVal + 1, cs));
|
S.addStatement(insts.Invoke(S.getNumberOfStatements(), 2, resultVal, params, resultVal + 1, cs));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(resultVal, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), resultVal, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
JavaScriptSummarizedFunction t = new JavaScriptSummarizedFunction(ref, S, declaringClass);
|
JavaScriptSummarizedFunction t = new JavaScriptSummarizedFunction(ref, S, declaringClass);
|
||||||
|
|
|
@ -162,10 +162,10 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
|
||||||
params[i] = i + 3;
|
params[i] = i + 3;
|
||||||
}
|
}
|
||||||
// function being invoked is in v2
|
// function being invoked is in v2
|
||||||
S.addStatement(insts.Invoke(2, resultVal, params, resultVal + 1, cs));
|
S.addStatement(insts.Invoke(S.getNumberOfStatements(), 2, resultVal, params, resultVal + 1, cs));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(resultVal, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), resultVal, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
JavaScriptSummarizedFunction t = new JavaScriptSummarizedFunction(ref, S, receiver);
|
JavaScriptSummarizedFunction t = new JavaScriptSummarizedFunction(ref, S, receiver);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class LoadFileTargetSelector implements MethodTargetSelector {
|
||||||
Set<String> names = new HashSet<String>();
|
Set<String> names = new HashSet<String>();
|
||||||
SSAInstruction call = caller.getIR().getInstructions()[caller.getIR().getCallInstructionIndices(site).intIterator().next()];
|
SSAInstruction call = caller.getIR().getInstructions()[caller.getIR().getCallInstructionIndices(site).intIterator().next()];
|
||||||
LocalPointerKey fileNameV = new LocalPointerKey(caller, call.getUse(1));
|
LocalPointerKey fileNameV = new LocalPointerKey(caller, call.getUse(1));
|
||||||
OrdinalSet<? extends InstanceKey> ptrs = builder.getPointerAnalysis().getPointsToSet(fileNameV);
|
OrdinalSet<InstanceKey> ptrs = builder.getPointerAnalysis().getPointsToSet(fileNameV);
|
||||||
for(InstanceKey k : ptrs) {
|
for(InstanceKey k : ptrs) {
|
||||||
if (k instanceof ConstantKey) {
|
if (k instanceof ConstantKey) {
|
||||||
Object v = ((ConstantKey)k).getValue();
|
Object v = ((ConstantKey)k).getValue();
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2002 - 2014 IBM Corporation.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
package com.ibm.wala.cast.js.ipa.modref;
|
package com.ibm.wala.cast.js.ipa.modref;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -25,7 +36,7 @@ public class JavaScriptModRef extends AstModRef {
|
||||||
|
|
||||||
protected static class JavaScriptRefVisitor extends AstRefVisitor implements JSInstructionVisitor {
|
protected static class JavaScriptRefVisitor extends AstRefVisitor implements JSInstructionVisitor {
|
||||||
|
|
||||||
protected JavaScriptRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, ExtendedHeapModel h) {
|
protected JavaScriptRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, ExtendedHeapModel h) {
|
||||||
super(n, result, pa, (AstHeapModel)h);
|
super(n, result, pa, (AstHeapModel)h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,13 +99,13 @@ public class JavaScriptModRef extends AstModRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RefVisitor makeRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, ExtendedHeapModel h) {
|
protected RefVisitor makeRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, ExtendedHeapModel h) {
|
||||||
return new JavaScriptRefVisitor(n, result, pa, h);
|
return new JavaScriptRefVisitor(n, result, pa, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class JavaScriptModVisitor extends AstModVisitor implements JSInstructionVisitor {
|
protected static class JavaScriptModVisitor extends AstModVisitor implements JSInstructionVisitor {
|
||||||
|
|
||||||
protected JavaScriptModVisitor(CGNode n, Collection<PointerKey> result, ExtendedHeapModel h, PointerAnalysis pa) {
|
protected JavaScriptModVisitor(CGNode n, Collection<PointerKey> result, ExtendedHeapModel h, PointerAnalysis<InstanceKey> pa) {
|
||||||
super(n, result, (AstHeapModel)h, pa);
|
super(n, result, (AstHeapModel)h, pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +168,7 @@ public class JavaScriptModRef extends AstModRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ModVisitor makeModVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, ExtendedHeapModel h, boolean ignoreAllocHeapDefs) {
|
protected ModVisitor makeModVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, ExtendedHeapModel h, boolean ignoreAllocHeapDefs) {
|
||||||
return new JavaScriptModVisitor(n, result, h, pa);
|
return new JavaScriptModVisitor(n, result, h, pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2002 - 2014 IBM Corporation.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
package com.ibm.wala.cast.js.ipa.summaries;
|
package com.ibm.wala.cast.js.ipa.summaries;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -75,20 +86,20 @@ public class JavaScriptConstructorFunctions {
|
||||||
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
|
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
||||||
|
|
||||||
S.addStatement(insts.GetInstruction(4, 1, "prototype"));
|
S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), 4, 1, "prototype"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.NewInstruction(5, NewSiteReference.make(S.getNextProgramCounter(), cls.getReference())));
|
S.addStatement(insts.NewInstruction(S.getNumberOfStatements(), 5, NewSiteReference.make(S.getNextProgramCounter(), cls.getReference())));
|
||||||
|
|
||||||
S.addStatement(insts.SetPrototype(5, 4));
|
S.addStatement(insts.SetPrototype(S.getNumberOfStatements(), 5, 4));
|
||||||
//S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
|
//S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addConstant(new Integer(8), new ConstantValue(value));
|
S.addConstant(new Integer(8), new ConstantValue(value));
|
||||||
S.addStatement(insts.PutInstruction(5, 8, "$value"));
|
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 5, 8, "$value"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(5, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 5, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
//S.addConstant(9, new ConstantValue("__proto__"));
|
//S.addConstant(9, new ConstantValue("__proto__"));
|
||||||
|
@ -101,19 +112,19 @@ public class JavaScriptConstructorFunctions {
|
||||||
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
|
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
||||||
|
|
||||||
S.addStatement(insts.GetInstruction(5, 1, "prototype"));
|
S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), 5, 1, "prototype"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.NewInstruction(6, NewSiteReference.make(S.getNextProgramCounter(), cls.getReference())));
|
S.addStatement(insts.NewInstruction(S.getNumberOfStatements(), 6, NewSiteReference.make(S.getNextProgramCounter(), cls.getReference())));
|
||||||
|
|
||||||
S.addStatement(insts.SetPrototype(6, 5));
|
S.addStatement(insts.SetPrototype(S.getNumberOfStatements(), 6, 5));
|
||||||
//S.addStatement(insts.PutInstruction(6, 5, "__proto__"));
|
//S.addStatement(insts.PutInstruction(6, 5, "__proto__"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.PutInstruction(6, 2, "$value"));
|
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 6, 2, "$value"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(6, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 6, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
//S.addConstant(7, new ConstantValue("__proto__"));
|
//S.addConstant(7, new ConstantValue("__proto__"));
|
||||||
|
@ -144,16 +155,16 @@ public class JavaScriptConstructorFunctions {
|
||||||
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Object);
|
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Object);
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
||||||
|
|
||||||
S.addStatement(insts.GetInstruction(4, 1, "prototype"));
|
S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), 4, 1, "prototype"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.NewInstruction(5, NewSiteReference.make(S.getNextProgramCounter(), JavaScriptTypes.Object)));
|
S.addStatement(insts.NewInstruction(S.getNumberOfStatements(), 5, NewSiteReference.make(S.getNextProgramCounter(), JavaScriptTypes.Object)));
|
||||||
|
|
||||||
S.addStatement(insts.SetPrototype(5, 4));
|
S.addStatement(insts.SetPrototype(S.getNumberOfStatements(), 5, 4));
|
||||||
//S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
|
//S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(5, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 5, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
//S.addConstant(6, new ConstantValue("__proto__"));
|
//S.addConstant(6, new ConstantValue("__proto__"));
|
||||||
|
@ -166,7 +177,7 @@ public class JavaScriptConstructorFunctions {
|
||||||
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Object);
|
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Object);
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(2, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 2, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.Object));
|
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.Object));
|
||||||
|
@ -204,19 +215,19 @@ public class JavaScriptConstructorFunctions {
|
||||||
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
|
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
||||||
|
|
||||||
S.addStatement(insts.GetInstruction(5, 1, "prototype"));
|
S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), 5, 1, "prototype"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.NewInstruction(6, NewSiteReference.make(S.getNextProgramCounter(), JavaScriptTypes.Array)));
|
S.addStatement(insts.NewInstruction(S.getNumberOfStatements(), 6, NewSiteReference.make(S.getNextProgramCounter(), JavaScriptTypes.Array)));
|
||||||
|
|
||||||
S.addStatement(insts.SetPrototype(6, 5));
|
S.addStatement(insts.SetPrototype(S.getNumberOfStatements(), 6, 5));
|
||||||
//S.addStatement(insts.PutInstruction(6, 5, "__proto__"));
|
//S.addStatement(insts.PutInstruction(6, 5, "__proto__"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.PutInstruction(6, 2, "length"));
|
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 6, 2, "length"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(6, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 6, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
//S.addConstant(7, new ConstantValue("__proto__"));
|
//S.addConstant(7, new ConstantValue("__proto__"));
|
||||||
|
@ -230,29 +241,29 @@ public class JavaScriptConstructorFunctions {
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, nargs + 1);
|
JavaScriptSummary S = new JavaScriptSummary(ref, nargs + 1);
|
||||||
|
|
||||||
S.addConstant(new Integer(nargs + 3), new ConstantValue("prototype"));
|
S.addConstant(new Integer(nargs + 3), new ConstantValue("prototype"));
|
||||||
S.addStatement(insts.PropertyRead(nargs + 4, 1, nargs + 3));
|
S.addStatement(insts.PropertyRead(S.getNumberOfStatements(), nargs + 4, 1, nargs + 3));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(
|
S.addStatement(
|
||||||
insts.NewInstruction(nargs + 5, NewSiteReference.make(S.getNextProgramCounter(),
|
insts.NewInstruction(S.getNumberOfStatements(), nargs + 5, NewSiteReference.make(S.getNextProgramCounter(),
|
||||||
JavaScriptTypes.Array)));
|
JavaScriptTypes.Array)));
|
||||||
|
|
||||||
S.addStatement(insts.SetPrototype(nargs + 5, nargs + 4));
|
S.addStatement(insts.SetPrototype(S.getNumberOfStatements(), nargs + 5, nargs + 4));
|
||||||
//S.addStatement(insts.PutInstruction(nargs + 5, nargs + 4, "__proto__"));
|
//S.addStatement(insts.PutInstruction(nargs + 5, nargs + 4, "__proto__"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addConstant(new Integer(nargs + 7), new ConstantValue(nargs));
|
S.addConstant(new Integer(nargs + 7), new ConstantValue(nargs));
|
||||||
S.addStatement(insts.PutInstruction(nargs + 5, nargs + 7, "length"));
|
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), nargs + 5, nargs + 7, "length"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
int vn = nargs + 9;
|
int vn = nargs + 9;
|
||||||
for (int i = 0; i < nargs; i++, vn += 2) {
|
for (int i = 0; i < nargs; i++, vn += 2) {
|
||||||
S.addConstant(new Integer(vn), new ConstantValue(i));
|
S.addConstant(new Integer(vn), new ConstantValue(i));
|
||||||
S.addStatement(insts.PropertyWrite(nargs + 5, vn, i + 1));
|
S.addStatement(insts.PropertyWrite(S.getNumberOfStatements(), nargs + 5, vn, i + 1));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(5, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 5, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
//S.addConstant(vn, new ConstantValue("__proto__"));
|
//S.addConstant(vn, new ConstantValue("__proto__"));
|
||||||
|
@ -275,7 +286,7 @@ public class JavaScriptConstructorFunctions {
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
||||||
|
|
||||||
S.addConstant(new Integer(2), new ConstantValue(""));
|
S.addConstant(new Integer(2), new ConstantValue(""));
|
||||||
S.addStatement(insts.ReturnInstruction(2, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 2, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.String));
|
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.String));
|
||||||
|
@ -286,13 +297,13 @@ public class JavaScriptConstructorFunctions {
|
||||||
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.String);
|
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.String);
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
||||||
|
|
||||||
S.addStatement(insts.GetInstruction(4, 2, "toString"));
|
S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), 4, 2, "toString"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
CallSiteReference cs = new JSCallSiteReference(S.getNextProgramCounter());
|
CallSiteReference cs = new JSCallSiteReference(S.getNextProgramCounter());
|
||||||
S.addStatement(insts.Invoke(4, 5, new int[] { 2 }, 6, cs));
|
S.addStatement(insts.Invoke(S.getNumberOfStatements(), 4, 5, new int[] { 2 }, 6, cs));
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(5, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 5, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.String));
|
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.String));
|
||||||
|
@ -315,7 +326,7 @@ public class JavaScriptConstructorFunctions {
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
||||||
|
|
||||||
S.addConstant(new Integer(2), new ConstantValue(0.0));
|
S.addConstant(new Integer(2), new ConstantValue(0.0));
|
||||||
S.addStatement(insts.ReturnInstruction(2, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 2, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.Number));
|
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.Number));
|
||||||
|
@ -326,13 +337,13 @@ public class JavaScriptConstructorFunctions {
|
||||||
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.Number);
|
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.Number);
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 2);
|
||||||
|
|
||||||
S.addStatement(insts.GetInstruction(4, 2, "toNumber"));
|
S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), 4, 2, "toNumber"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
CallSiteReference cs = new JSCallSiteReference(S.getNextProgramCounter());
|
CallSiteReference cs = new JSCallSiteReference(S.getNextProgramCounter());
|
||||||
S.addStatement(insts.Invoke(4, 5, new int[] { 2 }, 6, cs));
|
S.addStatement(insts.Invoke(S.getNumberOfStatements(), 4, 5, new int[] { 2 }, 6, cs));
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(5, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 5, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.Number));
|
return new JavaScriptConstructor(ref, S, cls, cha.lookupClass(JavaScriptTypes.Number));
|
||||||
|
@ -358,25 +369,25 @@ public class JavaScriptConstructorFunctions {
|
||||||
MethodReference ref = JavaScriptMethods.makeCtorReference(receiver.getReference());
|
MethodReference ref = JavaScriptMethods.makeCtorReference(receiver.getReference());
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
|
||||||
|
|
||||||
S.addStatement(insts.GetInstruction(4, 1, "prototype"));
|
S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), 4, 1, "prototype"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.NewInstruction(5, NewSiteReference.make(S.getNextProgramCounter(), cls.getReference())));
|
S.addStatement(insts.NewInstruction(S.getNumberOfStatements(), 5, NewSiteReference.make(S.getNextProgramCounter(), cls.getReference())));
|
||||||
|
|
||||||
S.addStatement(insts.NewInstruction(7, NewSiteReference.make(S.getNextProgramCounter(), JavaScriptTypes.Object)));
|
S.addStatement(insts.NewInstruction(S.getNumberOfStatements(), 7, NewSiteReference.make(S.getNextProgramCounter(), JavaScriptTypes.Object)));
|
||||||
|
|
||||||
S.addStatement(insts.SetPrototype(5, 4));
|
S.addStatement(insts.SetPrototype(S.getNumberOfStatements(), 5, 4));
|
||||||
//S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
|
//S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.PutInstruction(5, 7, "prototype"));
|
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 5, 7, "prototype"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.PutInstruction(7, 5, "constructor"));
|
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 7, 5, "constructor"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
// TODO we need to set v7.__proto__ to Object.prototype
|
// TODO we need to set v7.__proto__ to Object.prototype
|
||||||
S.addStatement(insts.ReturnInstruction(5, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 5, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
//S.addConstant(8, new ConstantValue("__proto__"));
|
//S.addConstant(8, new ConstantValue("__proto__"));
|
||||||
|
@ -464,15 +475,15 @@ public class JavaScriptConstructorFunctions {
|
||||||
|
|
||||||
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
|
MethodReference ref = JavaScriptMethods.makeCtorReference(cls.getReference());
|
||||||
JavaScriptSummary S = new JavaScriptSummary(ref, nargs + 1);
|
JavaScriptSummary S = new JavaScriptSummary(ref, nargs + 1);
|
||||||
S.addStatement(insts.GetInstruction(nargs + 4, 1, "prototype"));
|
S.addStatement(insts.GetInstruction(S.getNumberOfStatements(), nargs + 4, 1, "prototype"));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(
|
S.addStatement(
|
||||||
insts.NewInstruction(nargs + 5,
|
insts.NewInstruction(S.getNumberOfStatements(), nargs + 5,
|
||||||
NewSiteReference.make(S.getNextProgramCounter(),
|
NewSiteReference.make(S.getNextProgramCounter(),
|
||||||
JavaScriptTypes.Object)));
|
JavaScriptTypes.Object)));
|
||||||
|
|
||||||
S.addStatement(insts.SetPrototype(nargs + 5, nargs + 4));
|
S.addStatement(insts.SetPrototype(S.getNumberOfStatements(), nargs + 5, nargs + 4));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
CallSiteReference cs = new JSCallSiteReference(S.getNextProgramCounter());
|
CallSiteReference cs = new JSCallSiteReference(S.getNextProgramCounter());
|
||||||
|
@ -480,17 +491,17 @@ public class JavaScriptConstructorFunctions {
|
||||||
args[0] = nargs + 5;
|
args[0] = nargs + 5;
|
||||||
for (int i = 0; i < nargs; i++)
|
for (int i = 0; i < nargs; i++)
|
||||||
args[i + 1] = i + 2;
|
args[i + 1] = i + 2;
|
||||||
S.addStatement(insts.Invoke(1, nargs + 7, args, nargs + 8, cs));
|
S.addStatement(insts.Invoke(S.getNumberOfStatements(), 1, nargs + 7, args, nargs + 8, cs));
|
||||||
int pc = S.getNextProgramCounter();
|
int pc = S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addConstant(nargs + 9, null);
|
S.addConstant(nargs + 9, null);
|
||||||
S.addStatement(insts.ConditionalBranchInstruction(Operator.EQ, JavaScriptTypes.Root, nargs + 7, nargs + 9, pc+2));
|
S.addStatement(insts.ConditionalBranchInstruction(S.getNumberOfStatements(), Operator.EQ, JavaScriptTypes.Root, nargs + 7, nargs + 9, pc+2));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(nargs + 7, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), nargs + 7, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
S.addStatement(insts.ReturnInstruction(nargs + 5, false));
|
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), nargs + 5, false));
|
||||||
S.getNextProgramCounter();
|
S.getNextProgramCounter();
|
||||||
|
|
||||||
return record(key, new JavaScriptConstructor(ref, S, cls, cls));
|
return record(key, new JavaScriptConstructor(ref, S, cls, cls));
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class JavaScriptSummary extends MethodSummary {
|
||||||
super(ref);
|
super(ref);
|
||||||
this.declaredParameters = declaredParameters;
|
this.declaredParameters = declaredParameters;
|
||||||
addStatement(
|
addStatement(
|
||||||
JavaScriptLoader.JS.instructionFactory().NewInstruction(
|
JavaScriptLoader.JS.instructionFactory().NewInstruction(getNumberOfStatements(),
|
||||||
declaredParameters+1,
|
declaredParameters+1,
|
||||||
NewSiteReference.make(
|
NewSiteReference.make(
|
||||||
getNextProgramCounter(),
|
getNextProgramCounter(),
|
||||||
|
|
|
@ -210,51 +210,51 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
||||||
return new JSInstructionFactory() {
|
return new JSInstructionFactory() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptCheckReference CheckReference(int ref) {
|
public JavaScriptCheckReference CheckReference(int iindex, int ref) {
|
||||||
return new JavaScriptCheckReference(ref);
|
return new JavaScriptCheckReference(iindex, ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAGetInstruction GetInstruction(int result, int ref, String field) {
|
public SSAGetInstruction GetInstruction(int iindex, int result, int ref, String field) {
|
||||||
return GetInstruction(result, ref,
|
return GetInstruction(iindex, result, ref,
|
||||||
FieldReference.findOrCreate(JavaScriptTypes.Root, Atom.findOrCreateUnicodeAtom(field), JavaScriptTypes.Root));
|
FieldReference.findOrCreate(JavaScriptTypes.Root, Atom.findOrCreateUnicodeAtom(field), JavaScriptTypes.Root));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptInstanceOf InstanceOf(int result, int objVal, int typeVal) {
|
public JavaScriptInstanceOf InstanceOf(int iindex, int result, int objVal, int typeVal) {
|
||||||
return new JavaScriptInstanceOf(result, objVal, typeVal);
|
return new JavaScriptInstanceOf(iindex, result, objVal, typeVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptInvoke Invoke(int function, int[] results, int[] params, int exception, CallSiteReference site) {
|
public JavaScriptInvoke Invoke(int iindex, int function, int[] results, int[] params, int exception, CallSiteReference site) {
|
||||||
return new JavaScriptInvoke(function, results, params, exception, site);
|
return new JavaScriptInvoke(iindex, function, results, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptInvoke Invoke(int function, int result, int[] params, int exception, CallSiteReference site) {
|
public JavaScriptInvoke Invoke(int iindex, int function, int result, int[] params, int exception, CallSiteReference site) {
|
||||||
return new JavaScriptInvoke(function, result, params, exception, site);
|
return new JavaScriptInvoke(iindex, function, result, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptInvoke Invoke(int function, int[] params, int exception, CallSiteReference site) {
|
public JavaScriptInvoke Invoke(int iindex, int function, int[] params, int exception, CallSiteReference site) {
|
||||||
return new JavaScriptInvoke(function, params, exception, site);
|
return new JavaScriptInvoke(iindex, function, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptPropertyRead PropertyRead(int result, int objectRef, int memberRef) {
|
public JavaScriptPropertyRead PropertyRead(int iindex, int result, int objectRef, int memberRef) {
|
||||||
return new JavaScriptPropertyRead(result, objectRef, memberRef);
|
return new JavaScriptPropertyRead(iindex, result, objectRef, memberRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptPropertyWrite PropertyWrite(int objectRef, int memberRef, int value) {
|
public JavaScriptPropertyWrite PropertyWrite(int iindex, int objectRef, int memberRef, int value) {
|
||||||
return new JavaScriptPropertyWrite(objectRef, memberRef, value);
|
return new JavaScriptPropertyWrite(iindex, objectRef, memberRef, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAPutInstruction PutInstruction(int ref, int value, String field) {
|
public SSAPutInstruction PutInstruction(int iindex, int ref, int value, String field) {
|
||||||
try {
|
try {
|
||||||
byte[] utf8 = field.getBytes("UTF-8");
|
byte[] utf8 = field.getBytes("UTF-8");
|
||||||
return PutInstruction(ref, value,
|
return PutInstruction(iindex, ref, value,
|
||||||
FieldReference.findOrCreate(JavaScriptTypes.Root, Atom.findOrCreate(utf8, 0, utf8.length), JavaScriptTypes.Root));
|
FieldReference.findOrCreate(JavaScriptTypes.Root, Atom.findOrCreate(utf8, 0, utf8.length), JavaScriptTypes.Root));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
Assertions.UNREACHABLE();
|
Assertions.UNREACHABLE();
|
||||||
|
@ -263,119 +263,119 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptTypeOfInstruction TypeOfInstruction(int lval, int object) {
|
public JavaScriptTypeOfInstruction TypeOfInstruction(int iindex, int lval, int object) {
|
||||||
return new JavaScriptTypeOfInstruction(lval, object);
|
return new JavaScriptTypeOfInstruction(iindex, lval, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaScriptWithRegion WithRegion(int expr, boolean isEnter) {
|
public JavaScriptWithRegion WithRegion(int iindex, int expr, boolean isEnter) {
|
||||||
return new JavaScriptWithRegion(expr, isEnter);
|
return new JavaScriptWithRegion(iindex, expr, isEnter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstAssertInstruction AssertInstruction(int value, boolean fromSpecification) {
|
public AstAssertInstruction AssertInstruction(int iindex, int value, boolean fromSpecification) {
|
||||||
return new AstAssertInstruction(value, fromSpecification);
|
return new AstAssertInstruction(iindex, value, fromSpecification);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.ibm.wala.cast.ir.ssa.AssignInstruction AssignInstruction(int result, int val) {
|
public com.ibm.wala.cast.ir.ssa.AssignInstruction AssignInstruction(int iindex, int result, int val) {
|
||||||
return new AssignInstruction(result, val);
|
return new AssignInstruction(iindex, result, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.ibm.wala.cast.ir.ssa.EachElementGetInstruction EachElementGetInstruction(int value, int objectRef) {
|
public com.ibm.wala.cast.ir.ssa.EachElementGetInstruction EachElementGetInstruction(int iindex, int value, int objectRef) {
|
||||||
return new EachElementGetInstruction(value, objectRef);
|
return new EachElementGetInstruction(iindex, value, objectRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction EachElementHasNextInstruction(int value, int objectRef) {
|
public com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction EachElementHasNextInstruction(int iindex, int value, int objectRef) {
|
||||||
return new EachElementHasNextInstruction(value, objectRef);
|
return new EachElementHasNextInstruction(iindex, value, objectRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstEchoInstruction EchoInstruction(int[] rvals) {
|
public AstEchoInstruction EchoInstruction(int iindex, int[] rvals) {
|
||||||
return new AstEchoInstruction(rvals);
|
return new AstEchoInstruction(iindex, rvals);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstGlobalRead GlobalRead(int lhs, FieldReference global) {
|
public AstGlobalRead GlobalRead(int iindex, int lhs, FieldReference global) {
|
||||||
return new AstGlobalRead(lhs, global);
|
return new AstGlobalRead(iindex, lhs, global);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstGlobalWrite GlobalWrite(FieldReference global, int rhs) {
|
public AstGlobalWrite GlobalWrite(int iindex, FieldReference global, int rhs) {
|
||||||
return new AstGlobalWrite(global, rhs);
|
return new AstGlobalWrite(iindex, global, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, int fieldVal, FieldReference fieldRef) {
|
public AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, int fieldVal, FieldReference fieldRef) {
|
||||||
return new AstIsDefinedInstruction(lval, rval, fieldVal, fieldRef);
|
return new AstIsDefinedInstruction(iindex, lval, rval, fieldVal, fieldRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, FieldReference fieldRef) {
|
public AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, FieldReference fieldRef) {
|
||||||
return new AstIsDefinedInstruction(lval, rval, fieldRef);
|
return new AstIsDefinedInstruction(iindex, lval, rval, fieldRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, int fieldVal) {
|
public AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, int fieldVal) {
|
||||||
return new AstIsDefinedInstruction(lval, rval, fieldVal);
|
return new AstIsDefinedInstruction(iindex, lval, rval, fieldVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval) {
|
public AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval) {
|
||||||
return new AstIsDefinedInstruction(lval, rval);
|
return new AstIsDefinedInstruction(iindex, lval, rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalRead LexicalRead(Access[] accesses) {
|
public AstLexicalRead LexicalRead(int iindex, Access[] accesses) {
|
||||||
return new AstLexicalRead(accesses);
|
return new AstLexicalRead(iindex, accesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalRead LexicalRead(Access access) {
|
public AstLexicalRead LexicalRead(int iindex, Access access) {
|
||||||
return new AstLexicalRead(access);
|
return new AstLexicalRead(iindex, access);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalRead LexicalRead(int lhs, String definer, String globalName, TypeReference type) {
|
public AstLexicalRead LexicalRead(int iindex, int lhs, String definer, String globalName, TypeReference type) {
|
||||||
return new AstLexicalRead(lhs, definer, globalName, type);
|
return new AstLexicalRead(iindex, lhs, definer, globalName, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalWrite LexicalWrite(Access[] accesses) {
|
public AstLexicalWrite LexicalWrite(int iindex, Access[] accesses) {
|
||||||
return new AstLexicalWrite(accesses);
|
return new AstLexicalWrite(iindex, accesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalWrite LexicalWrite(Access access) {
|
public AstLexicalWrite LexicalWrite(int iindex, Access access) {
|
||||||
return new AstLexicalWrite(access);
|
return new AstLexicalWrite(iindex, access);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AstLexicalWrite LexicalWrite(String definer, String globalName, TypeReference type, int rhs) {
|
public AstLexicalWrite LexicalWrite(int iindex, String definer, String globalName, TypeReference type, int rhs) {
|
||||||
return new AstLexicalWrite(definer, globalName, type, rhs);
|
return new AstLexicalWrite(iindex, definer, globalName, type, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAArrayLengthInstruction ArrayLengthInstruction(int result, int arrayref) {
|
public SSAArrayLengthInstruction ArrayLengthInstruction(int iindex, int result, int arrayref) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAArrayLoadInstruction ArrayLoadInstruction(int result, int arrayref, int index, TypeReference declaredType) {
|
public SSAArrayLoadInstruction ArrayLoadInstruction(int iindex, int result, int arrayref, int index, TypeReference declaredType) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAArrayStoreInstruction ArrayStoreInstruction(int arrayref, int index, int value, TypeReference declaredType) {
|
public SSAArrayStoreInstruction ArrayStoreInstruction(int iindex, int arrayref, int index, int value, TypeReference declaredType) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSABinaryOpInstruction BinaryOpInstruction(IOperator operator, boolean overflow, boolean unsigned, int result,
|
public SSABinaryOpInstruction BinaryOpInstruction(int iindex, IOperator operator, boolean overflow, boolean unsigned, int result,
|
||||||
int val1, int val2, boolean mayBeInteger) {
|
int val1, int val2, boolean mayBeInteger) {
|
||||||
return new SSABinaryOpInstruction(operator, result, val1, val2, mayBeInteger) {
|
return new SSABinaryOpInstruction(iindex, operator, result, val1, val2, mayBeInteger) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isPEI() {
|
public boolean isPEI() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -383,74 +383,74 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return insts.BinaryOpInstruction(getOperator(), false, false, defs == null || defs.length == 0 ? getDef(0) : defs[0],
|
return insts.BinaryOpInstruction(iindex, getOperator(), false, false, defs == null || defs.length == 0 ? getDef(0) : defs[0],
|
||||||
uses == null ? getUse(0) : uses[0], uses == null ? getUse(1) : uses[1], mayBeIntegerOp());
|
uses == null ? getUse(0) : uses[0], uses == null ? getUse(1) : uses[1], mayBeIntegerOp());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSACheckCastInstruction CheckCastInstruction(int result, int val, TypeReference[] types, boolean isPEI) {
|
public SSACheckCastInstruction CheckCastInstruction(int iindex, int result, int val, TypeReference[] types, boolean isPEI) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSACheckCastInstruction CheckCastInstruction(int result, int val, int[] typeValues, boolean isPEI) {
|
public SSACheckCastInstruction CheckCastInstruction(int iindex, int result, int val, int[] typeValues, boolean isPEI) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSACheckCastInstruction CheckCastInstruction(int result, int val, int typeValue, boolean isPEI) {
|
public SSACheckCastInstruction CheckCastInstruction(int iindex, int result, int val, int typeValue, boolean isPEI) {
|
||||||
assert isPEI;
|
assert isPEI;
|
||||||
return CheckCastInstruction(result, val, new int[]{ typeValue }, true);
|
return CheckCastInstruction(iindex, result, val, new int[]{ typeValue }, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSACheckCastInstruction CheckCastInstruction(int result, int val, TypeReference type, boolean isPEI) {
|
public SSACheckCastInstruction CheckCastInstruction(int iindex, int result, int val, TypeReference type, boolean isPEI) {
|
||||||
assert isPEI;
|
assert isPEI;
|
||||||
return CheckCastInstruction(result, val, new TypeReference[]{ type }, true);
|
return CheckCastInstruction(iindex, result, val, new TypeReference[]{ type }, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAComparisonInstruction ComparisonInstruction(Operator operator, int result, int val1, int val2) {
|
public SSAComparisonInstruction ComparisonInstruction(int iindex, Operator operator, int result, int val1, int val2) {
|
||||||
return new SSAComparisonInstruction(operator, result, val1, val2);
|
return new SSAComparisonInstruction(iindex, operator, result, val1, val2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAConditionalBranchInstruction ConditionalBranchInstruction(
|
public SSAConditionalBranchInstruction ConditionalBranchInstruction(int iindex,
|
||||||
com.ibm.wala.shrikeBT.IConditionalBranchInstruction.IOperator operator, TypeReference type, int val1, int val2, int target) {
|
com.ibm.wala.shrikeBT.IConditionalBranchInstruction.IOperator operator, TypeReference type, int val1, int val2, int target) {
|
||||||
return new SSAConditionalBranchInstruction(operator, type, val1, val2, target);
|
return new SSAConditionalBranchInstruction(iindex, operator, type, val1, val2, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAConversionInstruction ConversionInstruction(int result, int val, TypeReference fromType, TypeReference toType,
|
public SSAConversionInstruction ConversionInstruction(int iindex, int result, int val, TypeReference fromType, TypeReference toType,
|
||||||
boolean overflow) {
|
boolean overflow) {
|
||||||
assert !overflow;
|
assert !overflow;
|
||||||
return new SSAConversionInstruction(result, val, fromType, toType) {
|
return new SSAConversionInstruction(iindex, result, val, fromType, toType) {
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) throws IllegalArgumentException {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) throws IllegalArgumentException {
|
||||||
if (uses != null && uses.length == 0) {
|
if (uses != null && uses.length == 0) {
|
||||||
throw new IllegalArgumentException("(uses != null) and (uses.length == 0)");
|
throw new IllegalArgumentException("(uses != null) and (uses.length == 0)");
|
||||||
}
|
}
|
||||||
return insts.ConversionInstruction(defs == null || defs.length == 0 ? getDef(0) : defs[0], uses == null ? getUse(0)
|
return insts.ConversionInstruction(iindex, defs == null || defs.length == 0 ? getDef(0) : defs[0], uses == null ? getUse(0)
|
||||||
: uses[0], getFromType(), getToType(), false);
|
: uses[0], getFromType(), getToType(), false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAGetCaughtExceptionInstruction GetCaughtExceptionInstruction(int bbNumber, int exceptionValueNumber) {
|
public SSAGetCaughtExceptionInstruction GetCaughtExceptionInstruction(int iindex, int bbNumber, int exceptionValueNumber) {
|
||||||
return new SSAGetCaughtExceptionInstruction(bbNumber, exceptionValueNumber);
|
return new SSAGetCaughtExceptionInstruction(iindex, bbNumber, exceptionValueNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAGetInstruction GetInstruction(int result, FieldReference field) {
|
public SSAGetInstruction GetInstruction(int iindex, int result, FieldReference field) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAGetInstruction GetInstruction(int result, int ref, FieldReference field) {
|
public SSAGetInstruction GetInstruction(int iindex, int result, int ref, FieldReference field) {
|
||||||
return new SSAGetInstruction(result, ref, field) {
|
return new SSAGetInstruction(iindex, result, ref, field) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isPEI() {
|
public boolean isPEI() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -459,38 +459,38 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAGotoInstruction GotoInstruction(int target) {
|
public SSAGotoInstruction GotoInstruction(int iindex, int target) {
|
||||||
return new SSAGotoInstruction(target);
|
return new SSAGotoInstruction(iindex, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstanceofInstruction InstanceofInstruction(int result, int ref, TypeReference checkedType) {
|
public SSAInstanceofInstruction InstanceofInstruction(int iindex, int result, int ref, TypeReference checkedType) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInvokeInstruction InvokeInstruction(int result, int[] params, int exception, CallSiteReference site) {
|
public SSAInvokeInstruction InvokeInstruction(int iindex, int result, int[] params, int exception, CallSiteReference site) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInvokeInstruction InvokeInstruction(int[] params, int exception, CallSiteReference site) {
|
public SSAInvokeInstruction InvokeInstruction(int iindex, int[] params, int exception, CallSiteReference site) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSALoadMetadataInstruction LoadMetadataInstruction(int lval, TypeReference entityType, Object token) {
|
public SSALoadMetadataInstruction LoadMetadataInstruction(int iindex, int lval, TypeReference entityType, Object token) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAMonitorInstruction MonitorInstruction(int ref, boolean isEnter) {
|
public SSAMonitorInstruction MonitorInstruction(int iindex, int ref, boolean isEnter) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSANewInstruction NewInstruction(int result, NewSiteReference site) {
|
public SSANewInstruction NewInstruction(int iindex, int result, NewSiteReference site) {
|
||||||
return new SSANewInstruction(result, site) {
|
return new SSANewInstruction(iindex, result, site) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isPEI() {
|
public boolean isPEI() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -504,23 +504,23 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSANewInstruction NewInstruction(int result, NewSiteReference site, int[] params) {
|
public SSANewInstruction NewInstruction(int iindex, int result, NewSiteReference site, int[] params) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAPhiInstruction PhiInstruction(int result, int[] params) {
|
public SSAPhiInstruction PhiInstruction(int iindex, int result, int[] params) {
|
||||||
return new SSAPhiInstruction(result, params);
|
return new SSAPhiInstruction(iindex, result, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAPiInstruction PiInstruction(int result, int val, int piBlock, int successorBlock, SSAInstruction cause) {
|
public SSAPiInstruction PiInstruction(int iindex, int result, int val, int piBlock, int successorBlock, SSAInstruction cause) {
|
||||||
return new SSAPiInstruction(result, val, piBlock, successorBlock, cause);
|
return new SSAPiInstruction(iindex, result, val, piBlock, successorBlock, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAPutInstruction PutInstruction(int ref, int value, FieldReference field) {
|
public SSAPutInstruction PutInstruction(int iindex, int ref, int value, FieldReference field) {
|
||||||
return new SSAPutInstruction(ref, value, field) {
|
return new SSAPutInstruction(iindex, ref, value, field) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isPEI() {
|
public boolean isPEI() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -529,28 +529,28 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAPutInstruction PutInstruction(int value, FieldReference field) {
|
public SSAPutInstruction PutInstruction(int iindex, int value, FieldReference field) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAReturnInstruction ReturnInstruction() {
|
public SSAReturnInstruction ReturnInstruction(int iindex) {
|
||||||
return new SSAReturnInstruction();
|
return new SSAReturnInstruction(iindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAReturnInstruction ReturnInstruction(int result, boolean isPrimitive) {
|
public SSAReturnInstruction ReturnInstruction(int iindex, int result, boolean isPrimitive) {
|
||||||
return new SSAReturnInstruction(result, isPrimitive);
|
return new SSAReturnInstruction(iindex, result, isPrimitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSASwitchInstruction SwitchInstruction(int val, int defaultLabel, int[] casesAndLabels) {
|
public SSASwitchInstruction SwitchInstruction(int iindex, int val, int defaultLabel, int[] casesAndLabels) {
|
||||||
return new SSASwitchInstruction(val, defaultLabel, casesAndLabels);
|
return new SSASwitchInstruction(iindex, val, defaultLabel, casesAndLabels);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAThrowInstruction ThrowInstruction(int exception) {
|
public SSAThrowInstruction ThrowInstruction(int iindex, int exception) {
|
||||||
return new SSAThrowInstruction(exception) {
|
return new SSAThrowInstruction(iindex, exception) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isPEI() {
|
public boolean isPEI() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -564,44 +564,44 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAUnaryOpInstruction UnaryOpInstruction(com.ibm.wala.shrikeBT.IUnaryOpInstruction.IOperator operator, int result,
|
public SSAUnaryOpInstruction UnaryOpInstruction(int iindex, com.ibm.wala.shrikeBT.IUnaryOpInstruction.IOperator operator, int result,
|
||||||
int val) {
|
int val) {
|
||||||
return new SSAUnaryOpInstruction(operator, result, val);
|
return new SSAUnaryOpInstruction(iindex, operator, result, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAAddressOfInstruction AddressOfInstruction(int lval, int local, TypeReference pointeeType) {
|
public SSAAddressOfInstruction AddressOfInstruction(int iindex, int lval, int local, TypeReference pointeeType) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAAddressOfInstruction AddressOfInstruction(int lval, int local, int indexVal, TypeReference pointeeType) {
|
public SSAAddressOfInstruction AddressOfInstruction(int iindex, int lval, int local, int indexVal, TypeReference pointeeType) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAAddressOfInstruction AddressOfInstruction(int lval, int local, FieldReference field, TypeReference pointeeType) {
|
public SSAAddressOfInstruction AddressOfInstruction(int iindex, int lval, int local, FieldReference field, TypeReference pointeeType) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSALoadIndirectInstruction LoadIndirectInstruction(int lval, TypeReference t, int addressVal) {
|
public SSALoadIndirectInstruction LoadIndirectInstruction(int iindex, int lval, TypeReference t, int addressVal) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAStoreIndirectInstruction StoreIndirectInstruction(int addressVal, int rval, TypeReference t) {
|
public SSAStoreIndirectInstruction StoreIndirectInstruction(int iindex, int addressVal, int rval, TypeReference t) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrototypeLookup PrototypeLookup(int lval, int object) {
|
public PrototypeLookup PrototypeLookup(int iindex, int lval, int object) {
|
||||||
return new PrototypeLookup(lval, object);
|
return new PrototypeLookup(iindex, lval, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SetPrototype SetPrototype(int object, int prototype) {
|
public SetPrototype SetPrototype(int iindex, int object, int prototype) {
|
||||||
return new SetPrototype(object, prototype);
|
return new SetPrototype(iindex, object, prototype);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -655,7 +655,7 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
@Override
|
@Override
|
||||||
public PrimitiveType getPrimitive(TypeReference reference) {
|
public PrimitiveType getPrimitive(TypeReference reference) {
|
||||||
return JSPrimitiveType.getPrimitive(reference);
|
return PrimitiveType.getPrimitive(reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,30 +17,30 @@ import com.ibm.wala.ssa.SSAPutInstruction;
|
||||||
|
|
||||||
public interface JSInstructionFactory extends AstInstructionFactory {
|
public interface JSInstructionFactory extends AstInstructionFactory {
|
||||||
|
|
||||||
JavaScriptCheckReference CheckReference(int ref);
|
JavaScriptCheckReference CheckReference(int iindex, int ref);
|
||||||
|
|
||||||
SSAGetInstruction GetInstruction(int result, int ref, String field);
|
SSAGetInstruction GetInstruction(int iindex, int result, int ref, String field);
|
||||||
|
|
||||||
JavaScriptInstanceOf InstanceOf(int result, int objVal, int typeVal);
|
JavaScriptInstanceOf InstanceOf(int iindex, int result, int objVal, int typeVal);
|
||||||
|
|
||||||
JavaScriptInvoke Invoke(int function, int results[], int[] params, int exception, CallSiteReference site);
|
JavaScriptInvoke Invoke(int iindex, int function, int results[], int[] params, int exception, CallSiteReference site);
|
||||||
|
|
||||||
JavaScriptInvoke Invoke(int function, int result, int[] params, int exception, CallSiteReference site);
|
JavaScriptInvoke Invoke(int iindex, int function, int result, int[] params, int exception, CallSiteReference site);
|
||||||
|
|
||||||
JavaScriptInvoke Invoke(int function, int[] params, int exception, CallSiteReference site);
|
JavaScriptInvoke Invoke(int iindex, int function, int[] params, int exception, CallSiteReference site);
|
||||||
|
|
||||||
JavaScriptPropertyRead PropertyRead(int result, int objectRef, int memberRef);
|
JavaScriptPropertyRead PropertyRead(int iindex, int result, int objectRef, int memberRef);
|
||||||
|
|
||||||
JavaScriptPropertyWrite PropertyWrite(int objectRef, int memberRef, int value);
|
JavaScriptPropertyWrite PropertyWrite(int iindex, int objectRef, int memberRef, int value);
|
||||||
|
|
||||||
SSAPutInstruction PutInstruction(int ref, int value, String field);
|
SSAPutInstruction PutInstruction(int iindex, int ref, int value, String field);
|
||||||
|
|
||||||
JavaScriptTypeOfInstruction TypeOfInstruction(int lval, int object);
|
JavaScriptTypeOfInstruction TypeOfInstruction(int iindex, int lval, int object);
|
||||||
|
|
||||||
JavaScriptWithRegion WithRegion(int expr, boolean isEnter);
|
JavaScriptWithRegion WithRegion(int iindex, int expr, boolean isEnter);
|
||||||
|
|
||||||
PrototypeLookup PrototypeLookup(int lval, int object);
|
PrototypeLookup PrototypeLookup(int iindex, int lval, int object);
|
||||||
|
|
||||||
SetPrototype SetPrototype(int object, int prototype);
|
SetPrototype SetPrototype(int iindex, int object, int prototype);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,14 @@ import com.ibm.wala.types.TypeReference;
|
||||||
public class JavaScriptCheckReference extends SSAInstruction {
|
public class JavaScriptCheckReference extends SSAInstruction {
|
||||||
private final int ref;
|
private final int ref;
|
||||||
|
|
||||||
public JavaScriptCheckReference(int ref) {
|
public JavaScriptCheckReference(int iindex, int ref) {
|
||||||
|
super(iindex);
|
||||||
this.ref = ref;
|
this.ref = ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((JSInstructionFactory)insts).CheckReference(uses==null? ref: uses[0]);
|
return ((JSInstructionFactory)insts).CheckReference(iindex, uses==null? ref: uses[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,8 @@ public class JavaScriptInstanceOf extends SSAInstruction {
|
||||||
private final int typeVal;
|
private final int typeVal;
|
||||||
private final int result;
|
private final int result;
|
||||||
|
|
||||||
public JavaScriptInstanceOf(int result, int objVal, int typeVal) {
|
public JavaScriptInstanceOf(int iindex, int result, int objVal, int typeVal) {
|
||||||
|
super(iindex);
|
||||||
this.objVal = objVal;
|
this.objVal = objVal;
|
||||||
this.typeVal = typeVal;
|
this.typeVal = typeVal;
|
||||||
this.result = result;
|
this.result = result;
|
||||||
|
@ -34,7 +35,7 @@ public class JavaScriptInstanceOf extends SSAInstruction {
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return
|
return
|
||||||
((JSInstructionFactory)insts).InstanceOf(
|
((JSInstructionFactory)insts).InstanceOf(iindex,
|
||||||
defs==null? result: defs[0],
|
defs==null? result: defs[0],
|
||||||
uses==null? objVal: uses[0],
|
uses==null? objVal: uses[0],
|
||||||
uses==null? typeVal: uses[1]);
|
uses==null? typeVal: uses[1]);
|
||||||
|
|
|
@ -28,18 +28,18 @@ public class JavaScriptInvoke extends MultiReturnValueInvokeInstruction {
|
||||||
|
|
||||||
private int function;
|
private int function;
|
||||||
|
|
||||||
public JavaScriptInvoke(int function, int results[], int[] params, int exception, CallSiteReference site) {
|
public JavaScriptInvoke(int iindex, int function, int results[], int[] params, int exception, CallSiteReference site) {
|
||||||
super(results, exception, site);
|
super(iindex, results, exception, site);
|
||||||
this.function = function;
|
this.function = function;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaScriptInvoke(int function, int result, int[] params, int exception, CallSiteReference site) {
|
public JavaScriptInvoke(int iindex, int function, int result, int[] params, int exception, CallSiteReference site) {
|
||||||
this(function, new int[] { result }, params, exception, site);
|
this(iindex, function, new int[] { result }, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaScriptInvoke(int function, int[] params, int exception, CallSiteReference site) {
|
public JavaScriptInvoke(int iindex, int function, int[] params, int exception, CallSiteReference site) {
|
||||||
this(function, null, params, exception, site);
|
this(iindex, function, null, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -74,7 +74,7 @@ public class JavaScriptInvoke extends MultiReturnValueInvokeInstruction {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((JSInstructionFactory)insts).Invoke(fn, newLvals, newParams, newExp, site);
|
return ((JSInstructionFactory)insts).Invoke(iindex, fn, newLvals, newParams, newExp, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,14 @@ import com.ibm.wala.ssa.SSAInstructionFactory;
|
||||||
import com.ibm.wala.types.TypeReference;
|
import com.ibm.wala.types.TypeReference;
|
||||||
|
|
||||||
public class JavaScriptPropertyRead extends AbstractReflectiveGet {
|
public class JavaScriptPropertyRead extends AbstractReflectiveGet {
|
||||||
public JavaScriptPropertyRead(int result, int objectRef, int memberRef) {
|
public JavaScriptPropertyRead(int iindex, int result, int objectRef, int memberRef) {
|
||||||
super(result, objectRef, memberRef);
|
super(iindex, result, objectRef, memberRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return
|
return
|
||||||
((JSInstructionFactory)insts).PropertyRead(
|
((JSInstructionFactory)insts).PropertyRead(iindex,
|
||||||
defs==null? getDef(): defs[0],
|
defs==null? getDef(): defs[0],
|
||||||
uses==null? getObjectRef(): uses[0],
|
uses==null? getObjectRef(): uses[0],
|
||||||
uses==null? getMemberRef(): uses[1]);
|
uses==null? getMemberRef(): uses[1]);
|
||||||
|
|
|
@ -20,13 +20,13 @@ import com.ibm.wala.types.TypeReference;
|
||||||
|
|
||||||
public class JavaScriptPropertyWrite extends AbstractReflectivePut {
|
public class JavaScriptPropertyWrite extends AbstractReflectivePut {
|
||||||
|
|
||||||
public JavaScriptPropertyWrite(int objectRef, int memberRef, int value) {
|
public JavaScriptPropertyWrite(int iindex, int objectRef, int memberRef, int value) {
|
||||||
super(objectRef, memberRef, value);
|
super(iindex, objectRef, memberRef, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((JSInstructionFactory)insts).PropertyWrite(uses == null ? getObjectRef() : uses[0], uses == null ? getMemberRef() : uses[1],
|
return ((JSInstructionFactory)insts).PropertyWrite(iindex, uses == null ? getObjectRef() : uses[0], uses == null ? getMemberRef() : uses[1],
|
||||||
uses == null ? getValue() : uses[2]);
|
uses == null ? getValue() : uses[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,13 @@ import com.ibm.wala.types.TypeReference;
|
||||||
|
|
||||||
public class JavaScriptTypeOfInstruction extends SSAAbstractUnaryInstruction {
|
public class JavaScriptTypeOfInstruction extends SSAAbstractUnaryInstruction {
|
||||||
|
|
||||||
public JavaScriptTypeOfInstruction(int lval, int object) {
|
public JavaScriptTypeOfInstruction(int iindex, int lval, int object) {
|
||||||
super(lval, object);
|
super(iindex, lval, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((JSInstructionFactory)insts).TypeOfInstruction((defs != null ? defs[0] : getDef(0)), (uses != null ? uses[0] : getUse(0)));
|
return ((JSInstructionFactory)insts).TypeOfInstruction(iindex, (defs != null ? defs[0] : getDef(0)), (uses != null ? uses[0] : getUse(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,14 +21,15 @@ public class JavaScriptWithRegion extends SSAInstruction {
|
||||||
private final int expr;
|
private final int expr;
|
||||||
private final boolean isEnter;
|
private final boolean isEnter;
|
||||||
|
|
||||||
public JavaScriptWithRegion(int expr, boolean isEnter) {
|
public JavaScriptWithRegion(int iindex, int expr, boolean isEnter) {
|
||||||
|
super(iindex);
|
||||||
this.expr = expr;
|
this.expr = expr;
|
||||||
this.isEnter = isEnter;
|
this.isEnter = isEnter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((JSInstructionFactory)insts).WithRegion(uses==null? expr: uses[0], isEnter);
|
return ((JSInstructionFactory)insts).WithRegion(iindex, uses==null? expr: uses[0], isEnter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,13 +21,13 @@ import com.ibm.wala.ssa.SymbolTable;
|
||||||
*/
|
*/
|
||||||
public class PrototypeLookup extends SSAAbstractUnaryInstruction {
|
public class PrototypeLookup extends SSAAbstractUnaryInstruction {
|
||||||
|
|
||||||
public PrototypeLookup(int result, int val) {
|
public PrototypeLookup(int iindex, int result, int val) {
|
||||||
super(result, val);
|
super(iindex, result, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((JSInstructionFactory)insts).PrototypeLookup((defs != null ? defs[0] : getDef(0)), (uses != null ? uses[0] : getUse(0)));
|
return ((JSInstructionFactory)insts).PrototypeLookup(iindex, (defs != null ? defs[0] : getDef(0)), (uses != null ? uses[0] : getUse(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,7 +18,8 @@ public class SetPrototype extends SSAInstruction {
|
||||||
private final int object;
|
private final int object;
|
||||||
private final int prototype;
|
private final int prototype;
|
||||||
|
|
||||||
public SetPrototype(int object, int prototype) {
|
public SetPrototype(int iindex, int object, int prototype) {
|
||||||
|
super(iindex);
|
||||||
this.object = object;
|
this.object = object;
|
||||||
this.prototype = prototype;
|
this.prototype = prototype;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +37,7 @@ public class SetPrototype extends SSAInstruction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((JSInstructionFactory)insts).SetPrototype((uses != null ? uses[0] : object), (uses != null ? uses[1] : prototype));
|
return ((JSInstructionFactory)insts).SetPrototype(iindex, (uses != null ? uses[0] : object), (uses != null ? uses[1] : prototype));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -108,8 +108,7 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
*/
|
*/
|
||||||
private void addDefinedCheck(CAstNode n, WalkContext context, int readVn) {
|
private void addDefinedCheck(CAstNode n, WalkContext context, int readVn) {
|
||||||
context.cfg().addPreNode(n);
|
context.cfg().addPreNode(n);
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).CheckReference(readVn));
|
context.cfg().addInstruction(((JSInstructionFactory)insts).CheckReference(context.cfg().getCurrentInstruction(), readVn));
|
||||||
|
|
||||||
CAstNode target = context.getControlFlow().getTarget(n, JavaScriptTypes.ReferenceError);
|
CAstNode target = context.getControlFlow().getTarget(n, JavaScriptTypes.ReferenceError);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
context.cfg().addPreEdge(n, target, true);
|
context.cfg().addPreEdge(n, target, true);
|
||||||
|
@ -185,7 +184,7 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doThrow(WalkContext context, int exception) {
|
protected void doThrow(WalkContext context, int exception) {
|
||||||
context.cfg().addInstruction(insts.ThrowInstruction(exception));
|
context.cfg().addInstruction(insts.ThrowInstruction(context.cfg().getCurrentInstruction(), exception));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -196,7 +195,7 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
: AstMethodReference.fnReference(JavaScriptTypes.CodeBody);
|
: AstMethodReference.fnReference(JavaScriptTypes.CodeBody);
|
||||||
|
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).Invoke(receiver, result, arguments, exception,
|
((JSInstructionFactory) insts).Invoke(context.cfg().getCurrentInstruction(), receiver, result, arguments, exception,
|
||||||
new JSCallSiteReference(ref, context.cfg().getCurrentInstruction())));
|
new JSCallSiteReference(ref, context.cfg().getCurrentInstruction())));
|
||||||
|
|
||||||
context.cfg().addPreNode(call, context.getUnwindState());
|
context.cfg().addPreNode(call, context.getUnwindState());
|
||||||
|
@ -216,8 +215,8 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
assert arguments == null;
|
assert arguments == null;
|
||||||
TypeReference typeRef = TypeReference.findOrCreate(JavaScriptTypes.jsLoader, TypeName.string2TypeName("L" + type));
|
TypeReference typeRef = TypeReference.findOrCreate(JavaScriptTypes.jsLoader, TypeName.string2TypeName("L" + type));
|
||||||
|
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(insts.NewInstruction(context.cfg().getCurrentInstruction(), result,
|
||||||
insts.NewInstruction(result, NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef)));
|
NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -226,8 +225,8 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
// "Function" is the name we use to model the constructor of function values
|
// "Function" is the name we use to model the constructor of function values
|
||||||
int tmp = super.doGlobalRead(n, context, "Function", JavaScriptTypes.Function);
|
int tmp = super.doGlobalRead(n, context, "Function", JavaScriptTypes.Function);
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).Invoke(tmp, result, new int[] { nm }, exception, new JSCallSiteReference(
|
((JSInstructionFactory)insts).Invoke(context.cfg().getCurrentInstruction(), tmp, result, new int[]{ nm }, exception,
|
||||||
JavaScriptMethods.ctorReference, context.cfg().getCurrentInstruction())));
|
new JSCallSiteReference(JavaScriptMethods.ctorReference, context.cfg().getCurrentInstruction())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -245,17 +244,18 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
this.visit(elt, context, this);
|
this.visit(elt, context, this);
|
||||||
int x = context.currentScope().allocateTempValue();
|
int x = context.currentScope().allocateTempValue();
|
||||||
|
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).AssignInstruction(x, receiver));
|
context.cfg().addInstruction(((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(), x, receiver));
|
||||||
|
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).PrototypeLookup(x, x));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).PrototypeLookup(context.cfg().getCurrentInstruction(), x, x));
|
||||||
|
|
||||||
if (elt.getKind() == CAstNode.CONSTANT && elt.getValue() instanceof String) {
|
if (elt.getKind() == CAstNode.CONSTANT && elt.getValue() instanceof String) {
|
||||||
String field = (String) elt.getValue();
|
String field = (String) elt.getValue();
|
||||||
// symtab needs to have this value
|
// symtab needs to have this value
|
||||||
context.currentScope().getConstantValue(field);
|
context.currentScope().getConstantValue(field);
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).GetInstruction(result, x, field));
|
context.cfg().addInstruction(
|
||||||
|
((JSInstructionFactory)insts).GetInstruction(context.cfg().getCurrentInstruction(), result, x, field));
|
||||||
} else {
|
} else {
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).PropertyRead(result, x, context.getValue(elt)));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).PropertyRead(context.cfg().getCurrentInstruction(), result, x, context.getValue(elt)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate code to handle read of property from null or undefined
|
// generate code to handle read of property from null or undefined
|
||||||
|
@ -275,14 +275,14 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
if (elt.getKind() == CAstNode.CONSTANT && elt.getValue() instanceof String) {
|
if (elt.getKind() == CAstNode.CONSTANT && elt.getValue() instanceof String) {
|
||||||
String field = (String) elt.getValue();
|
String field = (String) elt.getValue();
|
||||||
if (isPrologueScript(context) && "__proto__".equals(field)) {
|
if (isPrologueScript(context) && "__proto__".equals(field)) {
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).SetPrototype(receiver, rval));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).SetPrototype(context.cfg().getCurrentInstruction(), receiver, rval));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
} else {
|
} else {
|
||||||
context.currentScope().getConstantValue(field);
|
context.currentScope().getConstantValue(field);
|
||||||
SSAPutInstruction put = ((JSInstructionFactory) insts).PutInstruction(receiver, rval, field);
|
SSAPutInstruction put = ((JSInstructionFactory) insts).PutInstruction(context.cfg().getCurrentInstruction(), receiver, rval, field);
|
||||||
try {
|
try {
|
||||||
assert field.equals(put.getDeclaredField().getName().toUnicodeString());
|
assert field.equals(put.getDeclaredField().getName().toUnicodeString());
|
||||||
} catch (UTFDataFormatException e) {
|
} catch (UTFDataFormatException e) {
|
||||||
|
@ -292,7 +292,7 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*/
|
*/
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).PropertyWrite(receiver, context.getValue(elt), rval));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).PropertyWrite(context.cfg().getCurrentInstruction(), receiver, context.getValue(elt), rval));
|
||||||
context.cfg().addPreNode(parent, context.getUnwindState());
|
context.cfg().addPreNode(parent, context.getUnwindState());
|
||||||
|
|
||||||
// generate code to handle read of property from null or undefined
|
// generate code to handle read of property from null or undefined
|
||||||
|
@ -310,7 +310,8 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
// set the class property of the new object
|
// set the class property of the new object
|
||||||
int rval = context.currentScope().getConstantValue(typeName);
|
int rval = context.currentScope().getConstantValue(typeName);
|
||||||
context.currentScope().getConstantValue("class");
|
context.currentScope().getConstantValue("class");
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).PutInstruction(resultVal, rval, "class"));
|
context.cfg().addInstruction(
|
||||||
|
((JSInstructionFactory)insts).PutInstruction(context.cfg().getCurrentInstruction(), resultVal, rval, "class"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -319,36 +320,36 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
String name = (String) primitiveCall.getChild(0).getValue();
|
String name = (String) primitiveCall.getChild(0).getValue();
|
||||||
if (name.equals("GlobalNaN")) {
|
if (name.equals("GlobalNaN")) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).AssignInstruction(resultVal,
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
context.currentScope().getConstantValue(new Float(Float.NaN))));
|
resultVal, context.currentScope().getConstantValue(new Float(Float.NaN))));
|
||||||
} else if (name.equals("GlobalInfinity")) {
|
} else if (name.equals("GlobalInfinity")) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).AssignInstruction(resultVal,
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
context.currentScope().getConstantValue(new Float(Float.POSITIVE_INFINITY))));
|
resultVal, context.currentScope().getConstantValue(new Float(Float.POSITIVE_INFINITY))));
|
||||||
} else if (name.equals("MathE")) {
|
} else if (name.equals("MathE")) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts)
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
.AssignInstruction(resultVal, context.currentScope().getConstantValue(new Double(Math.E))));
|
resultVal, context.currentScope().getConstantValue(new Double(Math.E))));
|
||||||
} else if (name.equals("MathPI")) {
|
} else if (name.equals("MathPI")) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).AssignInstruction(resultVal, context.currentScope()
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
.getConstantValue(new Double(Math.PI))));
|
resultVal, context.currentScope().getConstantValue(new Double(Math.PI))));
|
||||||
} else if (name.equals("MathSQRT1_2")) {
|
} else if (name.equals("MathSQRT1_2")) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).AssignInstruction(resultVal,
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
context.currentScope().getConstantValue(new Double(Math.sqrt(.5)))));
|
resultVal, context.currentScope().getConstantValue(new Double(Math.sqrt(.5)))));
|
||||||
} else if (name.equals("MathSQRT2")) {
|
} else if (name.equals("MathSQRT2")) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).AssignInstruction(resultVal,
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
context.currentScope().getConstantValue(new Double(Math.sqrt(2)))));
|
resultVal, context.currentScope().getConstantValue(new Double(Math.sqrt(2)))));
|
||||||
} else if (name.equals("MathLN2")) {
|
} else if (name.equals("MathLN2")) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).AssignInstruction(resultVal,
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
context.currentScope().getConstantValue(new Double(Math.log(2)))));
|
resultVal, context.currentScope().getConstantValue(new Double(Math.log(2)))));
|
||||||
} else if (name.equals("MathLN10")) {
|
} else if (name.equals("MathLN10")) {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).AssignInstruction(resultVal,
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
context.currentScope().getConstantValue(new Double(Math.log(10)))));
|
resultVal, context.currentScope().getConstantValue(new Double(Math.log(10)))));
|
||||||
} else if (name.equals("NewObject")) {
|
} else if (name.equals("NewObject")) {
|
||||||
doNewObject(context, null, resultVal, "Object", null);
|
doNewObject(context, null, resultVal, "Object", null);
|
||||||
|
|
||||||
|
@ -372,7 +373,8 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
context.cfg().addInstruction(
|
context.cfg().addInstruction(
|
||||||
((JSInstructionFactory) insts).AssignInstruction(resultVal, context.currentScope().getConstantValue(null)));
|
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
|
||||||
|
resultVal, context.currentScope().getConstantValue( null )));
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new RuntimeException("Cannot translate primitive " + primitiveCall.getChild(0).getValue());
|
throw new RuntimeException("Cannot translate primitive " + primitiveCall.getChild(0).getValue());
|
||||||
|
@ -387,11 +389,11 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
FieldReference fieldRef = FieldReference.findOrCreate(JavaScriptTypes.Root, Atom.findOrCreateUnicodeAtom(field),
|
FieldReference fieldRef = FieldReference.findOrCreate(JavaScriptTypes.Root, Atom.findOrCreateUnicodeAtom(field),
|
||||||
JavaScriptTypes.Root);
|
JavaScriptTypes.Root);
|
||||||
|
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).IsDefinedInstruction(result, ref, fieldRef));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).IsDefinedInstruction(context.cfg().getCurrentInstruction(), result, ref, fieldRef));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).IsDefinedInstruction(result, ref, context.getValue(f)));
|
context.cfg().addInstruction(((JSInstructionFactory) insts).IsDefinedInstruction(context.cfg().getCurrentInstruction(), result, ref, context.getValue(f)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +416,7 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
visit(n.getChild(1), context, visitor);
|
visit(n.getChild(1), context, visitor);
|
||||||
int type = context.getValue(n.getChild(1));
|
int type = context.getValue(n.getChild(1));
|
||||||
|
|
||||||
context.cfg().addInstruction(new JavaScriptInstanceOf(result, value, type));
|
context.cfg().addInstruction(new JavaScriptInstanceOf(context.cfg().getCurrentInstruction(), result, value, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -425,7 +427,7 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
doNewObject(context, null, tempVal, "Array", null);
|
doNewObject(context, null, tempVal, "Array", null);
|
||||||
CAstSymbol args = new CAstSymbolImpl("arguments", Any);
|
CAstSymbol args = new CAstSymbolImpl("arguments", Any);
|
||||||
context.currentScope().declare(args, tempVal);
|
context.currentScope().declare(args, tempVal);
|
||||||
//context.cfg().addInstruction(((JSInstructionFactory) insts).PutInstruction(1, tempVal, "arguments"));
|
//context.cfg().addInstruction(((JSInstructionFactory)insts).PutInstruction(context.cfg().getCurrentInstruction(), 1, tempVal, "arguments"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -437,7 +439,7 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
this.visit(n.getChild(0), context, this);
|
this.visit(n.getChild(0), context, this);
|
||||||
int ref = context.getValue(n.getChild(0));
|
int ref = context.getValue(n.getChild(0));
|
||||||
|
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).TypeOfInstruction(result, ref));
|
context.cfg().addInstruction(((JSInstructionFactory)insts).TypeOfInstruction(context.cfg().getCurrentInstruction(), result, ref));
|
||||||
|
|
||||||
context.setValue(n, result);
|
context.setValue(n, result);
|
||||||
return true;
|
return true;
|
||||||
|
@ -449,7 +451,8 @@ public class JSAstTranslator extends AstTranslator {
|
||||||
this.visit(n.getChild(0), context, this);
|
this.visit(n.getChild(0), context, this);
|
||||||
int ref = context.getValue(n.getChild(0));
|
int ref = context.getValue(n.getChild(0));
|
||||||
|
|
||||||
context.cfg().addInstruction(((JSInstructionFactory) insts).WithRegion(ref, n.getKind() == JavaScriptCAstNode.ENTER_WITH));
|
context.cfg().addInstruction(((JSInstructionFactory)insts).WithRegion(context.cfg().getCurrentInstruction(), ref,
|
||||||
|
n.getKind() == JavaScriptCAstNode.ENTER_WITH));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,12 @@ public class JsPaPanel extends PaPanel {
|
||||||
private MutableMapping<List<ObjectPropertyCatalogKey>> instanceKeyIdToObjectPropertyCatalogKey = MutableMapping.<List<ObjectPropertyCatalogKey>> make();
|
private MutableMapping<List<ObjectPropertyCatalogKey>> instanceKeyIdToObjectPropertyCatalogKey = MutableMapping.<List<ObjectPropertyCatalogKey>> make();
|
||||||
private List<AstGlobalPointerKey> globalsPointerKeys = new ArrayList<AstGlobalPointerKey>();
|
private List<AstGlobalPointerKey> globalsPointerKeys = new ArrayList<AstGlobalPointerKey>();
|
||||||
|
|
||||||
public JsPaPanel(CallGraph cg, PointerAnalysis pa) {
|
public JsPaPanel(CallGraph cg, PointerAnalysis<InstanceKey> pa) {
|
||||||
super(cg, pa);
|
super(cg, pa);
|
||||||
initDataStructures(pa);
|
initDataStructures(pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDataStructures(PointerAnalysis pa) {
|
private void initDataStructures(PointerAnalysis<InstanceKey> pa) {
|
||||||
HeapGraph heapGraph = pa.getHeapGraph();
|
HeapGraph heapGraph = pa.getHeapGraph();
|
||||||
OrdinalSetMapping<InstanceKey> instanceKeyMapping = pa.getInstanceKeyMapping();
|
OrdinalSetMapping<InstanceKey> instanceKeyMapping = pa.getInstanceKeyMapping();
|
||||||
for (Object n : heapGraph){
|
for (Object n : heapGraph){
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package com.ibm.wala.cast.js.vis;
|
package com.ibm.wala.cast.js.vis;
|
||||||
|
|
||||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.viz.viewer.PaPanel;
|
import com.ibm.wala.viz.viewer.PaPanel;
|
||||||
import com.ibm.wala.viz.viewer.WalaViewer;
|
import com.ibm.wala.viz.viewer.WalaViewer;
|
||||||
|
@ -19,12 +20,12 @@ public class JsViewer extends WalaViewer{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public JsViewer(CallGraph cg, PointerAnalysis pa) {
|
public JsViewer(CallGraph cg, PointerAnalysis<InstanceKey> pa) {
|
||||||
super(cg, pa);
|
super(cg, pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PaPanel createPaPanel(CallGraph cg, PointerAnalysis pa) {
|
protected PaPanel createPaPanel(CallGraph cg, PointerAnalysis<InstanceKey> pa) {
|
||||||
return new JsPaPanel(cg, pa);
|
return new JsPaPanel(cg, pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="harness-src"/>
|
<classpathentry kind="src" path="harness-src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -12,5 +12,5 @@ Require-Bundle:
|
||||||
com.ibm.wala.shrike,
|
com.ibm.wala.shrike,
|
||||||
org.eclipse.core.runtime
|
org.eclipse.core.runtime
|
||||||
Export-Package: com.ibm.wala.cast.test
|
Export-Package: com.ibm.wala.cast.test
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
||||||
<classpathentry kind="src" path="source/java"/>
|
<classpathentry kind="src" path="source/java"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/commons-io-2.4.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore
|
|
@ -9,6 +9,8 @@ Require-Bundle: com.ibm.wala.core,
|
||||||
com.ibm.wala.shrike,
|
com.ibm.wala.shrike,
|
||||||
org.eclipse.core.runtime
|
org.eclipse.core.runtime
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Bundle-ClassPath: .,
|
||||||
|
lib/commons-io-2.4.jar
|
||||||
Export-Package: com.ibm.wala.cast.analysis.typeInference,
|
Export-Package: com.ibm.wala.cast.analysis.typeInference,
|
||||||
com.ibm.wala.cast.ipa.callgraph,
|
com.ibm.wala.cast.ipa.callgraph,
|
||||||
com.ibm.wala.cast.ipa.cha,
|
com.ibm.wala.cast.ipa.cha,
|
||||||
|
@ -26,6 +28,8 @@ Export-Package: com.ibm.wala.cast.analysis.typeInference,
|
||||||
com.ibm.wala.cast.tree.rewrite,
|
com.ibm.wala.cast.tree.rewrite,
|
||||||
com.ibm.wala.cast.tree.visit,
|
com.ibm.wala.cast.tree.visit,
|
||||||
com.ibm.wala.cast.types,
|
com.ibm.wala.cast.types,
|
||||||
com.ibm.wala.cast.util
|
com.ibm.wala.cast.util,
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
org.apache.commons.io,
|
||||||
|
org.apache.commons.io.input
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
source.. = source/java/
|
source.. = source/java/
|
||||||
output.. = bin/
|
output.. = bin/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
|
lib/commons-io-2.4.jar,\
|
||||||
.
|
.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
CAPA Domo build file
|
CAPA Domo build file
|
||||||
=======================================================================
|
=======================================================================
|
||||||
-->
|
-->
|
||||||
<project name="com.ibm.wala.cast" default="build-everything" basedir=".">
|
<project name="com.ibm.wala.cast" default="getJars" basedir=".">
|
||||||
<!-- Software version details -->
|
<!-- Software version details -->
|
||||||
<property name="name" value="walacast" />
|
<property name="name" value="walacast" />
|
||||||
<property name="module_name" value="com.ibm.wala.cast" />
|
<property name="module_name" value="com.ibm.wala.cast" />
|
||||||
|
@ -36,6 +36,36 @@
|
||||||
<property name="mainlib" value="../mainlib" />
|
<property name="mainlib" value="../mainlib" />
|
||||||
<property name="sharedlib" value="../sharedlib" />
|
<property name="sharedlib" value="../sharedlib" />
|
||||||
|
|
||||||
<import file="${sharedlib}/scripts/common-targets.xml"/>
|
<target name="properties" if="eclipse.running">
|
||||||
|
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="init" depends="properties">
|
||||||
|
<condition property="pluginTemp" value="${buildTempFolder}/plugins">
|
||||||
|
<isset property="buildTempFolder"/>
|
||||||
|
</condition>
|
||||||
|
<property name="pluginTemp" value="${basedir}"/>
|
||||||
|
<condition property="build.result.folder" value="${pluginTemp}/com.ibm.wala.core.testdata">
|
||||||
|
<isset property="buildTempFolder"/>
|
||||||
|
</condition>
|
||||||
|
<property name="build.result.folder" value="${basedir}"/>
|
||||||
|
<property name="temp.folder" value="${basedir}/temp.folder"/>
|
||||||
|
<property name="plugin.destination" value="${basedir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="CommonsIoPresent" depends="init">
|
||||||
|
<available file="${plugin.destination}/lib/commons-io-2.4.jar" property="commons.io.present"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="fetchCommonsIo" depends="CommonsIoPresent" unless="commons.io.present">
|
||||||
|
<delete dir="${temp.folder}"/>
|
||||||
|
<mkdir dir="${temp.folder}"/>
|
||||||
|
<get src="http://apache.petsads.us/commons/io/binaries/commons-io-2.4-bin.zip" dest="${temp.folder}/commons-io-2.4.zip"/>
|
||||||
|
<unzip src="${temp.folder}/commons-io-2.4.zip" dest="${temp.folder}"/>
|
||||||
|
<copy file="${temp.folder}/commons-io-2.4/commons-io-2.4.jar" tofile="${plugin.destination}/lib/commons-io-2.4.jar" />
|
||||||
|
<delete dir="${temp.folder}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="getJars" depends="fetchCommonsIo" />
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -9,4 +9,30 @@
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>com.ibm.wala.cast</artifactId>
|
<artifactId>com.ibm.wala.cast</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>copy</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<type>jar</type>
|
||||||
|
<overWrite>false</overWrite>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
<outputDirectory>${basedir}/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class AstCallGraph extends ExplicitCallGraph {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstLexicalRead addGlobalRead(TypeReference type, String name) {
|
public AstLexicalRead addGlobalRead(TypeReference type, String name) {
|
||||||
AstLexicalRead s = new AstLexicalRead(nextLocal++, null, name, type);
|
AstLexicalRead s = new AstLexicalRead(statements.size(), nextLocal++, null, name, type);
|
||||||
statements.add(s);
|
statements.add(s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (c) 2002 - 2014 IBM Corporation.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
package com.ibm.wala.cast.ipa.callgraph;
|
package com.ibm.wala.cast.ipa.callgraph;
|
||||||
|
|
||||||
import com.ibm.wala.ipa.modref.ExtendedHeapModel;
|
import com.ibm.wala.ipa.modref.ExtendedHeapModel;
|
||||||
|
|
|
@ -141,7 +141,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
||||||
protected PropagationSystem makeSystem(AnalysisOptions options) {
|
protected PropagationSystem makeSystem(AnalysisOptions options) {
|
||||||
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory) {
|
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory) {
|
||||||
@Override
|
@Override
|
||||||
public PointerAnalysis makePointerAnalysis(PropagationCallGraphBuilder builder) {
|
public PointerAnalysis<InstanceKey> makePointerAnalysis(PropagationCallGraphBuilder builder) {
|
||||||
return new AstPointerAnalysisImpl(builder, cg, pointsToMap, instanceKeys, pointerKeyFactory, instanceKeyFactory);
|
return new AstPointerAnalysisImpl(builder, cg, pointsToMap, instanceKeys, pointerKeyFactory, instanceKeyFactory);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,11 +12,15 @@ package com.ibm.wala.cast.ipa.callgraph;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.apache.commons.io.ByteOrderMark;
|
||||||
|
import org.apache.commons.io.input.BOMInputStream;
|
||||||
|
|
||||||
import com.ibm.wala.cast.loader.SingleClassLoaderFactory;
|
import com.ibm.wala.cast.loader.SingleClassLoaderFactory;
|
||||||
import com.ibm.wala.classLoader.IMethod;
|
import com.ibm.wala.classLoader.IMethod;
|
||||||
import com.ibm.wala.classLoader.Language;
|
import com.ibm.wala.classLoader.Language;
|
||||||
|
@ -26,6 +30,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
|
||||||
import com.ibm.wala.ssa.IR;
|
import com.ibm.wala.ssa.IR;
|
||||||
|
@ -54,7 +59,23 @@ public class CAstCallGraphUtil {
|
||||||
|
|
||||||
assert hackedName.endsWith(scriptName) : scriptName + " does not match file " + script.getFile();
|
assert hackedName.endsWith(scriptName) : scriptName + " does not match file " + script.getFile();
|
||||||
|
|
||||||
return new SourceFileModule(scriptFile, scriptName, null);
|
return new SourceFileModule(scriptFile, scriptName, null) {
|
||||||
|
@Override
|
||||||
|
public InputStream getInputStream() {
|
||||||
|
BOMInputStream bs = new BOMInputStream(super.getInputStream(), false,
|
||||||
|
ByteOrderMark.UTF_8,
|
||||||
|
ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_16BE,
|
||||||
|
ByteOrderMark.UTF_32LE, ByteOrderMark.UTF_32BE);
|
||||||
|
try {
|
||||||
|
if (bs.hasBOM()) {
|
||||||
|
System.err.println("removing BOM " + bs.getBOM());
|
||||||
|
}
|
||||||
|
return bs;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return super.getInputStream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AnalysisScope makeScope(String[] files, SingleClassLoaderFactory loaders, Language language) throws IOException {
|
public static AnalysisScope makeScope(String[] files, SingleClassLoaderFactory loaders, Language language) throws IOException {
|
||||||
|
@ -98,7 +119,7 @@ public class CAstCallGraphUtil {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dumpCG(PointerAnalysis PA, CallGraph CG) {
|
public static void dumpCG(PointerAnalysis<InstanceKey> PA, CallGraph CG) {
|
||||||
if (AVOID_DUMP)
|
if (AVOID_DUMP)
|
||||||
return;
|
return;
|
||||||
for (Iterator x = CG.iterator(); x.hasNext();) {
|
for (Iterator x = CG.iterator(); x.hasNext();) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ public abstract class CrossLanguageSSAPropagationCallGraphBuilder extends AstSSA
|
||||||
protected PropagationSystem makeSystem(AnalysisOptions options) {
|
protected PropagationSystem makeSystem(AnalysisOptions options) {
|
||||||
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory) {
|
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory) {
|
||||||
@Override
|
@Override
|
||||||
public PointerAnalysis makePointerAnalysis(PropagationCallGraphBuilder builder) {
|
public PointerAnalysis<InstanceKey> makePointerAnalysis(PropagationCallGraphBuilder builder) {
|
||||||
assert builder == CrossLanguageSSAPropagationCallGraphBuilder.this;
|
assert builder == CrossLanguageSSAPropagationCallGraphBuilder.this;
|
||||||
return new CrossLanguagePointerAnalysisImpl(CrossLanguageSSAPropagationCallGraphBuilder.this, cg, pointsToMap,
|
return new CrossLanguagePointerAnalysisImpl(CrossLanguageSSAPropagationCallGraphBuilder.this, cg, pointsToMap,
|
||||||
instanceKeys, pointerKeyFactory, instanceKeyFactory);
|
instanceKeys, pointerKeyFactory, instanceKeyFactory);
|
||||||
|
|
|
@ -274,5 +274,10 @@ public class CrossLanguageClassHierarchy implements IClassHierarchy {
|
||||||
return new CrossLanguageClassHierarchy(scope, factory, hierarchies);
|
return new CrossLanguageClassHierarchy(scope, factory, hierarchies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** BEGIN Custom change: unresolved classes */
|
||||||
|
public Set<TypeReference> getUnresolvedClasses() {
|
||||||
|
return HashSetFactory.make();
|
||||||
|
}
|
||||||
|
/** END Custom change: unresolved classes */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,15 +36,15 @@ import com.ibm.wala.util.intset.OrdinalSet;
|
||||||
*/
|
*/
|
||||||
public class LexicalModRef {
|
public class LexicalModRef {
|
||||||
|
|
||||||
public static LexicalModRef make(CallGraph cg, PointerAnalysis pa) {
|
public static LexicalModRef make(CallGraph cg, PointerAnalysis<InstanceKey> pa) {
|
||||||
return new LexicalModRef(cg, pa);
|
return new LexicalModRef(cg, pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final CallGraph cg;
|
private final CallGraph cg;
|
||||||
|
|
||||||
private final PointerAnalysis pa;
|
private final PointerAnalysis<InstanceKey> pa;
|
||||||
|
|
||||||
protected LexicalModRef(CallGraph cg, PointerAnalysis pa) {
|
protected LexicalModRef(CallGraph cg, PointerAnalysis<InstanceKey> pa) {
|
||||||
this.cg = cg;
|
this.cg = cg;
|
||||||
this.pa = pa;
|
this.pa = pa;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ public class LexicalModRef {
|
||||||
Collection<Pair<CGNode, String>> result = HashSetFactory.make();
|
Collection<Pair<CGNode, String>> result = HashSetFactory.make();
|
||||||
// use scope-mapping instance keys in pointer analysis. may need a different
|
// use scope-mapping instance keys in pointer analysis. may need a different
|
||||||
// scheme for CG construction not based on pointer analysis
|
// scheme for CG construction not based on pointer analysis
|
||||||
OrdinalSet<? extends InstanceKey> functionValues = pa.getPointsToSet(pa.getHeapModel().getPointerKeyForLocal(n, 1));
|
OrdinalSet<InstanceKey> functionValues = pa.getPointsToSet(pa.getHeapModel().getPointerKeyForLocal(n, 1));
|
||||||
for (InstanceKey ik : functionValues) {
|
for (InstanceKey ik : functionValues) {
|
||||||
if (ik instanceof ScopeMappingInstanceKey) {
|
if (ik instanceof ScopeMappingInstanceKey) {
|
||||||
ScopeMappingInstanceKey smik = (ScopeMappingInstanceKey) ik;
|
ScopeMappingInstanceKey smik = (ScopeMappingInstanceKey) ik;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.ibm.wala.cast.ir.ssa.AstLexicalWrite;
|
||||||
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
|
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
|
||||||
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
|
import com.ibm.wala.cast.ir.ssa.EachElementHasNextInstruction;
|
||||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
|
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
|
||||||
import com.ibm.wala.ipa.modref.ExtendedHeapModel;
|
import com.ibm.wala.ipa.modref.ExtendedHeapModel;
|
||||||
|
@ -38,7 +39,7 @@ public class AstModRef extends ModRef {
|
||||||
|
|
||||||
protected static class AstRefVisitor extends RefVisitor<AstHeapModel> implements AstInstructionVisitor {
|
protected static class AstRefVisitor extends RefVisitor<AstHeapModel> implements AstInstructionVisitor {
|
||||||
|
|
||||||
protected AstRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, AstHeapModel h) {
|
protected AstRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, AstHeapModel h) {
|
||||||
super(n, result, pa, h);
|
super(n, result, pa, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ public class AstModRef extends ModRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RefVisitor makeRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, ExtendedHeapModel h) {
|
protected RefVisitor makeRefVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, ExtendedHeapModel h) {
|
||||||
return new AstRefVisitor(n, result, pa, (AstHeapModel)h);
|
return new AstRefVisitor(n, result, pa, (AstHeapModel)h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ public class AstModRef extends ModRef {
|
||||||
implements AstInstructionVisitor
|
implements AstInstructionVisitor
|
||||||
{
|
{
|
||||||
|
|
||||||
protected AstModVisitor(CGNode n, Collection<PointerKey> result, AstHeapModel h, PointerAnalysis pa) {
|
protected AstModVisitor(CGNode n, Collection<PointerKey> result, AstHeapModel h, PointerAnalysis<InstanceKey> pa) {
|
||||||
super(n, result, h, pa, true);
|
super(n, result, h, pa, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ public class AstModRef extends ModRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ModVisitor makeModVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis pa, ExtendedHeapModel h, boolean ignoreAllocHeapDefs) {
|
protected ModVisitor makeModVisitor(CGNode n, Collection<PointerKey> result, PointerAnalysis<InstanceKey> pa, ExtendedHeapModel h, boolean ignoreAllocHeapDefs) {
|
||||||
return new AstModVisitor(n, result, (AstHeapModel)h, pa);
|
return new AstModVisitor(n, result, (AstHeapModel)h, pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ import com.ibm.wala.ssa.SymbolTable;
|
||||||
public abstract class AbstractReflectiveGet extends ReflectiveMemberAccess {
|
public abstract class AbstractReflectiveGet extends ReflectiveMemberAccess {
|
||||||
private final int result;
|
private final int result;
|
||||||
|
|
||||||
public AbstractReflectiveGet(int result, int objectRef, int memberRef) {
|
public AbstractReflectiveGet(int iindex, int result, int objectRef, int memberRef) {
|
||||||
super(objectRef, memberRef);
|
super(iindex, objectRef, memberRef);
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ import com.ibm.wala.ssa.SymbolTable;
|
||||||
public abstract class AbstractReflectivePut extends ReflectiveMemberAccess {
|
public abstract class AbstractReflectivePut extends ReflectiveMemberAccess {
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
public AbstractReflectivePut(int objectRef, int memberRef, int value) {
|
public AbstractReflectivePut(int iindex, int objectRef, int memberRef, int value) {
|
||||||
super(objectRef, memberRef);
|
super(iindex, objectRef, memberRef);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class AssignInstruction extends SSAUnaryOpInstruction {
|
||||||
* @param result
|
* @param result
|
||||||
* @param val
|
* @param val
|
||||||
*/
|
*/
|
||||||
public AssignInstruction(int result, int val) {
|
public AssignInstruction(int iindex, int result, int val) {
|
||||||
super(null, result, val);
|
super(iindex, null, result, val);
|
||||||
assert result != val;
|
assert result != val;
|
||||||
assert result != -1;
|
assert result != -1;
|
||||||
assert val != -1;
|
assert val != -1;
|
||||||
|
@ -43,7 +43,7 @@ public class AssignInstruction extends SSAUnaryOpInstruction {
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstInstructionFactory) insts)
|
return ((AstInstructionFactory) insts)
|
||||||
.AssignInstruction(defs == null ? getDef(0) : defs[0], uses == null ? getUse(0) : uses[0]);
|
.AssignInstruction(iindex, defs == null ? getDef(0) : defs[0], uses == null ? getUse(0) : uses[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -32,7 +32,8 @@ public class AstAssertInstruction extends SSAInstruction {
|
||||||
|
|
||||||
private final boolean fromSpecification;
|
private final boolean fromSpecification;
|
||||||
|
|
||||||
public AstAssertInstruction(int value, boolean fromSpecification) {
|
public AstAssertInstruction(int iindex, int value, boolean fromSpecification) {
|
||||||
|
super(iindex);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.fromSpecification = fromSpecification;
|
this.fromSpecification = fromSpecification;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +51,7 @@ public class AstAssertInstruction extends SSAInstruction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstInstructionFactory)insts).AssertInstruction(uses == null ? value : uses[0], fromSpecification);
|
return ((AstInstructionFactory)insts).AssertInstruction(iindex, uses == null ? value : uses[0], fromSpecification);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,13 +22,14 @@ import com.ibm.wala.util.debug.Assertions;
|
||||||
public class AstEchoInstruction extends SSAInstruction {
|
public class AstEchoInstruction extends SSAInstruction {
|
||||||
private final int[] rvals;
|
private final int[] rvals;
|
||||||
|
|
||||||
public AstEchoInstruction(int[] rvals) {
|
public AstEchoInstruction(int iindex, int[] rvals) {
|
||||||
|
super(iindex);
|
||||||
this.rvals = rvals;
|
this.rvals = rvals;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstInstructionFactory)insts).EchoInstruction(uses==null? rvals: uses);
|
return ((AstInstructionFactory)insts).EchoInstruction(iindex, uses==null? rvals: uses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,13 +26,13 @@ import com.ibm.wala.types.TypeReference;
|
||||||
*/
|
*/
|
||||||
public class AstGlobalRead extends SSAGetInstruction {
|
public class AstGlobalRead extends SSAGetInstruction {
|
||||||
|
|
||||||
public AstGlobalRead(int lhs, FieldReference global) {
|
public AstGlobalRead(int iindex, int lhs, FieldReference global) {
|
||||||
super(lhs, global);
|
super(iindex, lhs, global);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstInstructionFactory)insts).GlobalRead((defs==null)? getDef(): defs[0], getDeclaredField());
|
return ((AstInstructionFactory)insts).GlobalRead(iindex, (defs==null)? getDef(): defs[0], getDeclaredField());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,13 +26,13 @@ import com.ibm.wala.types.TypeReference;
|
||||||
*/
|
*/
|
||||||
public class AstGlobalWrite extends SSAPutInstruction {
|
public class AstGlobalWrite extends SSAPutInstruction {
|
||||||
|
|
||||||
public AstGlobalWrite(FieldReference global, int rhs) {
|
public AstGlobalWrite(int iindex, FieldReference global, int rhs) {
|
||||||
super(rhs, global);
|
super(iindex, rhs, global);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstInstructionFactory)insts).GlobalWrite(getDeclaredField(), (uses==null)? getVal(): uses[0]);
|
return ((AstInstructionFactory)insts).GlobalWrite(iindex, getDeclaredField(), (uses==null)? getVal(): uses[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,38 +17,38 @@ import com.ibm.wala.types.TypeReference;
|
||||||
|
|
||||||
public interface AstInstructionFactory extends SSAInstructionFactory {
|
public interface AstInstructionFactory extends SSAInstructionFactory {
|
||||||
|
|
||||||
AssignInstruction AssignInstruction(int result, int val);
|
AssignInstruction AssignInstruction(int iindex, int result, int val);
|
||||||
|
|
||||||
AstAssertInstruction AssertInstruction(int value, boolean fromSpecification);
|
AstAssertInstruction AssertInstruction(int iindex, int value, boolean fromSpecification);
|
||||||
|
|
||||||
AstEchoInstruction EchoInstruction(int[] rvals);
|
AstEchoInstruction EchoInstruction(int iindex, int[] rvals);
|
||||||
|
|
||||||
AstGlobalRead GlobalRead(int lhs, FieldReference global);
|
AstGlobalRead GlobalRead(int iindex, int lhs, FieldReference global);
|
||||||
|
|
||||||
AstGlobalWrite GlobalWrite(FieldReference global, int rhs);
|
AstGlobalWrite GlobalWrite(int iindex, FieldReference global, int rhs);
|
||||||
|
|
||||||
AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, int fieldVal, FieldReference fieldRef);
|
AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, int fieldVal, FieldReference fieldRef);
|
||||||
|
|
||||||
AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, FieldReference fieldRef);
|
AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, FieldReference fieldRef);
|
||||||
|
|
||||||
AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval, int fieldVal);
|
AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval, int fieldVal);
|
||||||
|
|
||||||
AstIsDefinedInstruction IsDefinedInstruction(int lval, int rval);
|
AstIsDefinedInstruction IsDefinedInstruction(int iindex, int lval, int rval);
|
||||||
|
|
||||||
AstLexicalRead LexicalRead(Access[] accesses);
|
AstLexicalRead LexicalRead(int iindex, Access[] accesses);
|
||||||
|
|
||||||
AstLexicalRead LexicalRead(Access access);
|
AstLexicalRead LexicalRead(int iindex, Access access);
|
||||||
|
|
||||||
AstLexicalRead LexicalRead(int lhs, String definer, String globalName, TypeReference type);
|
AstLexicalRead LexicalRead(int iindex, int lhs, String definer, String globalName, TypeReference type);
|
||||||
|
|
||||||
AstLexicalWrite LexicalWrite(Access[] accesses);
|
AstLexicalWrite LexicalWrite(int iindex, Access[] accesses);
|
||||||
|
|
||||||
AstLexicalWrite LexicalWrite(Access access);
|
AstLexicalWrite LexicalWrite(int iindex, Access access);
|
||||||
|
|
||||||
AstLexicalWrite LexicalWrite(String definer, String globalName, TypeReference type, int rhs);
|
AstLexicalWrite LexicalWrite(int iindex, String definer, String globalName, TypeReference type, int rhs);
|
||||||
|
|
||||||
EachElementGetInstruction EachElementGetInstruction(int lValue, int objectRef);
|
EachElementGetInstruction EachElementGetInstruction(int iindex, int lValue, int objectRef);
|
||||||
|
|
||||||
EachElementHasNextInstruction EachElementHasNextInstruction(int lValue, int objectRef);
|
EachElementHasNextInstruction EachElementHasNextInstruction(int iindex, int lValue, int objectRef);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,28 +49,32 @@ public class AstIsDefinedInstruction extends SSAInstruction {
|
||||||
/**
|
/**
|
||||||
* This constructor should only be used from {@link SSAInstruction#copyForSSA(SSAInstructionFactory, int[], int[])}
|
* This constructor should only be used from {@link SSAInstruction#copyForSSA(SSAInstructionFactory, int[], int[])}
|
||||||
*/
|
*/
|
||||||
public AstIsDefinedInstruction(int lval, int rval, int fieldVal, FieldReference fieldRef) {
|
public AstIsDefinedInstruction(int iindex, int lval, int rval, int fieldVal, FieldReference fieldRef) {
|
||||||
|
super(iindex);
|
||||||
this.lval = lval;
|
this.lval = lval;
|
||||||
this.rval = rval;
|
this.rval = rval;
|
||||||
this.fieldVal = fieldVal;
|
this.fieldVal = fieldVal;
|
||||||
this.fieldRef = fieldRef;
|
this.fieldRef = fieldRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstIsDefinedInstruction(int lval, int rval, FieldReference fieldRef) {
|
public AstIsDefinedInstruction(int iindex, int lval, int rval, FieldReference fieldRef) {
|
||||||
|
super(iindex);
|
||||||
this.lval = lval;
|
this.lval = lval;
|
||||||
this.rval = rval;
|
this.rval = rval;
|
||||||
this.fieldVal = -1;
|
this.fieldVal = -1;
|
||||||
this.fieldRef = fieldRef;
|
this.fieldRef = fieldRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstIsDefinedInstruction(int lval, int rval, int fieldVal) {
|
public AstIsDefinedInstruction(int iindex, int lval, int rval, int fieldVal) {
|
||||||
|
super(iindex);
|
||||||
this.lval = lval;
|
this.lval = lval;
|
||||||
this.rval = rval;
|
this.rval = rval;
|
||||||
this.fieldVal = fieldVal;
|
this.fieldVal = fieldVal;
|
||||||
this.fieldRef = null;
|
this.fieldRef = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstIsDefinedInstruction(int lval, int rval) {
|
public AstIsDefinedInstruction(int iindex, int lval, int rval) {
|
||||||
|
super(iindex);
|
||||||
this.lval = lval;
|
this.lval = lval;
|
||||||
this.rval = rval;
|
this.rval = rval;
|
||||||
this.fieldVal = -1;
|
this.fieldVal = -1;
|
||||||
|
@ -81,7 +85,7 @@ public class AstIsDefinedInstruction extends SSAInstruction {
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
assert fieldVal == -1 || fieldRef == null;
|
assert fieldVal == -1 || fieldRef == null;
|
||||||
|
|
||||||
return ((AstInstructionFactory) insts).IsDefinedInstruction((defs == null) ? lval : defs[0], (uses == null) ? rval : uses[0],
|
return ((AstInstructionFactory) insts).IsDefinedInstruction(iindex, (defs == null) ? lval : defs[0], (uses == null) ? rval : uses[0],
|
||||||
(uses == null || fieldVal == -1) ? fieldVal : uses[1], fieldRef);
|
(uses == null || fieldVal == -1) ? fieldVal : uses[1], fieldRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,8 @@ public abstract class AstLexicalAccess extends SSAInstruction {
|
||||||
|
|
||||||
private Access[] accesses;
|
private Access[] accesses;
|
||||||
|
|
||||||
AstLexicalAccess(Access[] accesses) {
|
AstLexicalAccess(int iindex, Access[] accesses) {
|
||||||
|
super(iindex);
|
||||||
setAccesses( accesses );
|
setAccesses( accesses );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,22 +25,22 @@ import com.ibm.wala.types.TypeReference;
|
||||||
*/
|
*/
|
||||||
public class AstLexicalRead extends AstLexicalAccess {
|
public class AstLexicalRead extends AstLexicalAccess {
|
||||||
|
|
||||||
public AstLexicalRead(Access[] accesses) {
|
public AstLexicalRead(int iindex, Access[] accesses) {
|
||||||
super(accesses);
|
super(iindex, accesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstLexicalRead(Access access) {
|
public AstLexicalRead(int iindex, Access access) {
|
||||||
this(new Access[] { access });
|
this(iindex, new Access[] { access });
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstLexicalRead(int lhs, String definer, String globalName, TypeReference type) {
|
public AstLexicalRead(int iindex, int lhs, String definer, String globalName, TypeReference type) {
|
||||||
this(new Access(globalName, definer, type, lhs));
|
this(iindex, new Access(globalName, definer, type, lhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
if (defs == null) {
|
if (defs == null) {
|
||||||
return new AstLexicalRead(getAccesses());
|
return new AstLexicalRead(iindex, getAccesses());
|
||||||
} else {
|
} else {
|
||||||
Access[] accesses = new Access[getAccessCount()];
|
Access[] accesses = new Access[getAccessCount()];
|
||||||
for (int i = 0; i < accesses.length; i++) {
|
for (int i = 0; i < accesses.length; i++) {
|
||||||
|
@ -48,7 +48,7 @@ public class AstLexicalRead extends AstLexicalAccess {
|
||||||
accesses[i] = new Access(oldAccess.variableName, oldAccess.variableDefiner, oldAccess.type, defs[i]);
|
accesses[i] = new Access(oldAccess.variableName, oldAccess.variableDefiner, oldAccess.type, defs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((AstInstructionFactory)insts).LexicalRead(accesses);
|
return ((AstInstructionFactory)insts).LexicalRead(iindex, accesses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,22 +25,22 @@ import com.ibm.wala.types.TypeReference;
|
||||||
*/
|
*/
|
||||||
public class AstLexicalWrite extends AstLexicalAccess {
|
public class AstLexicalWrite extends AstLexicalAccess {
|
||||||
|
|
||||||
public AstLexicalWrite(String definer, String globalName, TypeReference type, int rhs) {
|
public AstLexicalWrite(int iindex, String definer, String globalName, TypeReference type, int rhs) {
|
||||||
this(new Access(globalName, definer, type, rhs));
|
this(iindex, new Access(globalName, definer, type, rhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstLexicalWrite(Access access) {
|
public AstLexicalWrite(int iindex, Access access) {
|
||||||
this(new Access[] { access });
|
this(iindex, new Access[] { access });
|
||||||
}
|
}
|
||||||
|
|
||||||
public AstLexicalWrite(Access[] accesses) {
|
public AstLexicalWrite(int iindex, Access[] accesses) {
|
||||||
super(accesses);
|
super(iindex, accesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
if (uses == null) {
|
if (uses == null) {
|
||||||
return new AstLexicalWrite(getAccesses());
|
return new AstLexicalWrite(iindex, getAccesses());
|
||||||
} else {
|
} else {
|
||||||
Access[] accesses = new Access[getAccessCount()];
|
Access[] accesses = new Access[getAccessCount()];
|
||||||
for (int i = 0; i < accesses.length; i++) {
|
for (int i = 0; i < accesses.length; i++) {
|
||||||
|
@ -48,7 +48,7 @@ public class AstLexicalWrite extends AstLexicalAccess {
|
||||||
accesses[i] = new Access(oldAccess.variableName, oldAccess.variableDefiner, oldAccess.type, uses[i]);
|
accesses[i] = new Access(oldAccess.variableName, oldAccess.variableDefiner, oldAccess.type, uses[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((AstInstructionFactory)insts).LexicalWrite(accesses);
|
return ((AstInstructionFactory)insts).LexicalWrite(iindex, accesses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,13 @@ import com.ibm.wala.types.TypeReference;
|
||||||
*/
|
*/
|
||||||
public class EachElementGetInstruction extends SSAAbstractUnaryInstruction {
|
public class EachElementGetInstruction extends SSAAbstractUnaryInstruction {
|
||||||
|
|
||||||
public EachElementGetInstruction(int lValue, int objectRef) {
|
public EachElementGetInstruction(int iindex, int lValue, int objectRef) {
|
||||||
super(lValue, objectRef);
|
super(iindex, lValue, objectRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstInstructionFactory)insts).EachElementGetInstruction((defs == null) ? getDef(0) : defs[0], (uses == null) ? getUse(0) : uses[0]);
|
return ((AstInstructionFactory)insts).EachElementGetInstruction(iindex, (defs == null) ? getDef(0) : defs[0], (uses == null) ? getUse(0) : uses[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,13 +31,13 @@ import com.ibm.wala.types.TypeReference;
|
||||||
*/
|
*/
|
||||||
public class EachElementHasNextInstruction extends SSAAbstractUnaryInstruction {
|
public class EachElementHasNextInstruction extends SSAAbstractUnaryInstruction {
|
||||||
|
|
||||||
public EachElementHasNextInstruction(int lValue, int objectRef) {
|
public EachElementHasNextInstruction(int iindex, int lValue, int objectRef) {
|
||||||
super(lValue, objectRef);
|
super(iindex, lValue, objectRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
||||||
return ((AstInstructionFactory)insts).EachElementHasNextInstruction((defs == null) ? getDef(0) : defs[0], (uses == null) ? getUse(0) : uses[0]);
|
return ((AstInstructionFactory)insts).EachElementHasNextInstruction(iindex, (defs == null) ? getDef(0) : defs[0], (uses == null) ? getUse(0) : uses[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,13 +34,13 @@ public abstract class FixedParametersInvokeInstruction
|
||||||
*/
|
*/
|
||||||
private final int[] params;
|
private final int[] params;
|
||||||
|
|
||||||
public FixedParametersInvokeInstruction(int results[], int[] params, int exception, CallSiteReference site) {
|
public FixedParametersInvokeInstruction(int iindex, int results[], int[] params, int exception, CallSiteReference site) {
|
||||||
super(results, exception, site);
|
super(iindex, results, exception, site);
|
||||||
this.params = params;
|
this.params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FixedParametersInvokeInstruction(int result, int[] params, int exception, CallSiteReference site) {
|
public FixedParametersInvokeInstruction(int iindex, int result, int[] params, int exception, CallSiteReference site) {
|
||||||
this(new int[]{result}, params, exception, site);
|
this(iindex, new int[]{result}, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,8 +49,8 @@ public abstract class FixedParametersInvokeInstruction
|
||||||
* @param exception
|
* @param exception
|
||||||
* @param site
|
* @param site
|
||||||
*/
|
*/
|
||||||
public FixedParametersInvokeInstruction(int[] params, int exception, CallSiteReference site) {
|
public FixedParametersInvokeInstruction(int iindex, int[] params, int exception, CallSiteReference site) {
|
||||||
this(null, params, exception, site);
|
this(iindex, null, params, exception, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract SSAInstruction copyInstruction(SSAInstructionFactory insts, int result[], int[] params, int exception);
|
protected abstract SSAInstruction copyInstruction(SSAInstructionFactory insts, int result[], int[] params, int exception);
|
||||||
|
|
|
@ -18,8 +18,8 @@ public abstract class MultiReturnValueInvokeInstruction
|
||||||
{
|
{
|
||||||
protected final int results[];
|
protected final int results[];
|
||||||
|
|
||||||
protected MultiReturnValueInvokeInstruction(int results[], int exception, CallSiteReference site) {
|
protected MultiReturnValueInvokeInstruction(int iindex, int results[], int exception, CallSiteReference site) {
|
||||||
super(exception, site);
|
super(iindex, exception, site);
|
||||||
this.results = results;
|
this.results = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue