delete failed tag attempt

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@493 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2006-11-22 18:05:37 +00:00
parent 68270cad6f
commit 2e084319f2
1001 changed files with 0 additions and 150764 deletions

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="dat"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.core.tests</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>

View File

@ -1,62 +0,0 @@
#Fri Nov 17 09:37:12 EST 2006
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -1,3 +0,0 @@
#Tue Oct 03 22:52:44 EDT 2006
eclipse.preferences.version=1
internal.default.compliance=default

View File

@ -1,17 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA Tests Plug-in
Bundle-SymbolicName: com.ibm.wala.core.tests
Bundle-Version: 1.0.0
Bundle-Vendor: IBM
Bundle-Localization: plugin
Require-Bundle: com.ibm.wala.core,
org.junit,
org.eclipse.jface
Export-Package: com.ibm.wala.core.tests.basic,
com.ibm.wala.core.tests.callGraph,
com.ibm.wala.core.tests.cha,
com.ibm.wala.core.tests.ir,
com.ibm.wala.core.tests.util,
com.ibm.wala.examples.drivers,
com.ibm.wala.examples.properties

View File

@ -1,5 +0,0 @@
source.. = src/,\
dat/
output.. = bin/
bin.includes = META-INF/,\
.

View File

@ -1,271 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="com.ibm.wala.core.tests" default="build.jars" basedir=".">
<property name="basews" value="${ws}"/>
<property name="baseos" value="${os}"/>
<property name="basearch" value="${arch}"/>
<property name="basenl" value="${nl}"/>
<!-- Compiler settings. -->
<property name="javacFailOnError" value="false"/>
<property name="javacDebugInfo" value="on"/>
<property name="javacVerbose" value="false"/>
<property name="logExtension" value=".log"/>
<property name="compilerArg" value=""/>
<property name="javacSource" value="1.5"/>
<property name="javacTarget" value="1.5"/>
<path id="path_bootclasspath">
<fileset dir="${java.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<property name="bootclasspath" refid="path_bootclasspath"/>
<property name="bundleJavacSource" value="${javacSource}"/>
<property name="bundleJavacTarget" value="${javacTarget}"/>
<property name="bundleBootClasspath" value="${bootclasspath}"/>
<target name="buildAndRun" depends="build.update.jar,runtests">
</target>
<!--
===================================================================
Runs unit tests
===================================================================
-->
<target name="runtests" depends="build.update.jar" description="-> runs unit tests">
<!-- fork=true is required to enable assertions in the tests' JVM. -->
<junit fork="true" printsummary="yes" haltonerror="no" failureproperty="junit_test_failed">
<!-- Enable assertions - required by certain tests. -->
<jvmarg value="-ea" />
<jvmarg value="-Xmx1000M" />
<classpath>
<pathelement path="bin/"/>
<pathelement path="@dot/"/>
<pathelement path="../com.ibm.wala.core.testdata/bin/"/>
<pathelement path="../com.ibm.wala.core.testdata/@dot/"/>
<pathelement path="../com.ibm.wala.core/bin/"/>
<pathelement path="../com.ibm.wala.core/@dot"/>
<pathelement path="../com.ibm.wala.emf/bin/"/>
<pathelement path="../com.ibm.wala.emf/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime_3.2.0.v20060603.jar" />
<pathelement path="${eclipse.root}/plugins/org.eclipse.osgi_3.2.0.v20060601.jar" />
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.common_3.2.0.v20060603.jar" />
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.jobs_3.2.0.v20060603.jar" />
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/runtime_registry_compatibility.jar" />
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.registry_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/resolver.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/xercesImpl.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/xml-apis.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.preferences_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.contenttype_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.ecore_2.2.0.v200606271057.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.common_2.2.0.v200606271057.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources.compatibility_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources.win32_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.update.configurator_3.2.0.v20060605.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.ant.core_3.1.100.v20060531.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.variables_3.1.100.v20060605.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.expressions_3.2.0.v20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.filesystem_1.0.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.filesystem.win32.x86_1.0.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.ecore.xmi_2.2.0.v200606271057.jar"/>
<pathelement path="../com.ibm.wala.shrike/bin/"/>
<pathelement path="../com.ibm.wala.shrike/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.jface_3.2.0.I20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.swt_3.2.0.v3232o.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.v3232m.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.commands_3.2.0.I20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.jdt.core_3.2.0.v_671.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.text_3.2.0.v20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/com.ibm.icu_3.4.4.1.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.team.core_3.2.0.I200606051140.jar"/>
<pathelement path="${eclipse.root}/plugins/org.junit_3.8.1/junit.jar"/>
</classpath>
<formatter type="xml" />
<batchtest todir="${basedir}/output" fork="true">
<fileset dir="${basedir}/src">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<fail if="junit_test_failed" message="One or more JUnit tests failed"/>
</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.tests">
<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}/output"/>
<property name="eclipse.root" value="c:/eclipse"/>
</target>
<target name="properties" if="eclipse.running">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</target>
<target name="build.update.jar" depends="init" description="Build the plug-in: com.ibm.wala.core.tests for an update site.">
<delete dir="@dot"/>
<delete dir="${temp.folder}"/>
<mkdir dir="${temp.folder}"/>
<delete dir="${plugin.destination}"/>
<mkdir dir="${plugin.destination}"/>
<antcall target="build.jars"/>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/"/>
</antcall>
<zip destfile="${plugin.destination}/com.ibm.wala.core.tests_1.0.0.jar" basedir="${temp.folder}/com.ibm.wala.core.tests_1.0.0" filesonly="false" whenempty="skip" update="false"/>
<delete dir="${temp.folder}"/>
</target>
<target name="@dot" depends="init" description="Create jar: com.ibm.wala.core.tests @dot.">
<delete dir="${temp.folder}/@dot.bin"/>
<mkdir dir="${temp.folder}/@dot.bin"/>
<path id="@dot.classpath">
<pathelement path="../com.ibm.wala.core/bin/"/>
<pathelement path="../com.ibm.wala.core/@dot"/>
<pathelement path="../com.ibm.wala.emf/bin/"/>
<pathelement path="../com.ibm.wala.emf/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.osgi_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.common_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.jobs_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/runtime_registry_compatibility.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.registry_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/resolver.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/xercesImpl.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/xml-apis.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.preferences_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.contenttype_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.ecore_2.2.0.v200606271057.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.common_2.2.0.v200606271057.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources.compatibility_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources.win32_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.update.configurator_3.2.0.v20060605.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.ant.core_3.1.100.v20060531.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.variables_3.1.100.v20060605.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.expressions_3.2.0.v20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.filesystem_1.0.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.filesystem.win32.x86_1.0.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.ecore.xmi_2.2.0.v200606271057.jar"/>
<pathelement path="../com.ibm.wala.shrike/bin/"/>
<pathelement path="../com.ibm.wala.shrike/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.jface_3.2.0.I20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.swt_3.2.0.v3232o.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.v3232m.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.commands_3.2.0.I20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.jdt.core_3.2.0.v_671.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.text_3.2.0.v20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/com.ibm.icu_3.4.4.1.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.team.core_3.2.0.I200606051140.jar"/>
<pathelement path="${eclipse.root}/plugins/org.junit_3.8.1/junit.jar"/>
</path>
<!-- compile the source code -->
<javac destdir="${temp.folder}/@dot.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}" >
<compilerarg line="${compilerArg}" compiler="${build.compiler}"/>
<classpath refid="@dot.classpath" />
<src path="src/" />
<compilerarg value="@${basedir}/javaCompiler...args" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<compilerarg line="-log '${temp.folder}/@dot.bin${logExtension}'" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</javac>
<!-- Copy necessary resources -->
<copy todir="${temp.folder}/@dot.bin" failonerror="true" overwrite="false">
<fileset dir="src/" excludes="**/*.java, **/package.htm*" />
<fileset dir="dat/" excludes="**/*.java, **/package.htm*" />
</copy>
<mkdir dir="${build.result.folder}"/>
<copy todir="${build.result.folder}/@dot" failonerror="true" overwrite="false">
<fileset dir="${temp.folder}/@dot.bin" />
</copy>
<delete dir="${temp.folder}/@dot.bin"/>
</target>
<target name="src.zip" depends="init" unless="src.zip">
<mkdir dir="${build.result.folder}"/>
<zip destfile="${build.result.folder}/src.zip" filesonly="false" whenempty="skip" update="false">
<fileset dir="src/" includes="**/*.java" />
</zip>
</target>
<target name="build.jars" depends="init" description="Build all the jars for the plug-in: com.ibm.wala.core.tests.">
<available property="@dot" file="${build.result.folder}/@dot"/>
<antcall target="@dot"/>
</target>
<target name="build.sources" depends="init">
<available property="src.zip" file="${build.result.folder}/src.zip"/>
<antcall target="src.zip"/>
</target>
<target name="gather.bin.parts" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/com.ibm.wala.core.tests_1.0.0"/>
<copy todir="${destination.temp.folder}/com.ibm.wala.core.tests_1.0.0" failonerror="true" overwrite="false">
<fileset dir="${build.result.folder}/@dot" includes="**" />
</copy>
<copy todir="${destination.temp.folder}/com.ibm.wala.core.tests_1.0.0" failonerror="true" overwrite="false">
<fileset dir="${basedir}" includes="META-INF/" />
</copy>
</target>
<target name="build.zips" depends="init">
</target>
<target name="gather.sources" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/com.ibm.wala.core.tests_1.0.0"/>
<copy file="${build.result.folder}/src.zip" todir="${destination.temp.folder}/com.ibm.wala.core.tests_1.0.0" failonerror="false" overwrite="false"/>
</target>
<target name="gather.logs" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/com.ibm.wala.core.tests_1.0.0"/>
<copy file="${temp.folder}/@dot.bin${logExtension}" todir="${destination.temp.folder}/com.ibm.wala.core.tests_1.0.0" failonerror="false" overwrite="false"/>
</target>
<target name="clean" depends="init" description="Clean the plug-in: com.ibm.wala.core.tests of all the zips, jars and logs created.">
<delete dir="${build.result.folder}/@dot"/>
<delete file="${build.result.folder}/src.zip"/>
<delete file="${plugin.destination}/com.ibm.wala.core.tests_1.0.0.jar"/>
<delete file="${plugin.destination}/com.ibm.wala.core.tests_1.0.0.zip"/>
<delete dir="${temp.folder}"/>
</target>
<target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
<eclipse.convertPath fileSystemPath="C:/temp/walaWorkspace/com.ibm.wala.core.tests" property="resourcePath"/>
<eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
</target>
<target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: com.ibm.wala.core.tests.">
<delete dir="${temp.folder}"/>
<mkdir dir="${temp.folder}"/>
<antcall target="build.jars"/>
<antcall target="build.sources"/>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/"/>
</antcall>
<antcall target="gather.sources">
<param name="destination.temp.folder" value="${temp.folder}/"/>
</antcall>
<delete>
<fileset dir="${temp.folder}" includes="**/*.bin${logExtension}" />
</delete>
<zip destfile="${plugin.destination}/com.ibm.wala.core.tests_1.0.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
<delete dir="${temp.folder}"/>
</target>
</project>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="ASCII"?>
<com.ibm.wala.common:EContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.ibm.wala.common="http:///com/ibm/wala/wala.ecore.common" xmlns:com.ibm.wala.regex="http:///com/ibm/wala/wala.ecore.regex">
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/awt\/.*"/>
</com.ibm.wala.common:EContainer>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.wala.java.scope:EJavaAnalysisScope xmlns:com.ibm.wala.java.scope="http:///com/ibm/wala/wala.ecore.java.scope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<loaders loaderName="Primordial">
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule"/>
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule" id="primordial_jar_model"/>
</loaders>
<loaders loaderName="Application">
<modules url="JLex.jar" xsi:type="com.ibm.wala.java.scope:EJarFile"/>
</loaders>
</com.ibm.wala.java.scope:EJavaAnalysisScope>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.wala.java.scope:EJavaAnalysisScope xmlns:com.ibm.wala.java.scope="http:///com/ibm/wala/wala.ecore.java.scope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<loaders loaderName="Primordial">
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule"/>
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule" id="primordial_jar_model"/>
</loaders>
<loaders loaderName="Application">
<modules url="bcel-5.2.jar" xsi:type="com.ibm.wala.java.scope:EJarFile"/>
</loaders>
</com.ibm.wala.java.scope:EJavaAnalysisScope>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.wala.java.scope:EJavaAnalysisScope xmlns:com.ibm.wala.java.scope="http:///com/ibm/wala/wala.ecore.java.scope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<loaders loaderName="Primordial">
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule"/>
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule" id="primordial_jar_model"/>
</loaders>
<loaders loaderName="Application">
<modules url="hello/Hello.class" xsi:type="com.ibm.wala.java.scope:EClassFile"/>
<modules url="hello/Hello.java" xsi:type="com.ibm.wala.java.scope:ESourceFile"/>
</loaders>
</com.ibm.wala.java.scope:EJavaAnalysisScope>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.wala.java.scope:EJavaAnalysisScope xmlns:com.ibm.wala.java.scope="http:///com/ibm/wala/wala.ecore.java.scope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<loaders loaderName="Primordial">
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule"/>
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule" id="primordial_jar_model"/>
</loaders>
<loaders loaderName="Application">
<modules url="java-cup-11a.jar" xsi:type="com.ibm.wala.java.scope:EJarFile"/>
</loaders>
</com.ibm.wala.java.scope:EJavaAnalysisScope>

View File

@ -1,30 +0,0 @@
###############################################################################
# WALA Examples property file
# This file defines the default settings for the WALA examples
###############################################################################
################# Mandatory settings without default value ####################
################### Mandatory settings with default value ######################
############################ Optional settings ################################
### These are needed to run various individual examples
##### Ghostview executable
# Path to the ghostview executable
# For instance, on a windows OS it's typically something like C:/Progra~1/Ghostgum/gsview/gsview32.exe
# Default value: none
# Info: Must be absolute path
#####
#ghostview_exe = Your location
##### DOT executable
# Path to the AT&T Graphview DOT executable
# For instance, on a windows OS it's typically something like C:/Progra~1/ATT/Graphviz/bin/dot.exe
# Default value: none
# Info: Must be absolute path
#####
#dot_exe = Your location

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.wala.java.scope:EJavaAnalysisScope xmlns:com.ibm.wala.java.scope="http:///com/ibm/wala/wala.ecore.java.scope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<loaders loaderName="Primordial">
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule"/>
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule" id="primordial_jar_model"/>
</loaders>
<loaders loaderName="Application">
<modules url="com.ibm.wala.core.testdata_1.0.0.jar" xsi:type="com.ibm.wala.java.scope:EJarFile"/>
</loaders>
</com.ibm.wala.java.scope:EJavaAnalysisScope>

View File

@ -1,42 +0,0 @@
#ADAPTER#ACCESS#com.ibm.wala.core/bin/[+com/ibm/wala/analysis/pointers/*;+com/ibm/wala/analysis/reflection/*;+com/ibm/wala/analysis/stackMachine/*;+com/ibm/wala/analysis/typeInference/*;+com/ibm/wala/cfg/*;+com/ibm/wala/cfg/cdg/*;+com/ibm/wala/classLoader/*;+com/ibm/wala/client/*;+com/ibm/wala/client/impl/*;+com/ibm/wala/core/plugin/*;+com/ibm/wala/dataflow/IFDS/*;+com/ibm/wala/dataflow/graph/*;+com/ibm/wala/dataflow/ssa/*;+com/ibm/wala/emf/wrappers/*;+com/ibm/wala/escape/*;+com/ibm/wala/fixedpoint/impl/*;+com/ibm/wala/fixpoint/*;+com/ibm/wala/ipa/callgraph/*;+com/ibm/wala/ipa/callgraph/impl/*;+com/ibm/wala/ipa/callgraph/propagation/*;+com/ibm/wala/ipa/callgraph/propagation/cfa/*;+com/ibm/wala/ipa/callgraph/propagation/rta/*;+com/ibm/wala/ipa/cfg/*;+com/ibm/wala/ipa/cha/*;+com/ibm/wala/ipa/summaries/*;+com/ibm/wala/model/*;+com/ibm/wala/model/java/lang/*;+com/ibm/wala/properties/*;+com/ibm/wala/ssa/*;+com/ibm/wala/ssa/analysis/*;+com/ibm/wala/types/*;+com/ibm/wala/util/*;+com/ibm/wala/util/bytecode/*;+com/ibm/wala/util/collections/*;+com/ibm/wala/util/config/*;+com/ibm/wala/util/debug/*;+com/ibm/wala/util/graph/*;+com/ibm/wala/util/graph/impl/*;+com/ibm/wala/util/graph/traverse/*;+com/ibm/wala/util/heapTrace/*;+com/ibm/wala/util/intertionalization/*;+com/ibm/wala/util/intset/*;+com/ibm/wala/util/io/*;+com/ibm/wala/util/logging/*;+com/ibm/wala/util/math/*;+com/ibm/wala/util/perf/*;+com/ibm/wala/util/properties/*;+com/ibm/wala/util/properties/impl/*;+com/ibm/wala/util/warnings/*;+com/ibm/wala/viz/*;?**/*]
#ADAPTER#ACCESS#com.ibm.wala.core/@dot[+com/ibm/wala/analysis/pointers/*;+com/ibm/wala/analysis/reflection/*;+com/ibm/wala/analysis/stackMachine/*;+com/ibm/wala/analysis/typeInference/*;+com/ibm/wala/cfg/*;+com/ibm/wala/cfg/cdg/*;+com/ibm/wala/classLoader/*;+com/ibm/wala/client/*;+com/ibm/wala/client/impl/*;+com/ibm/wala/core/plugin/*;+com/ibm/wala/dataflow/IFDS/*;+com/ibm/wala/dataflow/graph/*;+com/ibm/wala/dataflow/ssa/*;+com/ibm/wala/emf/wrappers/*;+com/ibm/wala/escape/*;+com/ibm/wala/fixedpoint/impl/*;+com/ibm/wala/fixpoint/*;+com/ibm/wala/ipa/callgraph/*;+com/ibm/wala/ipa/callgraph/impl/*;+com/ibm/wala/ipa/callgraph/propagation/*;+com/ibm/wala/ipa/callgraph/propagation/cfa/*;+com/ibm/wala/ipa/callgraph/propagation/rta/*;+com/ibm/wala/ipa/cfg/*;+com/ibm/wala/ipa/cha/*;+com/ibm/wala/ipa/summaries/*;+com/ibm/wala/model/*;+com/ibm/wala/model/java/lang/*;+com/ibm/wala/properties/*;+com/ibm/wala/ssa/*;+com/ibm/wala/ssa/analysis/*;+com/ibm/wala/types/*;+com/ibm/wala/util/*;+com/ibm/wala/util/bytecode/*;+com/ibm/wala/util/collections/*;+com/ibm/wala/util/config/*;+com/ibm/wala/util/debug/*;+com/ibm/wala/util/graph/*;+com/ibm/wala/util/graph/impl/*;+com/ibm/wala/util/graph/traverse/*;+com/ibm/wala/util/heapTrace/*;+com/ibm/wala/util/intertionalization/*;+com/ibm/wala/util/intset/*;+com/ibm/wala/util/io/*;+com/ibm/wala/util/logging/*;+com/ibm/wala/util/math/*;+com/ibm/wala/util/perf/*;+com/ibm/wala/util/properties/*;+com/ibm/wala/util/properties/impl/*;+com/ibm/wala/util/warnings/*;+com/ibm/wala/viz/*;?**/*]
#ADAPTER#ACCESS#com.ibm.wala.emf/bin/[+com/ibm/wala/ecore/common/*;+com/ibm/wala/ecore/common/impl/*;+com/ibm/wala/ecore/common/util/*;+com/ibm/wala/ecore/graph/*;+com/ibm/wala/ecore/graph/impl/*;+com/ibm/wala/ecore/graph/util/*;+com/ibm/wala/ecore/j2ee/scope/*;+com/ibm/wala/ecore/j2ee/scope/impl/*;+com/ibm/wala/ecore/j2ee/scope/util/*;+com/ibm/wala/ecore/java/*;+com/ibm/wala/ecore/java/callGraph/*;+com/ibm/wala/ecore/java/callGraph/impl/*;+com/ibm/wala/ecore/java/callGraph/util/*;+com/ibm/wala/ecore/java/impl/*;+com/ibm/wala/ecore/java/pointerAnalysis/*;+com/ibm/wala/ecore/java/pointerAnalysis/impl/*;+com/ibm/wala/ecore/java/pointerAnalysis/util/*;+com/ibm/wala/ecore/java/scope/*;+com/ibm/wala/ecore/java/scope/impl/*;+com/ibm/wala/ecore/java/scope/util/*;+com/ibm/wala/ecore/java/util/*;+com/ibm/wala/ecore/perf/*;+com/ibm/wala/ecore/perf/impl/*;+com/ibm/wala/ecore/perf/util/*;+com/ibm/wala/ecore/regex/*;+com/ibm/wala/ecore/regex/impl/*;+com/ibm/wala/ecore/regex/util/*;?**/*]
#ADAPTER#ACCESS#com.ibm.wala.emf/@dot[+com/ibm/wala/ecore/common/*;+com/ibm/wala/ecore/common/impl/*;+com/ibm/wala/ecore/common/util/*;+com/ibm/wala/ecore/graph/*;+com/ibm/wala/ecore/graph/impl/*;+com/ibm/wala/ecore/graph/util/*;+com/ibm/wala/ecore/j2ee/scope/*;+com/ibm/wala/ecore/j2ee/scope/impl/*;+com/ibm/wala/ecore/j2ee/scope/util/*;+com/ibm/wala/ecore/java/*;+com/ibm/wala/ecore/java/callGraph/*;+com/ibm/wala/ecore/java/callGraph/impl/*;+com/ibm/wala/ecore/java/callGraph/util/*;+com/ibm/wala/ecore/java/impl/*;+com/ibm/wala/ecore/java/pointerAnalysis/*;+com/ibm/wala/ecore/java/pointerAnalysis/impl/*;+com/ibm/wala/ecore/java/pointerAnalysis/util/*;+com/ibm/wala/ecore/java/scope/*;+com/ibm/wala/ecore/java/scope/impl/*;+com/ibm/wala/ecore/java/scope/util/*;+com/ibm/wala/ecore/java/util/*;+com/ibm/wala/ecore/perf/*;+com/ibm/wala/ecore/perf/impl/*;+com/ibm/wala/ecore/perf/util/*;+com/ibm/wala/ecore/regex/*;+com/ibm/wala/ecore/regex/impl/*;+com/ibm/wala/ecore/regex/util/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime_3.2.0.v20060603.jar[~org/eclipse/core/internal/preferences/legacy/*;~org/eclipse/core/internal/runtime/*;+org/eclipse/core/runtime/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.osgi_3.2.0.v20060601.jar[+org/eclipse/osgi/event/*;+org/eclipse/osgi/framework/console/*;+org/eclipse/osgi/framework/eventmgr/*;+org/eclipse/osgi/framework/log/*;+org/eclipse/osgi/service/datalocation/*;+org/eclipse/osgi/service/debug/*;+org/eclipse/osgi/service/environment/*;+org/eclipse/osgi/service/localization/*;+org/eclipse/osgi/service/pluginconversion/*;+org/eclipse/osgi/service/resolver/*;+org/eclipse/osgi/service/runnable/*;+org/eclipse/osgi/service/urlconversion/*;+org/eclipse/osgi/storagemanager/*;+org/eclipse/osgi/util/*;+org/osgi/framework/*;+org/osgi/service/condpermadmin/*;+org/osgi/service/packageadmin/*;+org/osgi/service/permissionadmin/*;+org/osgi/service/startlevel/*;+org/osgi/service/url/*;+org/osgi/util/tracker/*;~org/eclipse/core/runtime/adaptor/*;~org/eclipse/core/runtime/internal/adaptor/*;~org/eclipse/core/runtime/internal/stats/*;~org/eclipse/osgi/baseadaptor/*;~org/eclipse/osgi/baseadaptor/bundlefile/*;~org/eclipse/osgi/baseadaptor/hooks/*;~org/eclipse/osgi/baseadaptor/loader/*;~org/eclipse/osgi/framework/adaptor/*;~org/eclipse/osgi/framework/debug/*;~org/eclipse/osgi/framework/internal/core/*;~org/eclipse/osgi/framework/internal/protocol/*;~org/eclipse/osgi/framework/internal/protocol/bundleentry/*;~org/eclipse/osgi/framework/internal/protocol/bundleresource/*;~org/eclipse/osgi/framework/internal/protocol/reference/*;~org/eclipse/osgi/framework/internal/reliablefile/*;~org/eclipse/osgi/framework/launcher/*;~org/eclipse/osgi/framework/util/*;~org/eclipse/osgi/internal/baseadaptor/*;~org/eclipse/osgi/internal/module/*;~org/eclipse/osgi/internal/profile/*;~org/eclipse/osgi/internal/resolver/*;~org/eclipse/osgi/internal/verifier/*;~org/eclipse/osgi/internal/provisional/verifier/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.equinox.common_3.2.0.v20060603.jar[~org/eclipse/core/internal/runtime/*;~org/eclipse/core/internal/boot/*;+org/eclipse/core/runtime/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.jobs_3.2.0.v20060603.jar[~org/eclipse/core/internal/jobs/*;+org/eclipse/core/runtime/jobs/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/runtime_registry_compatibility.jar[~org/eclipse/core/internal/registry/*;~org/eclipse/core/internal/registry/osgi/*;~org/eclipse/core/internal/registry/spi/*;+org/eclipse/core/runtime/*;+org/eclipse/core/runtime/dynamichelpers/*;+org/eclipse/core/runtime/spi/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603[~org/eclipse/core/internal/registry/*;~org/eclipse/core/internal/registry/osgi/*;~org/eclipse/core/internal/registry/spi/*;+org/eclipse/core/runtime/*;+org/eclipse/core/runtime/dynamichelpers/*;+org/eclipse/core/runtime/spi/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.equinox.registry_3.2.0.v20060601.jar[~org/eclipse/core/internal/registry/*;~org/eclipse/core/internal/registry/osgi/*;~org/eclipse/core/internal/registry/spi/*;+org/eclipse/core/runtime/*;+org/eclipse/core/runtime/dynamichelpers/*;+org/eclipse/core/runtime/spi/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.apache.xerces_2.8.0.v200606131651/resolver.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.apache.xerces_2.8.0.v200606131651/xercesImpl.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.apache.xerces_2.8.0.v200606131651/xml-apis.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.equinox.preferences_3.2.0.v20060601.jar[~org/eclipse/core/internal/preferences/*;~org/eclipse/core/internal/preferences/exchange/*;+org/eclipse/core/runtime/preferences/*;+org/osgi/service/prefs/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/@dot[~org/eclipse/core/internal/registry/*;~org/eclipse/core/internal/registry/osgi/*;~org/eclipse/core/internal/registry/spi/*;+org/eclipse/core/runtime/*;+org/eclipse/core/runtime/dynamichelpers/*;+org/eclipse/core/runtime/spi/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.contenttype_3.2.0.v20060603.jar[~org/eclipse/core/internal/content/*;+org/eclipse/core/runtime/content/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.emf.ecore_2.2.0.v200606271057.jar[+org/eclipse/emf/ecore/*;+org/eclipse/emf/ecore/impl/*;+org/eclipse/emf/ecore/plugin/*;+org/eclipse/emf/ecore/resource/*;+org/eclipse/emf/ecore/resource/impl/*;+org/eclipse/emf/ecore/util/*;+org/eclipse/emf/ecore/xml/namespace/*;+org/eclipse/emf/ecore/xml/namespace/impl/*;+org/eclipse/emf/ecore/xml/namespace/util/*;+org/eclipse/emf/ecore/xml/type/*;+org/eclipse/emf/ecore/xml/type/impl/*;+org/eclipse/emf/ecore/xml/type/internal/*;+org/eclipse/emf/ecore/xml/type/util/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.emf.common_2.2.0.v200606271057.jar[+org/eclipse/emf/common/*;+org/eclipse/emf/common/archive/*;+org/eclipse/emf/common/command/*;+org/eclipse/emf/common/notify/*;+org/eclipse/emf/common/notify/impl/*;+org/eclipse/emf/common/util/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.resources_3.2.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.resources.compatibility_3.2.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.resources.win32_3.2.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.update.configurator_3.2.0.v20060605.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.ant.core_3.1.100.v20060531.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.variables_3.1.100.v20060605.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.expressions_3.2.0.v20060605-1400.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.filesystem_1.0.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.filesystem.win32.x86_1.0.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.emf.ecore.xmi_2.2.0.v200606271057.jar[+org/eclipse/emf/ecore/xmi/*;+org/eclipse/emf/ecore/xmi/impl/*;+org/eclipse/emf/ecore/xmi/util/*;?**/*]
#ADAPTER#ACCESS#com.ibm.wala.shrike/bin/[+com/ibm/wala/shrike/bench/*;+com/ibm/wala/shrike/copywriter/*;+com/ibm/wala/shrike/tools/*;+com/ibm/wala/shrikeBT/*;+com/ibm/wala/shrikeBT/analysis/*;+com/ibm/wala/shrikeBT/info/*;+com/ibm/wala/shrikeBT/shrikeCT/*;+com/ibm/wala/shrikeBT/shrikeCT/tools/*;+com/ibm/wala/shrikeBT/tools/*;+com/ibm/wala/shrikeCT/*;?**/*]
#ADAPTER#ACCESS#com.ibm.wala.shrike/@dot[+com/ibm/wala/shrike/bench/*;+com/ibm/wala/shrike/copywriter/*;+com/ibm/wala/shrike/tools/*;+com/ibm/wala/shrikeBT/*;+com/ibm/wala/shrikeBT/analysis/*;+com/ibm/wala/shrikeBT/info/*;+com/ibm/wala/shrikeBT/shrikeCT/*;+com/ibm/wala/shrikeBT/shrikeCT/tools/*;+com/ibm/wala/shrikeBT/tools/*;+com/ibm/wala/shrikeCT/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.jface_3.2.0.I20060605-1400.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.swt_3.2.0.v3232o.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.v3232m.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.commands_3.2.0.I20060605-1400.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.jdt.core_3.2.0.v_671.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.text_3.2.0.v20060605-1400.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/com.ibm.icu_3.4.4.1.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.team.core_3.2.0.I200606051140.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.junit_3.8.1/junit.jar[+junit/awtui/*;+junit/extensions/*;+junit/framework/*;+junit/runner/*;+junit/swingui/*;+junit/swingui/icons/*;+junit/textui/*;?**/*]

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.ExportCallGraphToXML"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/testdata/java_cup.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.ExportTypeHierarchyToXML"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-classpath c:/temp/testdata/JLex.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.GVCallGraph"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/testdata/java_cup.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.GVControlDependenceGraph"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/walaWorkspace/com.ibm.wala.core.testdata/bin/com.ibm.wala.core.testdata_1.0.0.jar -sig slice.TestCD3.main([Ljava/lang/String;)V"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx200M -verbose:gc"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.GVSDG"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar &quot;c:/temp/walaWorkspace/com.ibm.wala.core.testdata/bin/com.ibm.wala.core.testdata_1.0.0.jar&quot; -mainClass &quot;Lslice/Slice4&quot; -srcCaller &quot;main&quot; -srcCallee &quot;foo&quot; -dd &quot;no_base_no_heap&quot; -cd &quot;none&quot; -dir &quot;forward&quot;"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.GVSlice"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar &quot;c:/temp/walaWorkspace/com.ibm.wala.core.testdata/bin/com.ibm.wala.core.testdata_1.0.0.jar&quot; -mainClass &quot;Lslice/Slice4&quot; -srcCaller &quot;main&quot; -srcCallee &quot;foo&quot; -dd &quot;no_base_no_heap&quot; -cd &quot;none&quot; -dir &quot;forward&quot;"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -Dcom.ibm.wala.tracefile=c:/temp/domotrace.txt -ea"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.GVTypeHierarchy"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-classpath c:/temp/testdata/java_cup.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.GVWalaIR"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/testdata/SPECjvm98.jar -sig sun.awt.font.AdvanceCache.&lt;clinit&gt;()V"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx200M -verbose:gc"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.GetEnv"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.swtLaunchConfig">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.SWTCallGraph"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/testdata/java_cup.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -verbose:gc"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.swtLaunchConfig">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.SWTPointsTo"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/testdata/java_cup.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -verbose:gc"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.swtLaunchConfig">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.SWTTypeHierarchy"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.analysis.SimpleThreadEscapeAnalysis"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="LJLex/Main c:/temp/testdata/JLex.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.core.tests.slicer.SlicerTest"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -Dcom.ibm.wala.tracefile=c:/temp/domotrace.txt -ea"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="c:/temp/console"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;slicer&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;slicer&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;com.ibm.wala.core.testdata&quot; type=&quot;1&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
</launchConfiguration>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;com.ibm.wala.core.tests&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.ibm.wala.core.tests&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;com.ibm.wala.core.testdata&quot; type=&quot;1&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -verbose:gc -Dcom.ibm.wala.junit.profile=short"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.core.tests"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
</launchConfiguration>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;com.ibm.wala.core.tests&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.ibm.wala.core.tests&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;com.ibm.wala.core.testdata&quot; type=&quot;1&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -verbose:gc"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.core.tests"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
</launchConfiguration>

View File

@ -1,214 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.basic;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.dataflow.graph.AbstractMeetOperator;
import com.ibm.wala.dataflow.graph.BitVectorFilter;
import com.ibm.wala.dataflow.graph.BitVectorFramework;
import com.ibm.wala.dataflow.graph.BitVectorIdentity;
import com.ibm.wala.dataflow.graph.BitVectorSolver;
import com.ibm.wala.dataflow.graph.BitVectorUnion;
import com.ibm.wala.dataflow.graph.BitVectorUnionConstant;
import com.ibm.wala.dataflow.graph.DataflowSolver;
import com.ibm.wala.dataflow.graph.ITransferFunctionProvider;
import com.ibm.wala.fixedpoint.impl.UnaryOperator;
import com.ibm.wala.fixpoint.BitVectorVariable;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.impl.SlowSparseNumberedGraph;
import com.ibm.wala.util.intset.BitVector;
import com.ibm.wala.util.intset.MutableMapping;
import com.ibm.wala.util.intset.OrdinalSetMapping;
/**
*
* Simple Regression test for a graph-based dataflow problem
*
* @author Donald P Pazel
* @author sfink
* @author Julian Dolby (dolby@us.ibm.com)
*/
public class GraphDataflowTest extends WalaTestCase {
public static final String nodeNames = "ABCDEFGH";
protected final static String[] nodes = new String[nodeNames.length()];
public GraphDataflowTest() {
super("GraphDataflowTest");
}
/**
* A simple test of the GraphBitVectorDataflow system
*/
public void testSolverNodeEdge() {
Graph<String> G = buildGraph();
String result = solveNodeEdge(G);
System.err.println(result);
if (!result.equals(expectedStringNodeEdge())) {
System.err.println("Uh oh.");
System.err.println(expectedStringNodeEdge());
}
assertEquals(expectedStringNodeEdge(), result);
}
public void testSolverNodeOnly() {
Graph<String> G = buildGraph();
String result = solveNodeOnly(G);
System.err.println(result);
assertEquals(expectedStringNodeOnly(), result);
}
/**
* @return the expected dataflow result as a String
*/
public static String expectedStringNodeOnly() {
StringBuffer result = new StringBuffer("------\n");
result.append("Node A(0) = { 0 }\n");
result.append("Node B(1) = { 0 1 }\n");
result.append("Node C(2) = { 0 1 2 }\n");
result.append("Node D(3) = { 0 1 3 }\n");
result.append("Node E(4) = { 0 1 2 3 4 }\n");
result.append("Node F(5) = { 0 1 2 3 4 5 }\n");
result.append("Node G(6) = { 6 }\n");
result.append("Node H(7) = { 7 }\n");
return result.toString();
}
public static String expectedStringNodeEdge() {
StringBuffer result = new StringBuffer("------\n");
result.append("Node A(0) = { 0 }\n");
result.append("Node B(1) = { 0 1 }\n");
result.append("Node C(2) = { 0 2 }\n");
result.append("Node D(3) = { 1 3 }\n");
result.append("Node E(4) = { 0 1 2 3 4 }\n");
result.append("Node F(5) = { 0 1 2 3 4 5 }\n");
result.append("Node G(6) = { 6 }\n");
result.append("Node H(7) = { 7 }\n");
return result.toString();
}
/**
* @return a graph with the expected structure
*/
private static Graph<String> buildGraph() {
Graph<String> G = new SlowSparseNumberedGraph<String>();
for (int i = 0; i < nodeNames.length(); i++) {
String n = nodeNames.substring(i, i + 1);
G.addNode(n);
nodes[i] = n;
}
G.addEdge(nodes[0], nodes[1]);
G.addEdge(nodes[1], nodes[2]);
G.addEdge(nodes[1], nodes[3]);
G.addEdge(nodes[2], nodes[4]);
G.addEdge(nodes[3], nodes[4]);
G.addEdge(nodes[4], nodes[5]);
return G;
}
/**
* Solve the dataflow system and return the result as a string
*/
private String solveNodeOnly(Graph<String> G) {
final OrdinalSetMapping<String> values = new MutableMapping<String>(nodes);
ITransferFunctionProvider<String> functions = new ITransferFunctionProvider<String>() {
public UnaryOperator getNodeTransferFunction(String node) {
return new BitVectorUnionConstant(values.getMappedIndex(node));
}
public boolean hasNodeTransferFunctions() {
return true;
}
public UnaryOperator getEdgeTransferFunction(String from, String to) {
Assertions.UNREACHABLE();
return null;
}
public boolean hasEdgeTransferFunctions() {
return false;
}
public AbstractMeetOperator getMeetOperator() {
return BitVectorUnion.instance();
}
};
BitVectorFramework<String,String> F = new BitVectorFramework<String,String>(G, functions, values);
DataflowSolver<String> s = new BitVectorSolver<String>(F);
s.solve();
return result2String(s);
}
private String solveNodeEdge(Graph<String> G) {
final OrdinalSetMapping<String> values = new MutableMapping<String>(nodes);
ITransferFunctionProvider<String> functions = new ITransferFunctionProvider<String>() {
public UnaryOperator getNodeTransferFunction(String node) {
return new BitVectorUnionConstant(values.getMappedIndex(node));
}
public boolean hasNodeTransferFunctions() {
return true;
}
private BitVector zero() {
BitVector b = new BitVector();
b.set(0);
return b;
}
private BitVector one() {
BitVector b = new BitVector();
b.set(1);
return b;
}
public UnaryOperator getEdgeTransferFunction(String from, String to) {
if (from == nodes[1] && to == nodes[3])
return new BitVectorFilter(zero());
else if (from == nodes[1] && to == nodes[2])
return new BitVectorFilter(one());
else {
return BitVectorIdentity.instance();
}
}
public boolean hasEdgeTransferFunctions() {
return true;
}
public AbstractMeetOperator getMeetOperator() {
return BitVectorUnion.instance();
}
};
BitVectorFramework<String,String> F = new BitVectorFramework<String,String>(G, functions, values);
DataflowSolver<String> s = new BitVectorSolver<String>(F);
s.solve();
return result2String(s);
}
public static String result2String(DataflowSolver<String> solver) {
StringBuffer result = new StringBuffer("------\n");
for (int i = 0; i < nodes.length; i++) {
String n = nodes[i];
BitVectorVariable varI = (BitVectorVariable) solver.getOut(n);
String s = varI.toString();
result.append("Node " + n + "(" + i + ") = " + s + "\n");
}
return result.toString();
}
}

View File

@ -1,585 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.basic;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.util.collections.BimodalMap;
import com.ibm.wala.util.collections.Iterator2Collection;
import com.ibm.wala.util.collections.SmallMap;
import com.ibm.wala.util.graph.Dominators;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.NumberedGraph;
import com.ibm.wala.util.graph.impl.SlowSparseNumberedGraph;
import com.ibm.wala.util.graph.traverse.BFSPathFinder;
import com.ibm.wala.util.graph.traverse.BoundedBFSIterator;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.BimodalMutableIntSetFactory;
import com.ibm.wala.util.intset.BitVector;
import com.ibm.wala.util.intset.BitVectorIntSetFactory;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.IntPair;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.IntSetUtil;
import com.ibm.wala.util.intset.IntegerUnionFind;
import com.ibm.wala.util.intset.MutableIntSet;
import com.ibm.wala.util.intset.MutableIntSetFactory;
import com.ibm.wala.util.intset.MutableSharedBitVectorIntSetFactory;
import com.ibm.wala.util.intset.MutableSparseIntSetFactory;
import com.ibm.wala.util.intset.SparseIntSet;
/**
*
* JUnit tests for some primitive operations.
*
* @author sfink
*/
public class PrimitivesTest extends WalaTestCase {
/**
*
*/
public PrimitivesTest() {
super("PrimitivesTest");
}
/**
* @param arg0
*/
public PrimitivesTest(String arg0) {
super(arg0);
}
/**
* Test the MutableSparseIntSet implementation
*/
private void doMutableIntSet(MutableIntSetFactory factory) {
MutableIntSet v = factory.parse("{9,17}");
MutableIntSet w = factory.make(new int[] {});
MutableIntSet x = factory.make(new int[] { 7, 4, 2, 4, 2, 2 });
MutableIntSet y = factory.make(new int[] { 7, 7, 7, 2, 7, 1 });
MutableIntSet z = factory.parse("{ 9 }");
System.out.println(w); // { }
System.out.println(x); // { 2 4 7 }
System.out.println(y); // { 1 2 7 }
System.out.println(z); // { 9 }
MutableIntSet temp = factory.makeCopy(x);
temp.intersectWith(y);
System.out.println(temp); // { 2 7 }
temp.copySet(x);
temp.addAll(y);
System.out.println(temp); // { 1 2 4 7 }
temp.copySet(x);
System.out.println(IntSetUtil.diff(x, y, factory)); // { 4 }
System.out.println(IntSetUtil.diff(v, z, factory)); // { 17 }
System.out.println(IntSetUtil.diff(z, v, factory)); // { }
// assertTrue(x.union(z).intersection(y.union(z)).equals(x.intersection(y).union(z)));
MutableIntSet temp1 = factory.makeCopy(x);
MutableIntSet temp2 = factory.makeCopy(x);
MutableIntSet tempY = factory.makeCopy(y);
temp1.addAll(z);
tempY.addAll(z);
temp1.intersectWith(tempY);
temp2.intersectWith(y);
temp2.addAll(z);
assertTrue(temp1.sameValue(temp2));
// assertTrue(x.union(z).diff(z).equals(x));
assertTrue(w.isEmpty());
assertTrue(IntSetUtil.diff(x, x, factory).isEmpty());
assertTrue(IntSetUtil.diff(z, v, factory).isEmpty());
assertTrue(IntSetUtil.diff(v, z, factory).sameValue(SparseIntSet.singleton(17)));
assertTrue(IntSetUtil.diff(z, v, factory).isEmpty());
assertTrue(z.isSubset(v));
temp = factory.make();
temp.add(4);
System.out.println(temp); // { 4 }
temp.add(7);
System.out.println(temp); // { 4 7 }
temp.add(2);
System.out.println(temp); // { 2 4 7 }
System.out.println(x); // { 2 4 7 }
assertTrue(temp.sameValue(x));
MutableIntSet a = factory.parse("{1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59}");
System.out.println(a); // { 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
// 35
// 37 39 41 43 45 47 49 51 53 55 57 59 }
assertTrue(a.sameValue(a));
IntSet i = a.intersection(temp);
assertTrue(i.sameValue(SparseIntSet.singleton(7)));
a.add(100);
assertTrue(a.sameValue(a));
MutableIntSet b = factory.parse("{1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,100}");
assertTrue(a.sameValue(b));
assertTrue(a.isSubset(b));
b = factory.makeCopy(a);
assertTrue(a.sameValue(b));
b.remove(1);
b.add(0);
assertTrue(!a.sameValue(b));
a = factory.parse("{1}");
assertFalse(a.isSubset(b));
b.remove(0);
assertFalse(a.isSubset(b));
a.remove(1);
assertTrue(a.isEmpty());
i = a.intersection(temp);
assertTrue(a.isEmpty());
temp2 = factory.make();
assertTrue(temp2.sameValue(a));
a = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,51,53,55,57,59,61,63}");
b = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62}");
MutableIntSet c = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50}");
MutableIntSet d = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50}");
MutableIntSet e = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34}");
assertTrue(e.isSubset(d));
e.addAll(d);
assertTrue(e.isSubset(d));
e.remove(12);
assertTrue(e.isSubset(d));
e.add(105);
assertFalse(e.isSubset(d));
assertFalse(b.isSubset(a));
b.add(53);
assertFalse(b.isSubset(a));
a.add(52);
a.remove(52);
assertFalse(b.isSubset(a));
c.add(55);
assertFalse(c.isSubset(b));
d.add(53);
assertTrue(d.isSubset(b));
d = factory.make();
d.copySet(c);
assertFalse(d.isSubset(b));
a = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50}");
b = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48}");
assertFalse(a.sameValue(b));
b.add(50);
assertTrue(a.sameValue(b));
a.add(11);
b.add(11);
assertTrue(a.sameValue(b));
a = factory.parse("{2,4,6,8,10,12,14,16,18,20,50}");
b = factory.parse("{24,26,28,30,32,34,36,38,40,42,44,46,48}");
c = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50}");
a.addAll(b);
a.add(22);
assertTrue(a.sameValue(c));
a = factory.parse("{2,4,6,8,10,12,14,16,18,20,50}");
b = factory.parse("{24,26,28,30,32,34,36,38,40,42,44,46,48}");
c = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50}");
b.addAll(factory.parse("{22}"));
a.addAll(b);
assertTrue(a.sameValue(c));
a = factory.parse("{2,4,6,8,10,12,14,16,18,20}");
b = factory.parse("{22,24,26,28,30,32,34,36,38,40,42,44,46,48}");
c = factory.parse("{2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50}");
c.remove(22);
a.addAll(b);
assertFalse(a.sameValue(c));
a = factory.parse("{1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59}");
System.out.println(a); // { 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
// 35
// 37 39 41 43 45 47 49 51 53 55 57 59 }
assertTrue(a.sameValue(a));
i = a.intersection(temp);
assertTrue(i.sameValue(SparseIntSet.singleton(7)));
a.add(100);
assertTrue(a.sameValue(a));
b = factory.parse("{1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,100}");
assertTrue(a.sameValue(b));
assertTrue(a.isSubset(b));
b = factory.makeCopy(a);
assertTrue(a.sameValue(b));
b.remove(1);
b.add(0);
assertTrue(!a.sameValue(b));
a = factory.parse("{1}");
assertFalse(a.isSubset(b));
b.remove(0);
assertFalse(a.isSubset(b));
a.remove(1);
assertTrue(a.isEmpty());
i = a.intersection(temp);
assertTrue(a.isEmpty());
temp2 = factory.make();
assertTrue(temp2.sameValue(a));
}
/**
* Test the MutableSharedBitVectorIntSet implementation
*/
public void testMutableSharedBitVectorIntSet() {
doMutableIntSet(new MutableSharedBitVectorIntSetFactory());
}
/**
* Test the MutableSparseIntSet implementation
*/
public void testMutableSparseIntSet() {
doMutableIntSet(new MutableSparseIntSetFactory());
}
/**
* Test the BimodalMutableSparseIntSet implementation
*/
public void testBimodalMutableSparseIntSet() {
doMutableIntSet(new BimodalMutableIntSetFactory());
}
/**
* Test the BitVectorIntSet implementation
*/
public void testBitVectorIntSet() {
doMutableIntSet(new BitVectorIntSetFactory());
}
public void testSmallMap() {
SmallMap<Integer,Integer> M = new SmallMap<Integer,Integer>();
Integer I1 = new Integer(1);
Integer I2 = new Integer(2);
Integer I3 = new Integer(3);
M.put(I1, I1);
M.put(I2, I2);
M.put(I3, I3);
Integer I = (Integer) M.get(new Integer(2));
assertTrue(I != null);
assertTrue(I.equals(I2));
I = (Integer) M.get(new Integer(4));
assertTrue(I == null);
I = (Integer) M.put(new Integer(2), new Integer(3));
assertTrue(I.equals(I2));
I = (Integer) M.get(I2);
assertTrue(I.equals(I3));
}
public void testBimodalMap() {
Map<Integer, Integer> M = new BimodalMap<Integer, Integer>(3);
Integer I1 = new Integer(1);
Integer I2 = new Integer(2);
Integer I3 = new Integer(3);
Integer I4 = new Integer(4);
Integer I5 = new Integer(5);
Integer I6 = new Integer(6);
M.put(I1, I1);
M.put(I2, I2);
M.put(I3, I3);
Integer I = M.get(new Integer(2));
assertTrue(I != null);
assertTrue(I.equals(I2));
I = M.get(new Integer(4));
assertTrue(I == null);
I = M.put(new Integer(2), new Integer(3));
assertTrue(I.equals(I2));
I = M.get(I2);
assertTrue(I.equals(I3));
M.put(I4, I4);
M.put(I5, I5);
M.put(I6, I6);
I = M.get(new Integer(4));
assertTrue(I != null);
assertTrue(I.equals(I4));
I = M.get(new Integer(7));
assertTrue(I == null);
I = M.put(new Integer(2), new Integer(6));
assertTrue(I.equals(I3));
I = M.get(I2);
assertTrue(I.equals(I6));
}
public void testBFSPathFinder() {
NumberedGraph<Integer> G = makeBFSTestGraph();
// path from 0 to 8
BFSPathFinder<Integer> pf = new BFSPathFinder<Integer>(G, G.getNode(0), G.getNode(8));
List<Integer> p = pf.find();
// path should be 8, 6, 4, 2, 0
System.out.println("Path is " + p);
for (int i = 0; i < p.size(); i++) {
assertTrue((p.get(i)).intValue() == new int[] { 8, 6, 4, 2, 0 }[i]);
}
}
public void testBoundedBFS() {
NumberedGraph<Integer> G = makeBFSTestGraph();
BoundedBFSIterator<Integer> bfs = new BoundedBFSIterator<Integer>(G, G.getNode(0), 0);
Collection<Integer> c = new Iterator2Collection<Integer>(bfs);
assertTrue(c.size() == 1);
bfs = new BoundedBFSIterator<Integer>(G, G.getNode(0), 1);
c = new Iterator2Collection<Integer>(bfs);
assertTrue(c.size() == 3);
bfs = new BoundedBFSIterator<Integer>(G, G.getNode(0), 2);
c = new Iterator2Collection<Integer>(bfs);
assertTrue(c.size() == 5);
bfs = new BoundedBFSIterator<Integer>(G, G.getNode(0), 3);
c = new Iterator2Collection<Integer>(bfs);
assertTrue(c.size() == 7);
bfs = new BoundedBFSIterator<Integer>(G, G.getNode(0), 4);
c = new Iterator2Collection<Integer>(bfs);
assertTrue(c.size() == 9);
bfs = new BoundedBFSIterator<Integer>(G, G.getNode(0), 5);
c = new Iterator2Collection<Integer>(bfs);
assertTrue(c.size() == 10);
bfs = new BoundedBFSIterator<Integer>(G, G.getNode(0), 500);
c = new Iterator2Collection<Integer>(bfs);
assertTrue(c.size() == 10);
}
private NumberedGraph<Integer> makeBFSTestGraph() {
// test graph
NumberedGraph<Integer> G = new SlowSparseNumberedGraph<Integer>();
// add 10 nodes
Integer[] nodes = new Integer[10];
for (int i = 0; i < nodes.length; i++)
G.addNode(nodes[i] = new Integer(i));
// edges to i-1, i+1, i+2
for (int i = 0; i < nodes.length; i++) {
if (i > 0) {
G.addEdge(nodes[i], nodes[i - 1]);
}
if (i < nodes.length - 1) {
G.addEdge(nodes[i], nodes[i + 1]);
if (i < nodes.length - 2) {
G.addEdge(nodes[i], nodes[i + 2]);
}
}
}
return G;
}
public void testDominatorsA() {
// test graph
Graph<Object> G = new SlowSparseNumberedGraph<Object>();
// add nodes
Object[] nodes = new Object[11];
for (int i = 0; i < nodes.length; i++)
G.addNode(nodes[i] = new Integer(i));
// add edges
G.addEdge(nodes[10], nodes[0]);
G.addEdge(nodes[10], nodes[1]);
G.addEdge(nodes[0], nodes[2]);
G.addEdge(nodes[1], nodes[3]);
G.addEdge(nodes[2], nodes[5]);
G.addEdge(nodes[3], nodes[5]);
G.addEdge(nodes[4], nodes[2]);
G.addEdge(nodes[5], nodes[8]);
G.addEdge(nodes[6], nodes[3]);
G.addEdge(nodes[7], nodes[4]);
G.addEdge(nodes[8], nodes[7]);
G.addEdge(nodes[8], nodes[9]);
G.addEdge(nodes[9], nodes[6]);
// compute dominators
Dominators<Object> D = new Dominators<Object>(G, nodes[10]);
// assertions
int i = 0;
Object[] desired4 = new Object[] { nodes[4], nodes[7], nodes[8], nodes[5], nodes[10] };
for (Iterator<Object> d4 = D.dominators(nodes[4]); d4.hasNext();)
assertTrue(d4.next() == desired4[i++]);
int j = 0;
Object[] desired5 = new Object[] { nodes[8] };
for (Iterator<? extends Object> t4 = D.dominatorTree().getSuccNodes(nodes[5]); t4.hasNext();)
assertTrue(t4.next() == desired5[j++]);
assertTrue(D.dominatorTree().getSuccNodeCount(nodes[10]) == 5);
}
public void testBinaryIntegerRelation() {
byte[] impl = new byte[] { BasicNonNegativeIntRelation.SIMPLE, BasicNonNegativeIntRelation.TWO_LEVEL,
BasicNonNegativeIntRelation.SIMPLE };
IBinaryNonNegativeIntRelation R = new BasicNonNegativeIntRelation(impl, BasicNonNegativeIntRelation.TWO_LEVEL);
R.add(3, 5);
R.add(3, 7);
R.add(3, 9);
R.add(3, 11);
R.add(5, 1);
int count = 0;
for (Iterator<IntPair> it = R.iterator(); it.hasNext();) {
System.err.println(it.next());
count++;
}
assertTrue(count == 5);
IntSet x = R.getRelated(3);
assertTrue(x.size() == 4);
x = R.getRelated(5);
assertTrue(x.size() == 1);
R.remove(5, 1);
x = R.getRelated(5);
assertTrue(x == null);
R.add(2, 1);
R.add(2, 2);
R.remove(2, 1);
x = R.getRelated(2);
assertTrue(x.size() == 1);
R.removeAll(3);
x = R.getRelated(3);
assertTrue(x == null);
x = R.getRelated(0);
assertTrue(x == null);
for (int i = 0; i < 100; i++) {
R.add(1, i);
}
assertTrue(R.getRelated(1).size() == 100);
R.remove(1, 1);
assertTrue(R.getRelated(1).size() == 99);
}
public void testUnionFind() {
int SIZE = 10000;
IntegerUnionFind uf = new IntegerUnionFind(SIZE);
int count = countEquivalenceClasses(uf);
assertTrue("Got count " + count, count == SIZE);
uf.union(3, 7);
assertTrue(uf.find(3) == uf.find(7));
assertTrue("Got uf.find(3)=" + uf.find(3), uf.find(3) == 3 || uf.find(3) == 7);
uf.union(7, SIZE - 1);
assertTrue(uf.find(3) == uf.find(SIZE - 1));
assertTrue("Got uf.find(3)=" + uf.find(3), uf.find(3) == 3 || uf.find(3) == 7 || uf.find(3) == SIZE - 1);
for (int i = 0; i < SIZE - 1; i++) {
uf.union(i, i + 1);
}
count = countEquivalenceClasses(uf);
assertTrue("Got count " + count, count == 1);
uf = new IntegerUnionFind(SIZE);
for (int i = 0; i < SIZE; i++) {
if ((i % 2) == 0) {
uf.union(i, 0);
} else {
uf.union(i, 1);
}
}
count = countEquivalenceClasses(uf);
assertTrue("Got count " + count, count == 2);
}
private int countEquivalenceClasses(IntegerUnionFind uf) {
HashSet<Integer> s = new HashSet<Integer>();
for (int i = 0; i < uf.size(); i++) {
s.add(new Integer(uf.find(i)));
}
return s.size();
}
public void testBitVectors() {
BitVector bv = new BitVector();
// does the following not automatically scale the bitvector to
// a reasonable size?
bv.set(55);
assertTrue(bv.max() == 55);
assertTrue(bv.get(55));
bv.set(59);
assertTrue(bv.max() == 59);
assertTrue(bv.get(55));
assertTrue(bv.get(59));
{
boolean[] gets = new boolean[] { false, true, true };
int[] bits = new int[] { 0, 55, 59 };
for (int i = 0, j = 0; i != -1; i = bv.nextSetBit(i + 1), j++) {
assertTrue(i == bits[j]);
assertTrue(bv.get(i) == gets[j]);
}
}
bv.set(77);
assertTrue(bv.max() == 77);
{
boolean[] gets = new boolean[] { false, true, true, true };
int[] bits = new int[] { 0, 55, 59, 77 };
for (int i = 0, j = 0; i != -1; i = bv.nextSetBit(i + 1), j++) {
assertTrue(i == bits[j]);
assertTrue(bv.get(i) == gets[j]);
}
}
bv.set(3);
assertTrue(bv.max() == 77);
{
boolean[] gets = new boolean[] { false, true, true, true, true };
int[] bits = new int[] { 0, 3, 55, 59, 77 };
for (int i = 0, j = 0; i != -1; i = bv.nextSetBit(i + 1), j++) {
assertTrue(i == bits[j]);
assertTrue(bv.get(i) == gets[j]);
}
}
System.out.println(bv);
}
}

View File

@ -1,567 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.callGraph;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import com.ibm.wala.cfg.CFGCache;
import com.ibm.wala.cfg.IBasicBlock;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ecore.java.ECallSite;
import com.ibm.wala.ecore.java.EJavaMethod;
import com.ibm.wala.ecore.java.impl.JavaPackageImpl;
import com.ibm.wala.emf.wrappers.ECallGraphWrapper;
import com.ibm.wala.emf.wrappers.EMFBridge;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphStats;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.AllApplicationEntrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cfg.BasicBlockInContext;
import com.ibm.wala.ipa.cfg.InterproceduralCFG;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.GraphIntegrity;
import com.ibm.wala.util.graph.GraphIntegrity.UnsoundGraphException;
import com.ibm.wala.util.graph.traverse.DFS;
import com.ibm.wala.util.warnings.CallGraphWarnings;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
* Tests for Call Graph construction
*
* @author sfink
*/
public class CallGraphTest extends WalaTestCase {
static {
JavaPackageImpl.init();
}
private static final String[] IGNORE_STRINGS = { "finalize", "java.lang.ThreadLocal", "java.lang.ref.Reference.get()" };
public static void main(String[] args) {
justThisTest(CallGraphTest.class);
}
/**
* Constructor for SpecJTest.
*
* @param arg0
*/
public CallGraphTest(String arg0) {
super(arg0);
}
/*
* public void testOpenccg() { AnalysisScope scope =
* CallGraphTestUtil.makeJ2SEAnalysisScope(Config.OPENCCG); WarningSet
* warnings = new WarningSet(); ClassHierarchy cha =
* ClassHierarchy.buildClassHierarchy(scope, warnings); Entrypoints
* entrypoints =
* com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
* Config.OPENCCG_CROSS_VALIDATE_REALIZER); AnalysisOptions options =
* CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
*
* Trace.println("OPENCCG Cross Validate Realizer set up warnings:\n");
* Trace.print(warnings.toString());
*
* doCallGraphs(options, cha, scope, null, useShortProfile(), false); }
*
* public void testKaba() { AnalysisScope scope =
* CallGraphTestUtil.makeJ2SEAnalysisScope(Config.KABA); WarningSet warnings =
* new WarningSet(); ClassHierarchy cha =
* ClassHierarchy.buildClassHierarchy(scope, warnings); Entrypoints
* entrypoints =
* com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
* Config.KABA_MAIN); AnalysisOptions options =
* CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
*
* Trace.println("kaba verifier set up warnings:\n");
* Trace.print(warnings.toString());
*
* doCallGraphs(options, cha, scope, null, useShortProfile(), false); }
*
* public void testAntlr() { AnalysisScope scope =
* CallGraphTestUtil.makeJ2SEAnalysisScope(Config.ANTLR); WarningSet warnings =
* new WarningSet(); ClassHierarchy cha =
* ClassHierarchy.buildClassHierarchy(scope, warnings); Entrypoints
* entrypoints =
* com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
* Config.ANTLR_MAIN); AnalysisOptions options =
* CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
*
* Trace.println("ANTLR verifier set up warnings:\n");
* Trace.print(warnings.toString());
*
* doCallGraphs(options, cha, scope, null, useShortProfile(), false); }
*/
public void testBcelVerifier() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.BCEL);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util
.makeMainEntrypoints(scope, cha, TestConstants.BCEL_VERIFIER_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
Trace.println("bcel verifier set up warnings:\n");
Trace.print(warnings.toString());
doCallGraphs(options, cha, scope, null, useShortProfile(), false);
}
public void testJava_cup() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.JAVA_CUP);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.JAVA_CUP_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
Trace.println("java_cup set up warnings:\n");
Trace.print(warnings.toString());
doCallGraphs(options, cha, scope, null, useShortProfile(), false);
}
public void testJLex() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.JLEX);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.JLEX_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
Trace.println("JLex set up warnings:\n");
Trace.print(warnings.toString());
doCallGraphs(options, cha, scope, null, useShortProfile(), false);
}
public void testCornerCases() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = new AllApplicationEntrypoints(scope, cha);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
Trace.println("testCornerCases set up warnings:\n");
Trace.print(warnings.toString());
warnings = doCallGraphs(options, cha, scope, null, useShortProfile(), false);
// we expect a warning or two about class Abstract1, which has no concrete
// subclasses
String ws = warnings.toString();
assertTrue("failed to report a warning about Abstract1", ws.indexOf("cornerCases/Abstract1") > -1);
// we do not expect a warning about class Abstract2, which has a concrete
// subclasses
assertTrue("reported a warning about Abstract2", ws.indexOf("cornerCases/Abstract2") == -1);
}
//
// public void testSPECjvm98() {
// AnalysisScope scope = CGTUtils.makeJ2SEAnalysisScope(Config.SPECJVM);
//
// // temporary hack because 1.5 libraries still cause grief
// if (scope.isJava15Libraries()) {
// scope = CGTUtils.makeJ2EEAnalysisScope(Config.SPECJVM);
// }
//
// WarningSet warnings = new WarningSet();
// ClassHierarchy cha = ClassHierarchy.buildClassHierarchy(scope, warnings);
// Entrypoints entrypoints =
// com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
// Config.SPECJVM_MAIN);
// AnalysisOptions options = CGTUtils.makeAnalysisOptions(scope, entrypoints);
//
// Trace.println("SPECjvm98 set up warnings:\n");
// Trace.print(warnings.toString());
//
// doCallGraphs(options, cha, scope, Config.SPECJVM_DCG, false, false);
// }
//
public void testHello() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.HELLO);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.HELLO_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
Trace.println("hello set up warnings:\n");
Trace.print(warnings.toString());
doCallGraphs(options, cha, scope, null, false, false);
}
public void testRecursion() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.RECURSE_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
Trace.println("testRecursion set up warnings:\n");
Trace.print(warnings.toString());
doCallGraphs(options, cha, scope, null, useShortProfile(), false);
}
public void testHelloAllEntrypoints() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.HELLO);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = new AllApplicationEntrypoints(scope, cha);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
Trace.println("hello all entrypoints set up warnings:\n");
Trace.print(warnings.toString());
doCallGraphs(options, cha, scope, null, useShortProfile(), false);
}
//
// public void testSPECjvm98AllEntrypoints() {
// AnalysisScope scope = CGTUtils.makeJ2SEAnalysisScope(Config.SPECJVM);
// WarningSet warnings = new WarningSet();
// ClassHierarchy cha = ClassHierarchy.buildClassHierarchy(scope, warnings);
// Entrypoints entrypoints = new AllApplicationEntrypoints(scope, cha);
// AnalysisOptions options = CGTUtils.makeAnalysisOptions(scope, entrypoints);
//
// Trace.println("SPECjvm98 set up warnings:\n");
// Trace.print(warnings.toString());
//
// doCallGraphs(options, cha, scope, null, useShortProfile(), true);
// }
/**
* TODO: refactor this to avoid excessive code bloat.
*/
public static WarningSet doCallGraphs(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope, String dcgFile,
boolean stopAfterZeroCFA, boolean stopAfterZeroContainerCFA) {
// ///////////////
// // RTA /////
// ///////////////
WarningSet warnings = new WarningSet();
CallGraph cg = CallGraphTestUtil.buildRTA(options, cha, scope, warnings);
try {
GraphIntegrity.check(cg);
} catch (UnsoundGraphException e1) {
e1.printStackTrace();
assertTrue(e1.getMessage(), false);
}
Set<MethodReference> rtaMethods = CallGraphStats.collectMethods(cg);
Trace.println("RTA methods reached: " + rtaMethods.size());
Trace.println(CallGraphStats.getStats(cg));
Trace.println("RTA warnings:\n");
warnings.addAll(CallGraphWarnings.getWarnings(cg));
Trace.print(warnings.toString(cg));
// ///////////////
// // 0-CFA /////
// ///////////////
warnings = new WarningSet();
cg = CallGraphTestUtil.buildZeroCFA(options, cha, scope, warnings);
// FIXME: annoying special cases caused by clone2assign mean using
// the rta graph for proper graph subset checking does not work.
// (note that all the other such checks do use proper graph subset)
Graph<MethodReference> squashZero = checkCallGraph(warnings, cg, null, rtaMethods, "0-CFA");
// test Pretransitive 0-CFA
// not currently supported
// warnings = new WarningSet();
// options.setUsePreTransitiveSolver(true);
// CallGraph cgP = CallGraphTestUtil.buildZeroCFA(options, cha, scope,
// warnings);
// options.setUsePreTransitiveSolver(false);
// Graph squashPT = checkCallGraph(warnings, cgP, squashZero, null, "Pre-T
// 1");
// checkCallGraph(warnings, cg, squashPT, null, "Pre-T 2");
if (stopAfterZeroCFA) {
return warnings;
}
// ///////////////
// // 0-1-CFA ///
// ///////////////
warnings = new WarningSet();
cg = CallGraphTestUtil.buildZeroOneCFA(options, cha, scope, warnings);
Graph<MethodReference> squashZeroOne = checkCallGraph(warnings, cg, squashZero, null, "0-1-CFA");
// ///////////////////////////////////////////////////
// // 0-CFA augmented to disambiguate containers ///
// ///////////////////////////////////////////////////
warnings = new WarningSet();
cg = CallGraphTestUtil.buildZeroContainerCFA(options, cha, scope, warnings);
Graph<MethodReference> squashZeroContainer = checkCallGraph(warnings, cg, squashZero, null, "0-Container-CFA");
if (stopAfterZeroContainerCFA)
return warnings;
// ///////////////////////////////////////////////////
// // 0-1-CFA augmented to disambiguate containers ///
// ///////////////////////////////////////////////////
warnings = new WarningSet();
cg = CallGraphTestUtil.buildZeroOneContainerCFA(options, cha, scope, warnings);
checkCallGraph(warnings, cg, squashZeroContainer, null, "0-1-Container-CFA");
checkCallGraph(warnings, cg, squashZeroOne, null, "0-1-Container-CFA");
if (dcgFile != null) {
checkAgainstDCG(cg, dcgFile);
}
// test ICFG
checkICFG(cg, options.getCFGCache());
return warnings;
// /////////////
// // 1-CFA ///
// /////////////
// warnings = new WarningSet();
// cg = buildOneCFA();
}
/**
* Check properties of the InterproceduralCFG
*
* @param cg
*/
private static void checkICFG(CallGraph cg, CFGCache cfgCache) {
InterproceduralCFG icfg = new InterproceduralCFG(cg, cfgCache, new WarningSet());
try {
GraphIntegrity.check(icfg);
} catch (UnsoundGraphException e) {
e.printStackTrace();
assertTrue(false);
}
// perform a little icfg exercise
int count = 0;
for (Iterator<? extends BasicBlockInContext> it = icfg.iterateNodes(); it.hasNext();) {
IBasicBlock bb = (IBasicBlock) it.next();
if (icfg.hasCall((BasicBlockInContext) bb)) {
count++;
}
}
}
/**
* Check that cg is a superset of the dynamic call graph encoded in the
* dcgFile
*
* @param cg
* @param dcgFile
*/
private static void checkAgainstDCG(CallGraph cg, String dcgFile) {
Set<CGNode> synthLeaves = getSyntheticLeaves(cg);
com.ibm.wala.emf.wrappers.ECallGraphWrapper subG = com.ibm.wala.emf.wrappers.ECallGraphWrapper.load(dcgFile,
CallGraphTest.class.getClassLoader());
com.ibm.wala.emf.wrappers.ECallGraphWrapper superG = EMFBridge.makeCallGraph(cg);
prune(subG, synthLeaves);
prune(superG, synthLeaves);
checkGraphSubset(superG, subG);
}
/**
* @param superG
* @param subG
*/
public static void checkGraphSubset(ECallGraphWrapper superG, ECallGraphWrapper subG) {
Set<EObject> nodeDiff = Util.setify(subG.iterateNodes());
nodeDiff.removeAll(Util.setify(superG.iterateNodes()));
Set<EObject> toRemove = HashSetFactory.make();
for (Iterator<EObject> it = nodeDiff.iterator(); it.hasNext();) {
EObject o = it.next();
if (o instanceof ECallSite) {
toRemove.add(o);
}
}
// a bogus hack: ignore some stuff in the dcg that we haven't
// cleaned out; TODO: figure out what's happening and delete this
outer: for (Iterator<EObject> it = nodeDiff.iterator(); it.hasNext();) {
EObject o = it.next();
for (int i = 0; i < IGNORE_STRINGS.length; i++) {
if (o.toString().indexOf(IGNORE_STRINGS[i]) > -1) {
toRemove.add(o);
continue outer;
}
}
}
nodeDiff.removeAll(toRemove);
if (!nodeDiff.isEmpty()) {
Trace.println("supergraph: ");
Trace.println(superG.toString());
Trace.println("subgraph: ");
Trace.println(subG.toString());
Trace.println("nodeDiff: ");
for (Iterator<EObject> it = nodeDiff.iterator(); it.hasNext();) {
Trace.println(it.next().toString());
}
Assertions.productionAssertion(nodeDiff.isEmpty(), "bad superset, see tracefile\n");
}
}
/**
* <ul>
* <li>remove all methods from G that correspond to synthetic methods
* <li>remove all nodes from G that are no longer reachable from the fake
* root.
* <ul>
*
* @param G
* an EMF format call graph
* @param synthetic
* a set of synthetic methods
*/
private static void prune(ECallGraphWrapper G, Set<CGNode> synthetic) {
// compute synthetic nodes
Set<EObject> toRemove = HashSetFactory.make();
for (Iterator<CGNode> it = synthetic.iterator(); it.hasNext();) {
CGNode n = it.next();
EJavaMethod node = EMFBridge.makeJavaMethod(n.getMethod().getReference());
if (node != null) {
toRemove.add(node);
}
}
removeNodes(G, toRemove);
// compute nodes reachable from the fake root
EJavaMethod fakeRoot = EMFBridge.makeFakeRootMethod();
Assertions._assert(fakeRoot != null);
Collection<EObject> c = DFS.getReachableNodes(G, Collections.singleton(fakeRoot));
// remove other nodes
toRemove = HashSetFactory.make();
for (Iterator<? extends EObject> it = G.iterateNodes(); it.hasNext();) {
EObject n = it.next();
if (!c.contains(n)) {
toRemove.add(n);
}
}
removeNodes(G, toRemove);
// remove call site nodes with no targets (these won't appear in the dcg)
toRemove = HashSetFactory.make();
for (Iterator<? extends EObject> it = G.iterateNodes(); it.hasNext();) {
EObject n = it.next();
if (n instanceof ECallSite) {
if (G.getSuccNodeCount(n) == 0) {
toRemove.add(n);
}
}
}
removeNodes(G, toRemove);
}
/**
* @param G
* @param toRemove
*/
private static void removeNodes(ECallGraphWrapper G, Set<EObject> toRemove) {
// remove all these nodes
for (Iterator<EObject> it = toRemove.iterator(); it.hasNext();) {
EObject n = it.next();
if (G.containsNode(n)) {
G.removeNodeAndEdges(n);
}
}
}
/**
* @param cg
* @return Set <CGNode>in cg that are synthetic and have no call sites
*/
private static Set<CGNode> getSyntheticLeaves(CallGraph cg) {
HashSet<CGNode> result = HashSetFactory.make();
for (Iterator<? extends CGNode> it = cg.iterateNodes(); it.hasNext();) {
CGNode node = (CGNode) it.next();
if (!node.equals(cg.getFakeRootNode())) {
if (node.getMethod().isSynthetic()) {
if (!node.iterateSites().hasNext()) {
result.add(node);
}
}
}
}
return result;
}
/**
* Check consistency of a callgraph, and check that this call graph is a
* subset of a super-graph
*
* @param warnings
* object to track warnings
* @param cg
* @param superCG
* @param superMethods
* @param thisAlgorithm
* @return a squashed version of cg
*/
private static Graph<MethodReference> checkCallGraph(WarningSet warnings, CallGraph cg, Graph<MethodReference> superCG,
Set<MethodReference> superMethods, String thisAlgorithm) {
try {
GraphIntegrity.check(cg);
} catch (UnsoundGraphException e1) {
assertTrue(e1.getMessage(), false);
}
Set<MethodReference> callGraphMethods = CallGraphStats.collectMethods(cg);
Trace.println(thisAlgorithm + " methods reached: " + callGraphMethods.size());
Trace.println(CallGraphStats.getStats(cg));
Trace.println(thisAlgorithm + " warnings:\n");
warnings.addAll(CallGraphWarnings.getWarnings(cg));
Trace.print(warnings.toString(cg));
Graph<MethodReference> thisCG = com.ibm.wala.ipa.callgraph.impl.Util.squashCallGraph(thisAlgorithm, cg);
if (superCG != null) {
com.ibm.wala.ipa.callgraph.impl.Util.checkGraphSubset(superCG, thisCG);
} else {
if (!superMethods.containsAll(callGraphMethods)) {
Set<MethodReference> temp = HashSetFactory.make();
temp.addAll(callGraphMethods);
temp.removeAll(superMethods);
Trace.printCollection("Violations", temp);
Assertions.UNREACHABLE();
}
}
return thisCG;
}
}

View File

@ -1,141 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.callGraph;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.util.Stopwatch;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
* Utilities for call graph tests
*
* @author sfink
*/
public class CallGraphTestUtil {
private static final ClassLoader MY_CLASSLOADER = CallGraphTestUtil.class.getClassLoader();
// private static final String reflectionFile = Config.SPECJVM_REFLECTION;
public static AnalysisOptions makeAnalysisOptions(AnalysisScope scope, Entrypoints entrypoints) {
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
// InputStream rStream = CallGraphTestUtil.class.getClassLoader().getResourceAsStream(reflectionFile);
// ReflectionSpecification R = new XMLReflectionReader(rStream, scope);
// options.setReflectionSpec(R);
return options;
}
public static AnalysisScope makeJ2SEAnalysisScope(String scopeFile) {
return new EMFScopeWrapper(scopeFile, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
}
public static AnalysisScope makeJ2SEAnalysisScope(String scopeFile, String exclusionsFile) {
return new EMFScopeWrapper(scopeFile, exclusionsFile, MY_CLASSLOADER);
}
public static CallGraph buildRTA(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope, WarningSet warnings) {
Stopwatch S = new Stopwatch("build RTA graph");
S.start();
CallGraphBuilder builder = Util.makeRTABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
S.stop();
Trace.println(S.report());
return cg;
}
public static CallGraph buildZeroCFA(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope, WarningSet warnings) {
Stopwatch S = new Stopwatch("build ZeroCFA graph");
S.start();
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
S.stop();
Trace.println(S.report());
return cg;
}
public static CallGraph buildVanillaZeroOneCFA(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope, WarningSet warnings) {
Stopwatch S = new Stopwatch("build Vanila 0-1-CFA graph");
S.start();
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
S.stop();
Trace.println(S.report());
return cg;
}
public static CallGraph buildZeroOneCFA(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope, WarningSet warnings) {
Stopwatch S = new Stopwatch("build 0-1-CFA graph");
S.start();
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
S.stop();
Trace.println(S.report());
return cg;
}
public static CallGraph buildZeroContainerCFA(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope,
WarningSet warnings) {
Stopwatch S = new Stopwatch("build 0-1-Container-CFA graph");
S.start();
CallGraphBuilder builder = Util.makeZeroContainerCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
S.stop();
Trace.println(S.report());
return cg;
}
public static CallGraph buildZeroOneContainerCFA(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope,
WarningSet warnings) {
Stopwatch S = new Stopwatch("build 0-1-Container-CFA graph");
S.start();
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
S.stop();
Trace.println(S.report());
return cg;
}
public static CallGraph buildOneCFA(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope, WarningSet warnings) {
Stopwatch S = new Stopwatch("build 1-CFA graph");
S.start();
CallGraphBuilder builder = Util.makeOneCFABuilder(options, cha, MY_CLASSLOADER, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
S.stop();
Trace.println(S.report());
return cg;
}
}

View File

@ -1,77 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.callGraph;
import java.util.Set;
import junit.framework.Assert;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.WarningSet;
/**
* Check handling of class constants (test for part of 1.5 support)
*
* @author Julian Dolby (dolby@us.ibm.com)
*/
public class ClassConstantTest extends WalaTestCase {
public void testClassConstants() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Trace.println("setup warnings:");
Trace.println(warnings);
// make sure we have the test class
TypeReference mainClassRef = TypeReference.findOrCreate(ClassLoaderReference.Application, TestConstants.CLASSCONSTANT_MAIN);
Assert.assertTrue(cha.lookupClass(mainClassRef) != null);
// make call graph
Entrypoints entrypoints = Util.makeMainEntrypoints(scope, cha, TestConstants.CLASSCONSTANT_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, cha, scope, warnings);
Trace.println("\nCall graph:");
Trace.println(cg);
// make sure the main method is reached
MethodReference mainMethodRef = MethodReference.findOrCreate(mainClassRef, "main", "([Ljava/lang/String;)V");
Set<CGNode> mainMethodNodes = cg.getNodes(mainMethodRef);
Assert.assertFalse(mainMethodNodes.isEmpty());
CGNode mainMethodNode = (CGNode) mainMethodNodes.iterator().next();
Trace.println("main IR:");
Trace.println(cg.getInterpreter(mainMethodNode).getIR(mainMethodNode, warnings));
// Make sure call to hashCode is there (it uses the class constant)
TypeReference classRef = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Class");
MethodReference hashCodeRef = MethodReference.findOrCreate(classRef, "hashCode", "()I");
Set<CGNode> hashCodeNodes = cg.getNodes(hashCodeRef);
Assert.assertFalse(hashCodeNodes.isEmpty());
// make sure call to hashCode from main
Assert.assertTrue(cg.hasEdge(mainMethodNode, hashCodeNodes.iterator().next()));
}
}

View File

@ -1,72 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.callGraph;
import java.util.Iterator;
import java.util.Set;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.AllApplicationEntrypoints;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.warnings.WarningSet;
/**
* Check properties of a call to clone() in RTA
*
* @author Bruno Dufour
*/
public class CloneTest extends WalaTestCase {
public void testClone() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = new AllApplicationEntrypoints(scope, cha);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraph cg = CallGraphTestUtil.buildRTA(options, cha, scope, warnings);
// Find node corresp. to java.text.MessageFormat.clone()
TypeReference t = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/text/MessageFormat");
MethodReference m = MethodReference.findOrCreate(t, "clone", "()Ljava/lang/Object;");
CGNode node = (CGNode) cg.getNodes(m).iterator().next();
// Check there's exactly one target for each super call in
// MessageFormat.clone()
for (Iterator<CallSiteReference> i = node.iterateSites(); i.hasNext();) {
CallSiteReference site = (CallSiteReference) i.next();
if (site.isSpecial()) {
if (site.getDeclaredTarget().getDeclaringClass().equals(TypeReference.JavaLangObject)) {
Set<CGNode> targets = node.getPossibleTargets(site);
if (targets.size() != 1) {
System.err.println(targets.size() + " targets found for " + site);
for (Iterator<CGNode> k = targets.iterator(); k.hasNext();) {
System.err.println(" " + k.next());
}
fail("found " + targets.size() + " targets for " + site + " in " + node);
}
}
}
}
}
}

View File

@ -1,433 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.callGraph;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
import com.ibm.wala.cfg.IBasicBlock;
import com.ibm.wala.cfg.cdg.BVControlDependenceGraph;
import com.ibm.wala.cfg.cdg.ControlDependenceGraph;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphStats;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.cfa.CFABuilder;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.shrikeBT.IInstruction;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSACFG;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSACFG.BasicBlock;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.DotUtil;
/**
* @author Mangala Gowri Nanda (minor hacks by Julian Dolby (dolby@us.ibm.com)
* to fit into domo junit test framework)
*
*/
public class CompareCDGTest extends WalaTestCase {
/**
* Usage: CompareCDGTest <jar file name>
*
* The "jar file name" should be something like "/tmp/testdata/java_cup.jar"
*
* @param args
*/
public static void main(String[] args) {
run(args);
}
/**
* Usage: args = "-appJar [jar file name] " The "jar file name" should be
* something like "/tmp/testdata/java_cup.jar"
*
* @param args
*/
public static void run(String[] args) {
try {
run(buildCallGraphCommandLine(args[0]));
} catch (WalaException e) {
Trace.println(e);
}
}
public static void run(CallGraph g) {
compareCDGs(g);
Trace.println(CallGraphStats.getStats(g));
}
private static void compareCDGs(CallGraph g) {
long cdgTime = 0;
long bvTime = 0;
String dotExe = "dot";
for (Iterator<? extends CGNode> it = g.iterateNodes(); it.hasNext();) {
CGNode n = (CGNode) it.next();
MethodReference mref = n.getMethod().getReference();
Trace.println(mref.toString());
// if(app.equals("Application"))
{
IR ir = g.getInterpreter(n).getIR(n, new WarningSet());
if (ir != null) {
SSACFG cfg = ir.getControlFlowGraph();
long startTime = System.currentTimeMillis();
ControlDependenceGraph cdg = new ControlDependenceGraph(cfg, true);
long diff = System.currentTimeMillis() - startTime;
cdgTime += diff;
startTime = System.currentTimeMillis();
BVControlDependenceGraph bvcdg = new BVControlDependenceGraph(cfg);
diff = System.currentTimeMillis() - startTime;
bvTime += diff;
if (!compatible(cfg, cdg, bvcdg)) {
Trace.println("\tMISMATCH!!");
Vector<BasicBlock> vec = checkCFG(cfg, mref);
if (vec != null) {
Trace.println(mref + " has " + vec.size() + " blocks with no predecessors");
}
Trace.println("\nControlDependenceGraph output::");
dumpCDGInfo(cfg, cdg);
Trace.println("\nBitVector ControlDependenceGraph output::");
dumpCDGInfo(cfg, bvcdg);
Trace.println("");
String dotFile = "tmp.dot";
String psFile = mref.getName() + ".cdg.ps";
try {
DotUtil.dotify(cdg, null, dotFile, psFile, dotExe);
} catch (WalaException e) {
e.printStackTrace();
}
psFile = mref.getName() + ".bv.ps";
try {
DotUtil.dotify(bvcdg, null, dotFile, psFile, dotExe);
} catch (WalaException e) {
e.printStackTrace();
}
Assertions.UNREACHABLE();
}
}
}
}
Trace.println("Time to compute ControlDependenceGraph=" + cdgTime);
Trace.println("Time to compute BVControlDependenceGraph=" + bvTime);
}
private static boolean compatible(SSACFG cfg, ControlDependenceGraph cdg, BVControlDependenceGraph bv) {
boolean ret = true;
for (Iterator<? extends IBasicBlock> it = cfg.iterateNodes(); it.hasNext();) {
SSACFG.BasicBlock ibb = (SSACFG.BasicBlock) it.next();
int cCount = cdg.getPredNodeCount(ibb);
int bCount = bv.getPredNodeCount(ibb);
if (cCount != bCount) {
Trace.println("\tPred Count mismatch for " + ibb);
ret = false;
}
Iterator<? extends IBasicBlock> cdit = cdg.getPredNodes(ibb);
while (cdit.hasNext()) {
SSACFG.BasicBlock cdgbb = (SSACFG.BasicBlock) cdit.next();
if (!bv.hasEdge(cdgbb, ibb)) {
Trace.println("\tPred " + cdgbb + " mismatch for " + ibb);
ret = false;
}
Set<Object> clabels = cdg.getEdgeLabels(cdgbb, ibb);
Set<? extends Object> blabels = bv.getEdgeLabels(cdgbb, ibb);
Iterator<Object> labit = clabels.iterator();
while (labit.hasNext()) {
Object lab = labit.next();
if (!blabels.contains(lab)) {
Trace.println("\tLabel " + lab + " missing at " + cdgbb + " --> " + ibb);
ret = false;
}
}
}
cCount = cdg.getSuccNodeCount(ibb);
bCount = bv.getSuccNodeCount(ibb);
if (cCount != bCount) {
Trace.println("\tSucc Count mismatch for " + ibb);
ret = false;
}
cdit = cdg.getSuccNodes(ibb);
while (cdit.hasNext()) {
SSACFG.BasicBlock cdgbb = (SSACFG.BasicBlock) cdit.next();
if (!bv.hasEdge(ibb, cdgbb)) {
Trace.println("\tSucc " + cdgbb + " mismatch for " + ibb);
ret = false;
}
Set<Object> clabels = cdg.getEdgeLabels(ibb, cdgbb);
Set<? extends Object> blabels = bv.getEdgeLabels(ibb, cdgbb);
Iterator<Object> labit = clabels.iterator();
while (labit.hasNext()) {
Object lab = labit.next();
if (!blabels.contains(lab)) {
Trace.println("\tLabel " + lab + " missing at " + ibb + " --> " + cdgbb);
ret = false;
}
}
}
}
return ret;
}
private static void dumpCDGInfo(SSACFG cfg, ControlDependenceGraph cdg) {
Trace.println("{\n");
Vector<SSACFG.BasicBlock> seen = new Vector<SSACFG.BasicBlock>();
SSACFG.BasicBlock entry = (SSACFG.BasicBlock) cfg.entry();
Vector<SSACFG.BasicBlock> worklist = new Vector<SSACFG.BasicBlock>();
worklist.add(entry);
while (worklist.size() > 0) {
SSACFG.BasicBlock ibb = worklist.remove(worklist.size() - 1);
if (seen.contains(ibb))
continue;
seen.add(ibb);
int number = ibb.getNumber();
Trace.print("\n\tBB ID:" + number + "::" + ibb + " (CD=");
Iterator<? extends IBasicBlock> cdit = cdg.getPredNodes(ibb);
while (cdit.hasNext()) {
SSACFG.BasicBlock cdgbb = (SSACFG.BasicBlock) cdit.next();
Trace.print(cdgbb.getNumber() + "[");
Set<Object> labels = cdg.getEdgeLabels(cdgbb, ibb);
Iterator<Object> labit = labels.iterator();
while (labit.hasNext()) {
Object lab = labit.next();
Trace.print(lab + ",");
}
Trace.print("] ");
}
Trace.print(")");
Iterator<? extends IBasicBlock> succ = cfg.getSuccNodes(ibb);
Trace.print(" (SUCC=");
while (succ.hasNext()) {
SSACFG.BasicBlock isc = (SSACFG.BasicBlock) succ.next();
Trace.print(isc.getNumber() + ", ");
worklist.add(isc);
}
Trace.print(")");
Iterator<? extends IBasicBlock> pred = cfg.getPredNodes(ibb);
Trace.print(" (PRED=");
while (pred.hasNext()) {
SSACFG.BasicBlock isc = (SSACFG.BasicBlock) pred.next();
Trace.print(isc.getNumber() + ", ");
}
Trace.println(") {");
Iterator<? extends IInstruction> it = ibb.iterateAllInstructions();
int j = 0;
while (it.hasNext()) {
SSAInstruction inst = (SSAInstruction) it.next();
if (inst != null) {
Trace.println("\t\t" + j++ + ":" + inst.toString());
}
}
Trace.println("\t}\n");
}
Trace.println("}\n");
}
private static void dumpCDGInfo(SSACFG cfg, BVControlDependenceGraph cdg) {
Trace.println("{\n");
Vector<SSACFG.BasicBlock> seen = new Vector<SSACFG.BasicBlock>();
SSACFG.BasicBlock entry = (SSACFG.BasicBlock) cfg.entry();
Vector<SSACFG.BasicBlock> worklist = new Vector<SSACFG.BasicBlock>();
worklist.add(entry);
while (worklist.size() > 0) {
SSACFG.BasicBlock ibb = worklist.remove(worklist.size() - 1);
if (seen.contains(ibb))
continue;
seen.add(ibb);
int number = ibb.getNumber();
Trace.print("\n\tBB ID:" + number + "::" + ibb + " (CD=");
Iterator<? extends IBasicBlock> cdit = cdg.getPredNodes(ibb);
while (cdit.hasNext()) {
SSACFG.BasicBlock cdgbb = (SSACFG.BasicBlock) cdit.next();
Trace.print(cdgbb.getNumber() + "[");
Set<? extends Object> labels = cdg.getEdgeLabels(cdgbb, ibb);
Iterator<? extends Object> labit = labels.iterator();
while (labit.hasNext()) {
Object lab = labit.next();
Trace.print(lab + ",");
}
Trace.print("] ");
}
Trace.print(")");
Iterator<? extends IBasicBlock> succ = cfg.getSuccNodes(ibb);
Trace.print(" (SUCC=");
while (succ.hasNext()) {
SSACFG.BasicBlock isc = (SSACFG.BasicBlock) succ.next();
Trace.print(isc.getNumber() + ", ");
worklist.add(isc);
}
Trace.print(")");
Iterator<IBasicBlock> pred = cfg.getPredNodes(ibb);
Trace.print(" (PRED=");
while (pred.hasNext()) {
SSACFG.BasicBlock isc = (SSACFG.BasicBlock) pred.next();
Trace.print(isc.getNumber() + ", ");
}
Trace.println(") {");
Iterator<? extends IInstruction> it = ibb.iterateAllInstructions();
int j = 0;
while (it.hasNext()) {
SSAInstruction inst = (SSAInstruction) it.next();
if (inst != null) {
Trace.println("\t\t" + j++ + ":" + inst.toString());
}
}
Trace.println("\t}\n");
}
Trace.println("}\n");
}
/*
* private static void buildUncheckedCDGs(CallGraph g) { String dotExe =
* "dot"; int count = 0; for (Iterator it = g.iterateNodes(); it.hasNext();) {
* count++; CGNode n = (CGNode) it.next(); MethodReference mref =
* n.getMethod().getReference(); IR ir = ((SSAContextInterpreter)
* g.getInterpreter(n)).getIR(n, new WarningSet()); if (ir != null) { SSACFG
* cfg = ir.getControlFlowGraph(); Vector vec = checkCFG(cfg, mref); if ( vec !=
* null ) { // Trace.println(mref.toString()); ControlDependenceGraph cdg =
* new ControlDependenceGraph(cfg,true); boolean found = false; for ( int i=0;
* i<vec.size() ; i++ ) { Object o = vec.get(i); if (
* cdg.getSuccNodeCount(o)>0 ) { found = true; break; } } if ( !found )
* continue;
*
* Trace.println(mref+" has "+vec.size()+ " blocks with no predecessors"); for (
* int i=0 ; i<vec.size() ; i++ ) { SSACFG.BasicBlock bb =
* (SSACFG.BasicBlock)vec.get(i); Trace.println("\t"+dumpIBB(bb, cfg)); }
*
* String dotFile = "tmp.dot"; String psFile = ""+mref.getName()+count+".ps";
* try { DotUtil.dotify(cdg, null, dotFile, psFile, dotExe); } catch
* (WalaException e) { e.printStackTrace(); } } } } }
*/
private static Vector<BasicBlock> checkCFG(SSACFG cfg, MethodReference mref) {
Vector<SSACFG.BasicBlock> vec = new Vector<SSACFG.BasicBlock>();
for (Iterator<? extends IBasicBlock> it = cfg.iterateNodes(); it.hasNext();) {
SSACFG.BasicBlock bb = (SSACFG.BasicBlock) it.next();
if (cfg.getPredNodeCount(bb) == 0)
vec.add(bb);
}
if (vec.size() > 1) {
/*
* Trace.println(mref+" has more than one block with no predecessors");
* for ( int i=0 ; i<vec.size() ; i++ ) { SSACFG.BasicBlock bb =
* (SSACFG.BasicBlock)vec.get(i); Trace.println("\t"+dumpIBB(bb, cfg)); }
*/
return vec;
}
return null;
}
/*
* private static String dumpIBB ( SSACFG.BasicBlock ibb, SSACFG ssaCfg ) {
* int number = ibb.getNumber(); String ret = ""; ret += "BB ID:"+number +
* "::" + ibb; Iterator succ = ssaCfg.getSuccNodes(ibb); ret += " (SUCC=";
* while (succ.hasNext()) { SSACFG.BasicBlock isc = (SSACFG.BasicBlock)
* succ.next(); ret += "" + isc.getNumber()+", "; } ret += ")";
*
* Iterator pred = ssaCfg.getPredNodes(ibb); ret += " (PRED="; while
* (pred.hasNext()) { SSACFG.BasicBlock isc = (SSACFG.BasicBlock) pred.next();
* ret += "" + isc.getNumber()+", "; } ret += ") {\n";
*
* Iterator it = ibb.iterateAllInstructions(); int j = 0; while (it.hasNext()) {
* SSAInstruction inst = (SSAInstruction) it.next(); if ( inst != null ) { ret +=
* "\t\t"+ j++ + ":" + inst.toString() + "\n"; } } ret += "\t}\n"; return ret; }
*/
/**
* @param appJar
* something like "c:/temp/testdata/java_cup.jar"
* @return a call graph
* @throws WalaException
* @throws ClassHierarchyException
*/
public static CallGraph buildCallGraphCommandLine(String appJar) throws WalaException, ClassHierarchyException {
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
// generate a DOMO-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// TODO: return the warning set
// invoke DOMO to build a DOMO class hierarchy object
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
// //
// build the call graph
// //
CFABuilder builder = Util.makeZeroCFABuilder(options, cha, scope, warnings, null, null);
CallGraph cg = builder.makeCallGraph(options);
return cg;
}
public void testJavaCup() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.JAVA_CUP);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.JAVA_CUP_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
run(CallGraphTestUtil.buildZeroCFA(options, cha, scope, warnings));
}
public void testBcelVerifier() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.BCEL);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util
.makeMainEntrypoints(scope, cha, TestConstants.BCEL_VERIFIER_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
run(CallGraphTestUtil.buildZeroCFA(options, cha, scope, warnings));
}
public void testJLex() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.JLEX);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.JLEX_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
run(CallGraphTestUtil.buildZeroCFA(options, cha, scope, warnings));
}
}

View File

@ -1,65 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.callGraph;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.util.intset.BimodalMutableIntSetFactory;
import com.ibm.wala.util.intset.BitVectorIntSetFactory;
import com.ibm.wala.util.intset.DebuggingMutableIntSetFactory;
import com.ibm.wala.util.intset.IntSetUtil;
import com.ibm.wala.util.intset.MutableIntSetFactory;
import com.ibm.wala.util.intset.MutableSharedBitVectorIntSetFactory;
import com.ibm.wala.util.intset.MutableSparseIntSetFactory;
/**
*
* Run the call graph only test with paranoid debugging bit vectors
*
* @author Julian Dolby
*/
public class DebuggingBitsetCallGraphTest extends WalaTestCase {
public static void main(String[] args) {
justThisTest(DebuggingBitsetCallGraphTest.class);
}
private final CallGraphTest graphTest;
public DebuggingBitsetCallGraphTest(String arg0) {
super(arg0);
graphTest = new CallGraphTest(arg0);
}
private void runBitsetTest(MutableIntSetFactory p, MutableIntSetFactory s) throws ClassHierarchyException {
MutableIntSetFactory save = IntSetUtil.getDefaultIntSetFactory();
IntSetUtil.setDefaultIntSetFactory(new DebuggingMutableIntSetFactory(p, s));
graphTest.testJLex();
IntSetUtil.setDefaultIntSetFactory(save);
}
public void testBimodalSparse() throws ClassHierarchyException {
runBitsetTest(new BimodalMutableIntSetFactory(), new MutableSparseIntSetFactory());
}
public void testSharedBimodal() throws ClassHierarchyException {
runBitsetTest(new MutableSharedBitVectorIntSetFactory(), new BimodalMutableIntSetFactory());
}
public void testSharedSparse() throws ClassHierarchyException {
runBitsetTest(new MutableSharedBitVectorIntSetFactory(), new MutableSparseIntSetFactory());
}
public void testSharedBitVector() throws ClassHierarchyException {
runBitsetTest(new MutableSharedBitVectorIntSetFactory(), new BitVectorIntSetFactory());
}
}

View File

@ -1,48 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.callGraph;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ecore.java.impl.JavaPackageImpl;
import com.ibm.wala.util.warnings.WalaException;
/**
*
* Tests for Call Graph construction
*
* @author sfink
*/
public class EclipseCallGraphTest extends WalaTestCase {
static {
JavaPackageImpl.init();
}
public static void main(String[] args) {
justThisTest(EclipseCallGraphTest.class);
}
public void testOrgEclipseCoreResources() throws WalaException {
// not ready yet .. SJF
// EclipseAnalysisScope scope = new EclipseAnalysisScope("org.eclipse.core.resources");
// WarningSet warnings = new WarningSet();
// ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
// Entrypoints entrypoints = new EclipseEntrypoints(scope, cha, false);
// AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
//
// Trace.println("org.eclipse.core.resources set up warnings:\n");
// Trace.print(warnings.toString());
//
// CallGraphTest.doCallGraphs(options, cha, scope, null, true, true);
}
}

View File

@ -1,115 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.callGraph;
import java.util.Iterator;
import java.util.Set;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ecore.java.impl.JavaPackageImpl;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.Descriptor;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeName;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.warnings.WarningSet;
/**
* @author Julian Dolby
*
*/
public class PiNodeCallGraphTest extends WalaTestCase {
static {
JavaPackageImpl.init();
}
public static void main(String[] args) {
justThisTest(PiNodeCallGraphTest.class);
}
private static final String whateverName = TestConstants.PI_TEST_MAIN + "$Whatever";
private static final String thisName = TestConstants.PI_TEST_MAIN + "$This";
private static final String thatName = TestConstants.PI_TEST_MAIN + "$That";
private static final ClassLoaderReference loader = new ClassLoaderReference(Atom.findOrCreateUnicodeAtom("Application"));
private static final TypeReference whateverRef = TypeReference.findOrCreate(loader, TypeName.string2TypeName(whateverName));
private static final TypeReference thisRef = TypeReference.findOrCreate(loader, TypeName.string2TypeName(thisName));
private static final TypeReference thatRef = TypeReference.findOrCreate(loader, TypeName.string2TypeName(thatName));
private static final MethodReference thisBinaryRef = MethodReference.findOrCreate(thisRef,
Atom.findOrCreateUnicodeAtom("binary"), Descriptor.findOrCreateUTF8("(" + whateverName + ";)V"));
private static final MethodReference thatBinaryRef = MethodReference.findOrCreate(thatRef,
Atom.findOrCreateUnicodeAtom("binary"), Descriptor.findOrCreateUTF8("(" + whateverName + ";)V"));
private static final MethodReference unary2Ref = MethodReference.findOrCreate(whateverRef,
Atom.findOrCreateUnicodeAtom("unary2"), Descriptor.findOrCreateUTF8("()V"));
private CallGraph doGraph(boolean usePiNodes) throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.PI_TEST_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
options.getSSAOptions().setUsePiNodes(usePiNodes);
warnings = new WarningSet();
return CallGraphTestUtil.buildZeroCFA(options, cha, scope, warnings);
}
private void checkCallAssertions(CallGraph cg, int desiredNumberOfTargets, int desiredNumberOfCalls) {
int numberOfCalls = 0;
Set<CGNode> callerNodes = HashSetFactory.make();
callerNodes.addAll(cg.getNodes(thisBinaryRef));
callerNodes.addAll(cg.getNodes(thatBinaryRef));
Assertions._assert(callerNodes.size() == 2);
for (Iterator<CGNode> nodes = callerNodes.iterator(); nodes.hasNext();) {
CGNode n = (CGNode) nodes.next();
for (Iterator<CallSiteReference> sites = n.iterateSites(); sites.hasNext();) {
CallSiteReference csRef = (CallSiteReference) sites.next();
if (csRef.getDeclaredTarget().equals(unary2Ref)) {
numberOfCalls++;
Assertions._assert(n.getNumberOfTargets(csRef) == desiredNumberOfTargets);
}
}
}
Assertions._assert(numberOfCalls == desiredNumberOfCalls);
}
public void testNoPiNodes() throws ClassHierarchyException {
checkCallAssertions(doGraph(false), 2, 2);
}
public void testPiNodes() throws ClassHierarchyException {
checkCallAssertions(doGraph(true), 1, 2);
}
}

View File

@ -1,67 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.callGraph;
import java.util.Iterator;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ecore.java.impl.JavaPackageImpl;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.Warning;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
* Tests for Call Graph construction
*
* @author sfink
*/
public class ReflectionTest extends WalaTestCase {
static {
JavaPackageImpl.init();
}
public static void main(String[] args) {
justThisTest(ReflectionTest.class);
}
public void testReflect1() throws WalaException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.REFLECT1_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
Trace.println("testReflect1 set up warnings:\n");
Trace.print(warnings.toString());
warnings = CallGraphTest.doCallGraphs(options, cha, scope, null, useShortProfile(), false);
if (warnings.size() > 0) {
System.err.println(warnings);
}
for (Iterator<Warning> it = warnings.iterator(); it.hasNext(); ) {
Warning w = (Warning)it.next();
if (w.toString().indexOf("com/ibm/jvm") > 0) {
continue;
}
assertTrue(w.toString(), false);
}
}
}

View File

@ -1,150 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.cha;
import java.io.File;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Properties;
import org.eclipse.emf.ecore.EObject;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ecore.java.EJavaClass;
import com.ibm.wala.ecore.java.ETypeHierarchy;
import com.ibm.wala.ecore.java.impl.JavaPackageImpl;
import com.ibm.wala.emf.wrappers.EMFBridge;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.ETypeHierarchyWrapper;
import com.ibm.wala.emf.wrappers.EUtil;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
/**
* @author sfink
*/
public class CHATest extends WalaTestCase {
static {
JavaPackageImpl.init();
}
private static final ClassLoader MY_CLASSLOADER = CHATest.class.getClassLoader();
public static void main(String[] args) {
justThisTest(CHATest.class);
}
public CHATest(String arg0) {
super(arg0);
}
/**
* regression test with class hierarchy of primordial loader
* @throws ClassHierarchyException
*/
public void testPrimordial() throws ClassHierarchyException {
System.err.println("build ...");
// build a class hierarchy for the primordial loader
AnalysisScope scope = new EMFScopeWrapper(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
com.ibm.wala.emf.wrappers.ETypeHierarchyWrapper t1 = EMFBridge.makeTypeHierarchy(cha);
System.err.println("save ...");
// save it to disk
ETypeHierarchy et = (ETypeHierarchy) t1.toEMF();
Properties p = null;;
try {
p = WalaProperties.loadProperties();
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String outputDir = p.getProperty(WalaProperties.OUTPUT_DIR);
String fileName = outputDir + File.separator + "primordialTH.xml";
Collection<EObject> persist = new LinkedList<EObject>();
persist.add(et);
persist.add(et.getClasses().getNodes());
persist.add(et.getInterfaces().getNodes());
try {
EUtil.saveToFile(persist, fileName);
} catch (WalaException e1) {
e1.printStackTrace();
Assertions.UNREACHABLE("failed to save to file " + fileName + "\n. outputDir was " + outputDir);
}
System.err.println("read ...");
// load it back into memory
ETypeHierarchyWrapper et2 = ETypeHierarchyWrapper.loadFromFile(fileName);
System.err.println("check ...");
// check that they are isomorphic
// TODO: add general utilities for isomorphism
com.ibm.wala.ipa.callgraph.impl.Util.checkGraphSubset(t1.getClasses(), et2.getClasses());
com.ibm.wala.ipa.callgraph.impl.Util.checkGraphSubset(et2.getClasses(), t1.getClasses());
com.ibm.wala.ipa.callgraph.impl.Util.checkGraphSubset(t1.getInterfaces(), et2.getInterfaces());
com.ibm.wala.ipa.callgraph.impl.Util.checkGraphSubset(et2.getInterfaces(), t1.getInterfaces());
checkInterfaces(cha, et2);
}
/**
* check that the set of interfaces for each class is consistent between cha
* and T.
*
* @param cha
* @param T
*/
private void checkInterfaces(ClassHierarchy cha, ETypeHierarchyWrapper T) {
try {
for (Iterator<IClass> it = cha.iterateAllClasses(); it.hasNext();) {
IClass klass = (IClass) it.next();
if (!klass.isInterface()) {
EJavaClass eKlass = EMFBridge.makeJavaClass(klass.getReference());
HashSet<EJavaClass> impls = new HashSet<EJavaClass>(5);
for (Iterator<IClass> it2 = klass.getDirectInterfaces().iterator(); it2.hasNext();) {
IClass iface = (IClass) it2.next();
impls.add(EMFBridge.makeJavaClass(iface.getReference()));
}
Collection<EJavaClass> c = T.getImplements(eKlass);
checkSetsEqual(impls, c);
}
}
} catch (ClassHierarchyException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
}
private void checkSetsEqual(Collection<EJavaClass> c1, Collection<EJavaClass> c2) {
if (!c1.containsAll(c2)) {
c2.removeAll(c1);
Trace.printCollection("DIFF: c2 contains but not c1 ", c2);
assertTrue("c1 not superset of c2, see trace file for details", false);
return;
}
if (!c2.containsAll(c1)) {
c1.removeAll(c2);
Trace.printCollection("DIFF: c1 contains but not c2 ", c1);
assertTrue("c2 not superset of c1, see trace file for details", false);
return;
}
}
}

View File

@ -1,37 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.cha;
import junit.framework.Assert;
import com.ibm.wala.core.tests.ir.DeterministicIRTest;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
/**
* Test code that attempts to find the library version from
* the analysis scope.
*
* @author JulianDolby (dolby@us.ibm.com)
*/
public class LibraryVersionTest extends WalaTestCase {
private static final ClassLoader MY_CLASSLOADER = DeterministicIRTest.class.getClassLoader();
public void testLibraryVersion() {
AnalysisScope scope = new EMFScopeWrapper(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
System.err.println("java library version is " + scope.getJavaLibraryVersion());
Assert.assertTrue(scope.isJava15Libraries()||scope.isJava14Libraries());
}
}

View File

@ -1,60 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.cha;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.warnings.WarningSet;
/**
* A test of support for source file mapping
*
* @author sfink
*/
public class SourceMapTest extends WalaTestCase {
private static final ClassLoader MY_CLASSLOADER = SourceMapTest.class.getClassLoader();
private final static String CLASS_IN_PRIMORDIAL_JAR = "Lcom/ibm/wala/model/SyntheticFactory";
public void testHello() throws ClassHierarchyException {
AnalysisScope scope = null;
scope = new EMFScopeWrapper(TestConstants.HELLO, null, MY_CLASSLOADER);
// TODO: it's annoying to have to build a class hierarchy here.
// see feature 38676
ClassHierarchy cha = ClassHierarchy.make(scope, new WarningSet());
TypeReference t = TypeReference.findOrCreate(scope.getApplicationLoader(), TestConstants.HELLO_MAIN);
IClass klass = cha.lookupClass(t);
assertTrue("failed to load " + t, klass != null);
String sourceFile = klass.getSourceFileName();
System.err.println("Source file: " + sourceFile);
assertTrue(sourceFile != null);
}
public void testFromJar() throws ClassHierarchyException {
AnalysisScope scope = null;
scope = new EMFScopeWrapper(TestConstants.HELLO, null, MY_CLASSLOADER);
// TODO: it's annoying to have to build a class hierarchy here.
// open a feature to fix this
ClassHierarchy cha = ClassHierarchy.make(scope, new WarningSet());
TypeReference t = TypeReference.findOrCreate(scope.getPrimordialLoader(), CLASS_IN_PRIMORDIAL_JAR);
IClass klass = cha.lookupClass(t);
assertTrue(klass != null);
String sourceFile = klass.getSourceFileName();
assertTrue(sourceFile != null);
System.err.println("Source file: " + sourceFile);
}
}

View File

@ -1,97 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.ir;
import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.cfg.TwoExitCFG;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.StringStuff;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.graph.GraphIntegrity;
import com.ibm.wala.util.graph.GraphIntegrity.UnsoundGraphException;
import com.ibm.wala.util.warnings.WarningSet;
/**
* Test integrity of CFGs
*/
public class CFGTest extends WalaTestCase {
public static void main(String[] args) {
justThisTest(CFGTest.class);
}
/**
* Build an IR, then check integrity on two flavors of CFG
*/
private void doMethod(String methodSig) {
try {
EJavaAnalysisScope escope = JavaScopeUtil.makePrimordialScope();
// generate a DOMO-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// invoke DOMO to build a DOMO class hierarchy object
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
MethodReference mr = StringStuff.makeMethodReference(methodSig);
IMethod m = cha.resolveMethod(mr);
if (m == null) {
Assertions.UNREACHABLE("could not resolve " + mr);
}
AnalysisOptions options = new AnalysisOptions();
options.getSSAOptions().setUsePiNodes(true);
IR ir = options.getSSACache().findOrCreateIR(m, Everywhere.EVERYWHERE, cha, options.getSSAOptions(), new WarningSet());
ControlFlowGraph cfg = ir.getControlFlowGraph();
try {
GraphIntegrity.check(cfg);
} catch (UnsoundGraphException e) {
e.printStackTrace();
Trace.println(ir);
assertTrue(" failed cfg integrity check for " + methodSig, false);
}
cfg = new TwoExitCFG(cfg);
try {
GraphIntegrity.check(cfg);
} catch (UnsoundGraphException e) {
e.printStackTrace();
Trace.println(ir);
Trace.println(cfg);
assertTrue(" failed 2-exit cfg integrity check for " + methodSig, false);
}
} catch (Exception e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
}
/**
* this method does not exist in 1.5 libraries public void testFDBigInt() {
* doMethod("java.lang.FDBigInt.class$(Ljava/lang/String;)Ljava/lang/Class;"); }
*/
public void testResolveProxyClass() {
doMethod("java.io.ObjectInputStream.resolveProxyClass([Ljava/lang/String;)Ljava/lang/Class;");
}
}

View File

@ -1,83 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.ir;
import com.ibm.wala.analysis.typeInference.TypeInference;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.ShrikeCTMethodWrapper;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.types.Descriptor;
import com.ibm.wala.types.Selector;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.WarningSet;
/**
* tests for weird corner cases, such as when the input program doesn't verify
*
* @author sfink
*/
public class CornerCasesTest extends WalaTestCase {
private static final ClassLoader MY_CLASSLOADER = CornerCasesTest.class.getClassLoader();
/**
* test that getMethod() works even if a declared ancester interface doesn't
* exist
* @throws ClassHierarchyException
*/
public void testBug38484() throws ClassHierarchyException {
AnalysisScope scope = null;
scope = new EMFScopeWrapper(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
TypeReference t = TypeReference.findOrCreateClass(scope.getApplicationLoader(), "cornerCases", "YuckyInterface");
IClass klass = cha.lookupClass(t);
assertTrue(klass != null);
IMethod m = klass.getMethod(new Selector(Atom.findOrCreateAsciiAtom("x"), Descriptor.findOrCreateUTF8("()V")));
assertTrue(m == null);
Trace.print(warnings.toString());
}
/**
* test that type inference works in the presence of a getfield where the
* field's declared type cannot be loaded
* @throws ClassHierarchyException
*/
public void testBug38540() throws ClassHierarchyException {
AnalysisScope scope = null;
scope = new EMFScopeWrapper(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
AnalysisOptions options = new AnalysisOptions();
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
TypeReference t = TypeReference.findOrCreateClass(scope.getApplicationLoader(), "cornerCases", "Main");
IClass klass = cha.lookupClass(t);
assertTrue(klass != null);
ShrikeCTMethodWrapper m = (ShrikeCTMethodWrapper) klass.getMethod(new Selector(Atom.findOrCreateAsciiAtom("foo"), Descriptor
.findOrCreateUTF8("()Ljava/lang/Object;")));
assertTrue(m != null);
IR ir = options.getIRFactory().makeIR(m, Everywhere.EVERYWHERE, cha, options.getSSAOptions(), warnings);
new TypeInference(ir, cha);
Trace.print(warnings.toString());
}
}

View File

@ -1,216 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.ir;
import java.util.Iterator;
import com.ibm.wala.classLoader.ClassLoaderFactory;
import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.ImmutableByteArray;
import com.ibm.wala.util.UTF8Convert;
import com.ibm.wala.util.graph.GraphIntegrity;
import com.ibm.wala.util.graph.GraphIntegrity.UnsoundGraphException;
import com.ibm.wala.util.warnings.WarningSet;
/**
* Test that the SSA-numbering of variables in the IR is deterministic.
*
* Introduced 05-AUG-03; the default implementation of hashCode was being
* invoked. Object.hashCode is a source of random numbers and has no place in a
* deterministic program.
*/
public class DeterministicIRTest extends WalaTestCase {
private static final ClassLoader MY_CLASSLOADER = DeterministicIRTest.class.getClassLoader();
private WarningSet warnings;
private AnalysisScope scope;
private ClassHierarchy cha;
private AnalysisOptions options;
public static void main(String[] args) {
justThisTest(DeterministicIRTest.class);
}
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
warnings = new WarningSet();
scope = new EMFScopeWrapper(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
options = new AnalysisOptions(scope, null);
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions(), warnings);
warnings = new WarningSet();
try {
cha = ClassHierarchy.make(scope, factory, warnings);
} catch (ClassHierarchyException e) {
throw new Exception();
}
}
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
warnings = null;
scope = null;
cha = null;
super.tearDown();
}
/**
* @param method
*/
private IR doMethod(MethodReference method) {
assertNotNull("method not found", method);
IMethod imethod = cha.resolveMethod(method);
assertNotNull("imethod not found", imethod);
IR ir1 = options.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, cha, options.getSSAOptions(), warnings);
options.getSSACache().wipe();
checkNotAllNull(ir1.getInstructions());
checkNoneNull(ir1.iterateAllInstructions());
try {
GraphIntegrity.check(ir1.getControlFlowGraph());
} catch (UnsoundGraphException e) {
System.err.println(ir1);
e.printStackTrace();
assertTrue("unsound CFG for ir1", false);
}
IR ir2 = options.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, cha, options.getSSAOptions(), warnings);
options.getSSACache().wipe();
try {
GraphIntegrity.check(ir2.getControlFlowGraph());
} catch (UnsoundGraphException e1) {
System.err.println(ir2);
e1.printStackTrace();
assertTrue("unsound CFG for ir2", false);
}
assertEquals(ir1.toString(), ir2.toString());
return ir1;
}
// The Tests ///////////////////////////////////////////////////////
/**
* @param iterator
*/
private void checkNoneNull(Iterator<?> iterator) {
while (iterator.hasNext()) {
assertTrue(iterator.next() != null);
}
}
/**
* @param instructions
*/
private static void checkNotAllNull(SSAInstruction[] instructions) {
for (int i = 0; i < instructions.length; i++) {
if (instructions[i] != null) {
return;
}
}
assertTrue("no instructions generated", false);
}
public void testIR1() {
// 'remove' is a nice short method
doMethod(scope.findMethod(AnalysisScope.APPLICATION, "Ljava/util/HashMap", Atom.findOrCreateUnicodeAtom("remove"),
new ImmutableByteArray(UTF8Convert.toUTF8("(Ljava/lang/Object;)Ljava/lang/Object;"))));
}
public void testIR2() {
// 'equals' is a nice medium-sized method
doMethod(scope.findMethod(AnalysisScope.APPLICATION, "Ljava/lang/String", Atom.findOrCreateUnicodeAtom("equals"),
new ImmutableByteArray(UTF8Convert.toUTF8("(Ljava/lang/Object;)Z"))));
}
public void testIR3() {
// 'resolveProxyClass' is a nice long method (at least in Sun libs)
doMethod(scope.findMethod(AnalysisScope.APPLICATION, "Ljava/io/ObjectInputStream", Atom
.findOrCreateUnicodeAtom("resolveProxyClass"), new ImmutableByteArray(UTF8Convert
.toUTF8("([Ljava/lang/String;)Ljava/lang/Class;"))));
}
public void testLocalNamesWithoutPiNodes() {
boolean save = options.getSSAOptions().getUsePiNodes();
options.getSSAOptions().setUsePiNodes( false );
IR ir = doMethod(scope.findMethod(AnalysisScope.APPLICATION, "LcornerCases/Locals", Atom.findOrCreateUnicodeAtom("foo"),
new ImmutableByteArray(UTF8Convert.toUTF8("([Ljava/lang/String;)V"))));
options.getSSAOptions().setUsePiNodes( save );
// v1 should be the parameter "a" at pc 0
String[] names = ir.getLocalNames(0,1);
assertTrue("failed local name resolution for v1@0" , names != null);
assertTrue("incorrect number of local names for v1@0: " + names.length , names.length == 1);
assertTrue("incorrect local name resolution for v1@0: " + names[0], names[0].equals("a"));
// v2 is a compiler-induced temporary
assertTrue("didn't expect name for v2 at pc 2" , ir.getLocalNames(2,2) == null);
// at pc 5, v1 should represent the locals "a" and "b"
names = ir.getLocalNames(5,1);
assertTrue("failed local name resolution for v1@5" , names != null);
assertTrue("incorrect number of local names for v1@5: " + names.length , names.length == 2);
assertTrue("incorrect local name resolution #0 for v1@5: " + names[0], names[0].equals("a"));
assertTrue("incorrect local name resolution #1 for v1@5: " + names[1], names[1].equals("b"));
}
public void testLocalNamesWithPiNodes() {
boolean save = options.getSSAOptions().getUsePiNodes();
options.getSSAOptions().setUsePiNodes( true );
IR ir = doMethod(scope.findMethod(AnalysisScope.APPLICATION, "LcornerCases/Locals", Atom.findOrCreateUnicodeAtom("foo"),
new ImmutableByteArray(UTF8Convert.toUTF8("([Ljava/lang/String;)V"))));
options.getSSAOptions().setUsePiNodes( save );
// v1 should be the parameter "a" at pc 0
String[] names = ir.getLocalNames(0,1);
assertTrue("failed local name resolution for v1@0" , names != null);
assertTrue("incorrect number of local names for v1@0: " + names.length , names.length == 1);
assertTrue("incorrect local name resolution for v1@0: " + names[0], names[0].equals("a"));
// v2 is a compiler-induced temporary
assertTrue("didn't expect name for v2 at pc 2" , ir.getLocalNames(2,2) == null);
// at pc 5, v1 should represent the locals "a" and "b"
names = ir.getLocalNames(5,1);
assertTrue("failed local name resolution for v1@5" , names != null);
assertTrue("incorrect number of local names for v1@5: " + names.length , names.length == 2);
assertTrue("incorrect local name resolution #0 for v1@5: " + names[0], names[0].equals("a"));
assertTrue("incorrect local name resolution #1 for v1@5: " + names[1], names[1].equals("b"));
}
}

View File

@ -1,92 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.ptrs;
import java.util.Iterator;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.intset.OrdinalSet;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
* Test for pointer analysis of multidimensional arrays
*
* @author sfink
*/
public class MultiDimArrayTest extends WalaTestCase {
public static void main(String[] args) {
justThisTest(MultiDimArrayTest.class);
}
/**
* Constructor for SpecJTest.
*
* @param arg0
*/
public MultiDimArrayTest(String arg0) {
super(arg0);
}
public void testMultiDim() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util
.makeMainEntrypoints(scope, cha, TestConstants.MULTI_DIM_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
PointerAnalysis pa = builder.getPointerAnalysis();
System.err.println(pa);
CGNode node = findDoNothingNode(cg);
PointerKey pk = pa.getHeapModel().getPointerKeyForLocal(node, 1);
OrdinalSet<InstanceKey> ptsTo = pa.getPointsToSet(pk);
assertEquals(1, ptsTo.size());
}
private final static CGNode findDoNothingNode(CallGraph cg) {
for (Iterator<? extends CGNode> it = cg.iterateNodes(); it.hasNext(); ) {
CGNode n = it.next();
if (n.getMethod().getName().toString().equals("doNothing")) {
return n;
}
}
Assertions.UNREACHABLE("Unexpected: failed to find doNothing node");
return null;
}
}

View File

@ -1,542 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.slicer;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Iterator;
import junit.framework.TestCase;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.examples.drivers.GVSlice;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ipa.slicer.NormalStatement;
import com.ibm.wala.ipa.slicer.Slicer;
import com.ibm.wala.ipa.slicer.Statement;
import com.ibm.wala.ipa.slicer.Slicer.ControlDependenceOptions;
import com.ibm.wala.ipa.slicer.Slicer.DataDependenceOptions;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAArrayLoadInstruction;
import com.ibm.wala.ssa.SSAConditionalBranchInstruction;
import com.ibm.wala.ssa.SSAGetInstruction;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAInvokeInstruction;
import com.ibm.wala.ssa.SSANewInstruction;
import com.ibm.wala.ssa.SSAPutInstruction;
import com.ibm.wala.types.Descriptor;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.warnings.WarningSet;
public class SlicerTest extends TestCase {
public void testSlice1() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE1_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallTo(main, "print");
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(18, slice.size());
}
public void testSlice2() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE2_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMethod(cg, "baz");
Statement s = findCallTo(main, "print");
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(22, slice.size());
}
public void testSlice3() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE3_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMethod(cg, "main");
Statement s = findCallTo(main, "doNothing");
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(1, countAllocations(slice));
}
public void testSlice4() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE4_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallTo(main, "foo");
s = GVSlice.getReturnStatementForCall(s);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeForwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(4, slice.size());
}
public void testSlice5() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE5_MAIN);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode n = findMethod(cg, "baz");
Statement s = findCallTo(n, "foo");
s = GVSlice.getReturnStatementForCall(s);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeForwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(7, slice.size());
}
public void testTestCD1() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTCD1);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.NONE,
ControlDependenceOptions.FULL);
dumpSlice(slice);
assertEquals(2, countConditionals(slice));
}
public void testTestCD2() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTCD2);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.NONE,
ControlDependenceOptions.FULL);
dumpSlice(slice);
assertEquals(1, countConditionals(slice));
}
public void testTestCD3() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTCD3);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.NONE,
ControlDependenceOptions.FULL);
dumpSlice(slice);
assertEquals(0, countConditionals(slice));
}
public void testTestId() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTID);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(1, countAllocations(slice));
}
public void testTestArrays() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTARRAYS);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(2, countAllocations(slice));
assertEquals(1, countAloads(slice));
}
public void testTestFields() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTFIELDS);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(2, countAllocations(slice));
assertEquals(1, countPutfields(slice));
}
public void testThin1() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTTHIN1);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute normal data slice
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(3, countAllocations(slice));
assertEquals(2, countPutfields(slice));
// compute thin slice .. ignore base pointers
slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.NO_BASE_PTRS,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(2, countAllocations(slice));
assertEquals(1, countPutfields(slice));
}
public void testTestGlobal() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTGLOBAL);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(1, countAllocations(slice));
assertEquals(2, countPutstatics(slice));
assertEquals(2, countGetstatics(slice));
}
public void testTestMultiTarget() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
TestConstants.SLICE_TESTMULTITARGET);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(2, countAllocations(slice));
}
public void testTestRecursion() throws ClassHierarchyException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
TestConstants.SLICE_TESTRECURSION);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
CGNode main = findMainMethod(cg);
Statement s = findCallToDoNothing(main);
System.err.println("Statement: " + s);
// compute a data slice
Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), DataDependenceOptions.FULL,
ControlDependenceOptions.NONE);
dumpSlice(slice);
assertEquals(3, countAllocations(slice));
assertEquals(2, countPutfields(slice));
}
private int countAllocations(Collection<Statement> slice) {
int count = 0;
for (Statement s : slice) {
if (s.getKind().equals(Statement.Kind.NORMAL)) {
NormalStatement ns = (NormalStatement) s;
if (ns.getInstruction() instanceof SSANewInstruction) {
count++;
}
}
}
return count;
}
private int countAloads(Collection<Statement> slice) {
int count = 0;
for (Statement s : slice) {
if (s.getKind().equals(Statement.Kind.NORMAL)) {
NormalStatement ns = (NormalStatement) s;
if (ns.getInstruction() instanceof SSAArrayLoadInstruction) {
count++;
}
}
}
return count;
}
private int countConditionals(Collection<Statement> slice) {
int count = 0;
for (Statement s : slice) {
if (s.getKind().equals(Statement.Kind.NORMAL)) {
NormalStatement ns = (NormalStatement) s;
if (ns.getInstruction() instanceof SSAConditionalBranchInstruction) {
count++;
}
}
}
return count;
}
private int countPutfields(Collection<Statement> slice) {
int count = 0;
for (Statement s : slice) {
if (s.getKind().equals(Statement.Kind.NORMAL)) {
NormalStatement ns = (NormalStatement) s;
if (ns.getInstruction() instanceof SSAPutInstruction) {
SSAPutInstruction p = (SSAPutInstruction) ns.getInstruction();
if (!p.isStatic()) {
count++;
}
}
}
}
return count;
}
private int countPutstatics(Collection<Statement> slice) {
int count = 0;
for (Statement s : slice) {
if (s.getKind().equals(Statement.Kind.NORMAL)) {
NormalStatement ns = (NormalStatement) s;
if (ns.getInstruction() instanceof SSAPutInstruction) {
SSAPutInstruction p = (SSAPutInstruction) ns.getInstruction();
if (p.isStatic()) {
count++;
}
}
}
}
return count;
}
private int countGetstatics(Collection<Statement> slice) {
int count = 0;
for (Statement s : slice) {
if (s.getKind().equals(Statement.Kind.NORMAL)) {
NormalStatement ns = (NormalStatement) s;
if (ns.getInstruction() instanceof SSAGetInstruction) {
SSAGetInstruction p = (SSAGetInstruction) ns.getInstruction();
if (p.isStatic()) {
count++;
}
}
}
}
return count;
}
public static void dumpSlice(Collection<Statement> slice) {
dumpSlice(slice,new PrintWriter(System.err));
}
public static void dumpSlice(Collection<Statement> slice, PrintWriter w) {
w.println("SLICE:\n");
int i = 1;
for (Statement s : slice) {
String line = (i++) + " " + s;
w.println(line);
w.flush();
}
}
public static void dumpSliceToFile(Collection<Statement> slice, String fileName) throws FileNotFoundException {
File f = new File(fileName);
FileOutputStream fo = new FileOutputStream(f);
PrintWriter w = new PrintWriter(fo);
dumpSlice(slice,w);
}
public static CGNode findMainMethod(CallGraph cg) {
Descriptor d = Descriptor.findOrCreateUTF8("([Ljava/lang/String;)V");
Atom name = Atom.findOrCreateUnicodeAtom("main");
for (Iterator<? extends CGNode> it = cg.getSuccNodes(cg.getFakeRootNode()); it.hasNext();) {
CGNode n = it.next();
if (n.getMethod().getName().equals(name) && n.getMethod().getDescriptor().equals(d)) {
return n;
}
}
Assertions.UNREACHABLE("failed to find main() method");
return null;
}
public static CGNode findMethod(CallGraph cg, String name) {
Atom a = Atom.findOrCreateUnicodeAtom(name);
for (Iterator<? extends CGNode> it = cg.iterateNodes(); it.hasNext();) {
CGNode n = it.next();
if (n.getMethod().getName().equals(a)) {
return n;
}
}
System.err.println("call graph " + cg);
Assertions.UNREACHABLE("failed to find method " + name);
return null;
}
public static Statement findCallTo(CGNode n, String methodName) {
IR ir = n.getCallGraph().getInterpreter(n).getIR(n, new WarningSet());
for (Iterator<SSAInstruction> it = ir.iterateAllInstructions(); it.hasNext();) {
SSAInstruction s = it.next();
if (s instanceof SSAInvokeInstruction) {
if (s.toString().indexOf(methodName) > -1) {
IntSet indices = ir.getCallInstructionIndices(((SSAInvokeInstruction) s).getCallSite());
Assertions.productionAssertion(indices.size()== 1, "expected 1 but got " + indices.size());
return new NormalStatement(n, indices.intIterator().next());
}
}
}
Assertions.UNREACHABLE("failed to find call to " + methodName + " in " + n);
return null;
}
private static Statement findCallToDoNothing(CGNode n) {
return findCallTo(n, "doNothing");
}
}

View File

@ -1,54 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.core.tests.util;
public interface TestConstants {
public final static String WALA_TESTDATA = "wala.testdata.xml";
public static final String CLASSCONSTANT_MAIN = "LclassConstant/ClassConstant";
public static final String PI_TEST_MAIN = "Lpi/PiNodeCallGraphTestCase";
public static final String RECURSE_MAIN = "Lrecurse/NList";
public final static String HELLO = "hello.xml";
public final static String HELLO_MAIN = "Lhello/Hello";
public final static String BCEL = "bcel.xml";
public final static String BCEL_VERIFIER_MAIN = "Lorg/apache/bcel/verifier/Verifier";
public final static String JLEX = "JLex.xml";
public final static String JLEX_MAIN = "LJLex/Main";
public final static String JAVA_CUP = "java_cup.xml";
public final static String JAVA_CUP_MAIN = "Ljava_cup/Main";
public final static String MULTI_DIM_MAIN = "LmultiDim/TestMultiDim";
public final static String REFLECT1_MAIN = "Lreflection/Reflect1";
public final static String SLICE1_MAIN = "Lslice/Slice1";
public final static String SLICE2_MAIN = "Lslice/Slice2";
public final static String SLICE3_MAIN = "Lslice/Slice3";
public final static String SLICE4_MAIN = "Lslice/Slice4";
public final static String SLICE5_MAIN = "Lslice/Slice5";
public final static String SLICE_TESTCD1 = "Lslice/TestCD1";
public final static String SLICE_TESTCD2 = "Lslice/TestCD2";
public final static String SLICE_TESTCD3 = "Lslice/TestCD3";
public final static String SLICE_TESTID = "Lslice/TestId";
public final static String SLICE_TESTARRAYS = "Lslice/TestArrays";
public final static String SLICE_TESTFIELDS = "Lslice/TestFields";
public final static String SLICE_TESTGLOBAL = "Lslice/TestGlobal";
public final static String SLICE_TESTMULTITARGET = "Lslice/TestMultiTarget";
public final static String SLICE_TESTRECURSION = "Lslice/TestRecursion";
public final static String SLICE_TESTTHIN1 = "Lslice/TestThin1";
}

View File

@ -1,100 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.core.tests.util;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.heapTrace.HeapTracer;
/**
*
* Simple extension to JUnit test case.
*
* @author sfink
*/
public abstract class WalaTestCase extends TestCase {
final private static boolean ANALYZE_LEAKS = false;
public static boolean useShortProfile() {
String profile = System.getProperty("com.ibm.wala.junit.profile", "long");
if (profile.equals("short")) {
return true;
} else {
return false;
}
}
private String baseTraceFile;
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
baseTraceFile = Trace.getTraceFile();
if (baseTraceFile != null) {
Trace.setTraceFile(baseTraceFile + "." + getName());
}
}
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
if (baseTraceFile != null) {
Trace.setTraceFile(baseTraceFile);
}
if (ANALYZE_LEAKS) {
HeapTracer.analyzeLeaks();
}
}
public WalaTestCase() {
super("DomoTestCase");
}
/**
* Utility function: each DetoxTestCase subclass can have a main() method that
* calls this, to create a test suite consisting of just this test. Useful
* when investigating a single failing test.
*/
protected static void justThisTest(Class<?> testClass) {
TestSuite suite = new TestSuite(testClass.getName());
suite.addTestSuite(testClass);
junit.textui.TestRunner.run(suite);
}
/**
* @param arg0
*/
public WalaTestCase(String arg0) {
super(arg0);
}
protected static void assertBound(String tag, double quantity, double bound) {
String msg = tag + ", quantity: " + quantity + ", bound:" + bound;
Trace.println(msg);
assertTrue(msg, quantity <= bound);
}
protected static void assertBound(String tag, int quantity, int bound) {
String msg = tag + ", quantity: " + quantity + ", bound:" + bound;
Trace.println(msg);
assertTrue(msg, quantity <= bound);
}
}

View File

@ -1,299 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006 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.examples.analysis;
import com.ibm.wala.classLoader.*;
import com.ibm.wala.client.impl.*;
import com.ibm.wala.ipa.callgraph.*;
import com.ibm.wala.ipa.callgraph.impl.*;
import com.ibm.wala.ipa.callgraph.propagation.*;
import com.ibm.wala.ipa.cha.*;
import com.ibm.wala.types.*;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.intset.*;
import java.io.*;
import java.util.*;
import java.util.jar.*;
/**
* <P>
* A simple thread-level escape analysis: this code computes the set of classes
* of which some instance may be accessed by some thread other than the one that
* created it.
* </P>
*
* <P>
* The algorithm is not very bright; it is based on the observation that there
* are only three ways for an object to pass from one thread to another.
* <UL>
* <LI> The object is stored into a static variable.
* <LI> The object is stored into an instance field of a Thread
* <LI> The object is reachable from a field of another escaping object.
* </UL>
* </P>
*
* <P>
* This observation is implemented in the obvious way:
* <OL>
* <LI> All static fields are collected
* <LI> All Thread constructor parameters are collected
* <LI> The points-to sets of these values represent the base set of escapees.
* <LI> All object reachable from fields of these objects are added
* <LI> This process continues until a fixpoint is reached
* <LI> The abstract objects in the points-to sets are converted to types
* <LI> This set of types is returned
* </OL></P>
*
* @author Julian Dolby
*/
public class SimpleThreadEscapeAnalysis extends AbstractAnalysisEngine {
private final Set<JarFile> applicationJarFiles;
private final String applicationMainClass;
/**
* The two input parameters define the program to analyze: the jars of .class
* files and the main class to start from.
*/
public SimpleThreadEscapeAnalysis(Set<JarFile> applicationJarFiles, String applicationMainClass) {
this.applicationJarFiles = applicationJarFiles;
this.applicationMainClass = applicationMainClass;
}
/**
* Given a root path, add it to the set if it is a jar, or traverse it
* recursively if it is a directory.
*/
private void collectJars(File f, Set<JarFile> result) throws IOException {
if (f.isDirectory()) {
File[] files = f.listFiles();
for (int i = 0; i < files.length; i++) {
collectJars(files[i], result);
}
} else if (f.getAbsolutePath().endsWith(".jar")) {
result.add(new JarFile(f));
}
}
/**
* Collect the set of JarFiles that constitute the system libraries of the
* running JRE.
*/
private JarFile[] getSystemJars() throws IOException {
Set<JarFile> jarFiles = HashSetFactory.make();
String javaHomePath = System.getProperty("java.home");
if (!javaHomePath.endsWith(File.separator)) {
javaHomePath = javaHomePath + File.separator;
}
collectJars(new File(javaHomePath + "lib"), jarFiles);
return jarFiles.toArray(new JarFile[jarFiles.size()]);
}
/**
* Take the given set of JarFiles that constitute the program, and return a
* set of Module files as expected by the WALA machinery.
*/
private Set<JarFileModule> getModuleFiles() {
Set<JarFileModule> result = HashSetFactory.make();
for (Iterator<JarFile> jars = applicationJarFiles.iterator(); jars.hasNext();) {
result.add(new JarFileModule(jars.next()));
}
return result;
}
/**
* The heart of the analysis.
*/
public Set<IClass> gatherThreadEscapingClasses() throws IOException, ClassHierarchyException {
//
// set the application to analyze
//
setModuleFiles(getModuleFiles());
//
// set the system jar files to use.
// change this if you want to use a specific jre version
//
setJ2SELibraries(getSystemJars());
//
// the application and libraries are set, now build the scope...
//
buildAnalysisScope();
//
// ...and the class hierarchy
//
ClassHierarchy cha = buildClassHierarchy();
setClassHierarchy(cha);
//
// select the call graph construction algorithm
// change this if greater precision is desired
// (see com.ibm.wala.client.impl.*BuilderFactory)
//
setCallGraphBuilderFactory(new ZeroCFABuilderFactory());
//
// entrypoints are where analysis starts
//
Entrypoints roots = Util.makeMainEntrypoints(getScope(), cha, applicationMainClass);
//
// analysis options controls aspects of call graph construction
//
AnalysisOptions options = getDefaultOptions(roots);
//
// build the call graph
//
buildCallGraph(cha, options, true);
//
// extract data for analysis
//
CallGraph cg = getCallGraph();
PointerAnalysis pa = getPointerAnalysis();
//
// collect all places where objects can escape their creating thread:
// 1) all static fields
// 2) arguments to Thread constructors
//
Set<PointerKey> escapeAnalysisRoots = HashSetFactory.make();
HeapModel heapModel = pa.getHeapModel();
// 1) static fields
for (Iterator<IClass> clss = cha.iterateAllClasses(); clss.hasNext();) {
IClass cls = (IClass) clss.next();
Collection<IField> staticFields = cls.getDeclaredStaticFields();
for (Iterator<IField> sfs = staticFields.iterator(); sfs.hasNext();) {
IField sf = (IField) sfs.next();
if (sf.getFieldTypeReference().isReferenceType()) {
escapeAnalysisRoots.add(heapModel.getPointerKeyForStaticField(sf));
}
}
}
// 2) instance fields of Threads
// (we hack this by getting the 'this' parameter of all ctor calls;
// this works because the next phase will add all objects transitively
// reachable from fields of types in these pointer keys, and all
// Thread objects must be constructed somewhere)
Collection<IClass> threads = cha.computeSubClasses(TypeReference.JavaLangThread);
for (Iterator<IClass>clss = threads.iterator(); clss.hasNext();) {
IClass cls = (IClass) clss.next();
for (Iterator<IMethod> ms = cls.getDeclaredMethods(); ms.hasNext();) {
IMethod m = (IMethod) ms.next();
if (m.isInit()) {
Set<CGNode> nodes = cg.getNodes(m.getReference());
for (Iterator<CGNode> ns = nodes.iterator(); ns.hasNext();) {
CGNode n = (CGNode) ns.next();
escapeAnalysisRoots.add(heapModel.getPointerKeyForLocal(n, 1));
}
}
}
}
//
// compute escaping types: all types flowing to escaping roots and
// all types transitively reachable through their fields.
//
Set<InstanceKey> escapingInstanceKeys = HashSetFactory.make();
//
// pass 1: get abstract objects (instance keys) for escaping locations
//
for (Iterator<PointerKey> rts = escapeAnalysisRoots.iterator(); rts.hasNext();) {
PointerKey root = rts.next();
OrdinalSet<InstanceKey> objects = pa.getPointsToSet(root);
for (Iterator<InstanceKey> objs = objects.iterator(); objs.hasNext();) {
InstanceKey obj = (InstanceKey) objs.next();
escapingInstanceKeys.add(obj);
}
}
//
// passes 2+: get fields of escaping keys, and add pointed-to keys
//
Set<InstanceKey> newKeys = HashSetFactory.make();
do {
newKeys.clear();
for (Iterator<InstanceKey> keys = escapingInstanceKeys.iterator(); keys.hasNext();) {
InstanceKey key = keys.next();
IClass type = key.getConcreteType();
if (type.isReferenceType()) {
if (type.isArrayClass()) {
if (((ArrayClass) type).getElementClass() != null) {
PointerKey fk = heapModel.getPointerKeyForArrayContents(key);
OrdinalSet<InstanceKey> fobjects = pa.getPointsToSet(fk);
for (Iterator<InstanceKey> fobjs = fobjects.iterator(); fobjs.hasNext();) {
InstanceKey fobj = (InstanceKey) fobjs.next();
if (!escapingInstanceKeys.contains(fobj)) {
newKeys.add(fobj);
}
}
}
} else {
Collection<IField> fields = type.getAllInstanceFields();
for (Iterator<IField> fs = fields.iterator(); fs.hasNext();) {
IField f = (IField) fs.next();
if (f.getFieldTypeReference().isReferenceType()) {
PointerKey fk = heapModel.getPointerKeyForInstanceField(key, f);
OrdinalSet<InstanceKey> fobjects = pa.getPointsToSet(fk);
for (Iterator<InstanceKey> fobjs = fobjects.iterator(); fobjs.hasNext();) {
InstanceKey fobj = (InstanceKey) fobjs.next();
if (!escapingInstanceKeys.contains(fobj)) {
newKeys.add(fobj);
}
}
}
}
}
}
}
escapingInstanceKeys.addAll(newKeys);
} while (!newKeys.isEmpty());
//
// get set of types from set of instance keys
//
Set<IClass> escapingTypes = HashSetFactory.make();
for (Iterator<InstanceKey> keys = escapingInstanceKeys.iterator(); keys.hasNext();) {
InstanceKey key = keys.next();
escapingTypes.add(key.getConcreteType());
}
return escapingTypes;
}
public static void main(String[] args) throws IOException, ClassHierarchyException {
String mainClassName = args[0];
Set<JarFile> jars = HashSetFactory.make();
for (int i = 1; i < args.length; i++) {
jars.add(new JarFile(args[i]));
}
Set<IClass> escapingTypes = (new SimpleThreadEscapeAnalysis(jars, mainClassName)).gatherThreadEscapingClasses();
for (Iterator<IClass> types = escapingTypes.iterator(); types.hasNext();) {
System.out.println(types.next().getName().toString());
}
}
}

View File

@ -1,225 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import org.eclipse.emf.ecore.EObject;
import com.ibm.wala.ecore.java.ECallSite;
import com.ibm.wala.ecore.java.EJavaClass;
import com.ibm.wala.ecore.java.EJavaMethod;
import com.ibm.wala.ecore.java.callGraph.ECallGraph;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFBridge;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.EObjectDictionary;
import com.ibm.wala.emf.wrappers.EObjectGraph;
import com.ibm.wala.emf.wrappers.EObjectGraphImpl;
import com.ibm.wala.emf.wrappers.EUtil;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.collections.Iterator2Collection;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
/**
* This simple example application builds a call graph writes it to an XML file
*
* @author sfink
*/
public class ExportCallGraphToXML {
/**
* Usage: ExportCallGraphToXML -appJar [jar file name] The "jar file name"
* should be something like "c:/temp/testdata/java_cup.jar"
*
* @param args
*/
public static void main(String[] args) {
run(args);
}
/**
* Usage: args = "-appJar [jar file name] " The "jar file name" should be
* something like "c:/temp/testdata/java_cup.jar"
*
* @param args
*/
public static void run(String[] args) {
validateCommandLine(args);
run(args[1]);
}
/**
* @param appJar
* something like "c:/temp/testdata/java_cup.jar"
*/
public static void run(String appJar) {
try {
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
// generate a DOMO-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// TODO: return the warning set (need a CAPA type)
// invoke DOMO to build a DOMO class hierarchy object
WarningSet warnings = new WarningSet();
System.err.println("Build class hierarchy...");
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
// //
// build the call graph
// //
System.err.println("Build callgraph...");
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cha, scope, warnings, null, null);
CallGraph cg = builder.makeCallGraph(options);
System.err.println("Convert to EMF...");
com.ibm.wala.emf.wrappers.ECallGraphWrapper ccg = EMFBridge.makeCallGraph(cg);
ECallGraph ecg = (ECallGraph) ccg.export();
Properties p = null;
;
try {
p = WalaProperties.loadProperties();
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String filename = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + "cg.xml";
System.err.println("Writing to file: " + filename);
write(ecg, filename);
// try and load it too
List<EObject> l = EUtil.readEObjects(filename, ExportCallGraphToXML.class.getClassLoader());
// convert it to a default graph for kicks
ECallGraph output = (ECallGraph) l.get(0);
System.err.println(output.getClass());
EObjectGraph graph = EObjectGraphImpl.fromEMF(output);
System.err.println("read " + graph.getNumberOfNodes() + " nodes");
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@SuppressWarnings("unchecked")
private static void write(ECallGraph cg, String filename) throws WalaException {
// make sure every java method reachable from the call graph
// is a node is the call graph
Collection c = new Iterator2Collection<EObject>(cg.getNodes().getContents().iterator());
for (Iterator it = c.iterator(); it.hasNext();) {
Object node = it.next();
if (node instanceof ECallSite) {
ECallSite site = (ECallSite) node;
EJavaMethod method = site.getDeclaredTarget();
if (!c.contains(method)) {
cg.getNodes().getContents().add(method);
}
method = site.getJavaMethod();
if (!c.contains(method)) {
cg.getNodes().getContents().add(method);
}
}
}
// make a canonical dictionary of all method nodes
EObjectDictionary methodNodes = new EObjectDictionary();
for (Iterator<EJavaMethod> it = cg.getNodes().getContents().iterator(); it.hasNext();) {
Object node = it.next();
if (node instanceof EJavaMethod) {
EJavaMethod method = (EJavaMethod) node;
methodNodes.findOrAdd(method);
}
}
// Create a collection of EObjects to persist
Collection persist = new LinkedList();
// Persist the call graph itself
persist.add(cg);
// Persist the nodes of the call graph which are NOT contained in the
// ECallGraph
persist.add(cg.getNodes());
// Persist all Java classes reachable from the call graph,
// and make sure pointers are canonical
EObjectDictionary klasses = new EObjectDictionary();
for (Iterator<EJavaMethod> it = cg.getNodes().getContents().iterator(); it.hasNext();) {
Object node = it.next();
if (node instanceof ECallSite) {
ECallSite site = (ECallSite) node;
EJavaMethod method = (EJavaMethod) site.getDeclaredTarget();
method = (EJavaMethod) methodNodes.findOrAdd(method);
site.setDeclaredTarget(method);
EJavaClass klass = (EJavaClass) klasses.findOrAdd(method.getJavaClass());
method.setJavaClass(klass);
method = site.getJavaMethod();
method = (EJavaMethod) methodNodes.findOrAdd(method);
site.setJavaMethod(method);
klass = (EJavaClass) klasses.findOrAdd(method.getJavaClass());
method.setJavaClass(klass);
} else if (node instanceof EJavaMethod) {
EJavaMethod method = (EJavaMethod) node;
EJavaClass klass = (EJavaClass) klasses.findOrAdd(method.getJavaClass());
method.setJavaClass(klass);
} else {
Assertions.UNREACHABLE("Unexpected type " + node.getClass());
}
}
persist.add(klasses.export(true));
// Save everything to a file.
EUtil.saveToFile(persist, filename);
}
/**
* Validate that the command-line arguments obey the expected usage.
*
* Usage:
* <ul>
* <li> args[0] : "-appJar"
* <li> args[1] : something like "c:/temp/testdata/java_cup.jar" </ul?
*
* @param args
* @throws UnsupportedOperationException
* if command-line is malformed.
*/
static void validateCommandLine(String[] args) {
if (args.length != 2) {
throw new UnsupportedOperationException("must have at exactly 2 command-line arguments");
}
if (!args[0].equals("-appJar")) {
throw new UnsupportedOperationException("invalid command-line, args[0] should be -appJar, but is " + args[0]);
}
}
}

View File

@ -1,160 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Properties;
import org.eclipse.emf.ecore.EObject;
import com.ibm.wala.ecore.java.ETypeHierarchy;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFBridge;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.EUtil;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
* This is a simple example WALA application. It's neither efficient
* nor concise, but is intended to demonstrate some basic framework concepts.
*
* This application builds a type hierarchy and dumps it to an XML file.
*
* @author sfink
*/
public class ExportTypeHierarchyToXML {
// This example takes one command-line argument, so args[1] should be the
// "-classpath"
// parameter
final static int CLASSPATH_INDEX = 1;
/**
* The name of the file to which the TypeHierarchyWriter will dump its output.
*/
private final static String FILENAME = "th.xml";
/**
* Usage: ExportTypeHierarchyToXML -classpath [classpath]
*
* @param args
*/
public static void main(String[] args) {
// check that the command-line is kosher
validateCommandLine(args);
try {
String classpath = args[CLASSPATH_INDEX];
System.err.println("build type hierarchy...");
WarningSet warnings = new WarningSet();
ETypeHierarchy th = buildTypeHierarchy(classpath, warnings);
if (th.getClasses().getNodes().getContents().size() <1) {
System.err.println("PANIC: type hierarchy # classes=" + th.getClasses().getNodes().getContents().size());
System.err.println(warnings.toString());
System.exit(-1);
}
String file = getFileName();
System.err.println("write to file " + file);
write(th,file);
Graph<EObject> g = GVTypeHierarchy.typeHierarchy2Graph(th);
g = GVTypeHierarchy.pruneForAppLoader(g);
if (g.getNumberOfNodes() == 0) {
System.err.println("ERROR: The type hierarchy in " + ExportTypeHierarchyToXML.getFileName() + " has no nodes from the Application loader");
System.err.println("Probably something's wrong with the input jars being analyzed.");
System.err.println("check the files in the path: " + classpath);
System.err.println("Also look at these warning messages:");
System.err.println(warnings.toString());
System.exit(-1);
}
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static void write(ETypeHierarchy t, String filename) throws WalaException {
if (filename == null) {
throw new WalaException("internal error: null filename parameter");
}
// Create a collection of EObjects to persist
Collection<EObject> persist = new LinkedList<EObject>();
// Persist the type hierarchy itself
persist.add(t);
// Persist the classes as well, which are NOT contained in the ETypeHierarchy
persist.add(t.getClasses().getNodes());
// Persist the interfaces as well, which are NOT contained in the ETypeHierarchy
persist.add(t.getInterfaces().getNodes());
// Save everything to a file.
EUtil.saveToFile(persist, filename);
}
static String getFileName() throws WalaException {
Properties p = null;;
try {
p = WalaProperties.loadProperties();
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String file = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + FILENAME;
return file;
}
public static ETypeHierarchy buildTypeHierarchy(String classpath, WarningSet warnings) throws WalaException {
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(classpath);
// generate a WALA-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// invoke WALA to build a class hierarchy
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
// Export the class hierarchy object to an EMF TypeHierarchy object
com.ibm.wala.emf.wrappers.ETypeHierarchyWrapper t1 = EMFBridge.makeTypeHierarchy(cha);
ETypeHierarchy th = (ETypeHierarchy) t1.toEMF();
return th;
}
/**
* Validate that the command-line arguments obey the expected usage.
*
* Usage: args[0] : "-classpath" args[1] : String, a ";"-delimited class path
*
* @param args
* @throws UnsupportedOperationException
* if command-line is malformed.
*/
static void validateCommandLine(String[] args) {
if (args.length < 2) {
throw new UnsupportedOperationException("must have at least 2 command-line arguments");
}
if (!args[0].equals("-classpath")) {
throw new UnsupportedOperationException("invalid command-line, args[0] should be -classpath, but is " + args[0]);
}
}
}

View File

@ -1,186 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Properties;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.LocalPointerKey;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.collections.Filter;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.io.CommandLine;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.DotUtil;
import com.ibm.wala.viz.GVUtil;
/**
*
* This simple example WALA application builds a call graph and fires off
* ghostview to viz a DOT representation.
*
* @author sfink
*/
public class GVCallGraph {
private final static String PS_FILE = "cg.ps";
/**
* Usage: GVCallGraph -appJar [jar file name] The "jar file name" should
* be something like "c:/temp/testdata/java_cup.jar"
*
* @param args
*/
public static void main(String[] args) {
run(args);
}
/**
* Usage: args = "-appJar [jar file name] " The "jar file name" should be
* something like "c:/temp/testdata/java_cup.jar"
*
* @param args
*/
public static Process run(String[] args) {
Properties p = CommandLine.parse(args);
validateCommandLine(p);
return run(p.getProperty("appJar"));
}
/**
* @param appJar
* something like "c:/temp/testdata/java_cup.jar"
*/
public static Process run(String appJar) {
try {
Graph<CGNode> g = buildPrunedCallGraph(appJar);
Properties p = null;
try {
p = WalaExamplesProperties.loadProperties();
p.putAll(WalaProperties.loadProperties());
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String psFile = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PS_FILE;
String dotExe = p.getProperty(WalaExamplesProperties.DOT_EXE);
DotUtil.dotify(g, null, GVTypeHierarchy.DOT_FILE, psFile, dotExe);
String gvExe = p.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
return GVUtil.launchGV(psFile, gvExe);
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
/**
* @param appJar
* something like "c:/temp/testdata/java_cup.jar"
* @return a call graph
* @throws WalaException
*/
public static Graph<CGNode> buildPrunedCallGraph(String appJar) throws WalaException {
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
// generate a DOMO-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// TODO: return the warning set (need a CAPA type)
// invoke DOMO to build a DOMO class hierarchy object
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
// //
// build the call graph
// //
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cha, scope, warnings, null, null);
CallGraph cg = builder.makeCallGraph(options);
Graph<CGNode> g = pruneForAppLoader(cg);
return g;
}
static Graph<CGNode> pruneForAppLoader(CallGraph g) throws WalaException {
return GVTypeHierarchy.pruneGraph(g, new ApplicationLoaderFilter());
}
/**
* Validate that the command-line arguments obey the expected usage.
*
* Usage:
* <ul>
* <li> args[0] : "-appJar"
* <li> args[1] : something like "c:/temp/testdata/java_cup.jar" </ul?
*
* @throws UnsupportedOperationException
* if command-line is malformed.
*/
static void validateCommandLine(Properties p) {
if (p.get("appJar") == null) {
throw new UnsupportedOperationException("expected command-line to include -appJar");
}
}
/**
* @author sfink
*
* A filter that accepts domo objects that "belong" to the application loader.
*
* Currently supported DOMO types include
* <ul>
* <li> CGNode
* <li> LocalPointerKey
* </ul>
*/
private static class ApplicationLoaderFilter implements Filter {
/*
* (non-Javadoc)
*
* @see com.ibm.capa.util.collections.Filter#accepts(java.lang.Object)
*/
public boolean accepts(Object o) {
if (o instanceof CGNode) {
CGNode n = (CGNode) o;
return n.getMethod().getDeclaringClass().getClassLoader().getReference().equals(ClassLoaderReference.Application);
} else if (o instanceof LocalPointerKey) {
LocalPointerKey l = (LocalPointerKey) o;
return accepts(l.getNode());
} else {
return false;
}
}
}
}

View File

@ -1,159 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Properties;
import com.ibm.wala.cfg.cdg.ControlDependenceGraph;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.StringStuff;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.DotUtil;
import com.ibm.wala.viz.GVUtil;
import com.ibm.wala.viz.GhostviewUtil;
/**
*
* This simple example application builds a WALA CDG and fires off ghostview
* to viz a DOT representation.
*
* @author sfink
*/
public class GVControlDependenceGraph {
final public static boolean SANITIZE_CFG = false;
final public static String PS_FILE = "cdg.ps";
/**
* Usage: GVControlDependenceGraph -appJar [jar file name] -sig [method signature] The "jar
* file name" should be something like "c:/temp/testdata/java_cup.jar" The
* signature should be something like "java_cup.lexer.advance()V"
*
* @param args
*/
public static void main(String[] args) {
run(args);
}
/**
* @param args
* -appJar [jar file name] -sig [method signature] The "jar file
* name" should be something like "c:/temp/testdata/java_cup.jar" The
* signature should be something like "java_cup.lexer.advance()V"
*/
public static Process run(String[] args) {
validateCommandLine(args);
return run(args[1], args[3]);
}
/**
* @param appJar
* should be something like "c:/temp/testdata/java_cup.jar"
* @param methodSig
* should be something like "java_cup.lexer.advance()V"
*/
public static Process run(String appJar, String methodSig) {
try {
if (SWTCallGraph.isDirectory(appJar)) {
appJar = SWTCallGraph.findJarFiles(new String[] { appJar });
}
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
// generate a DOMO-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// invoke DOMO to build a DOMO class hierarchy object
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
MethodReference mr = StringStuff.makeMethodReference(methodSig);
IMethod m = cha.resolveMethod(mr);
if (m == null) {
Assertions.UNREACHABLE("could not resolve " + mr);
}
AnalysisOptions options = new AnalysisOptions();
options.getSSAOptions().setUsePiNodes(true);
IR ir = options.getSSACache().findOrCreateIR(m, Everywhere.EVERYWHERE, cha, options.getSSAOptions(), new WarningSet());
if (ir == null) {
Assertions.UNREACHABLE("Null IR for " + m);
}
System.err.println(ir.toString());
ControlDependenceGraph cdg = new ControlDependenceGraph(ir.getControlFlowGraph());
Properties wp = null;
try {
wp = WalaProperties.loadProperties();
wp.putAll(WalaExamplesProperties.loadProperties());
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String psFile = wp.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + GVControlDependenceGraph.PS_FILE;
String dotFile = wp.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar
+ GVTypeHierarchy.DOT_FILE;
String dotExe = wp.getProperty(WalaExamplesProperties.DOT_EXE);
String gvExe = wp.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
DotUtil.dotify(cdg, GhostviewUtil.makeIRDecorator(ir), dotFile, psFile, dotExe);
return GVUtil.launchGV(psFile, gvExe);
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
/**
* Validate that the command-line arguments obey the expected usage.
*
* Usage:
* <ul>
* <li> args[0] : "-appJar"
* <li> args[1] : something like "c:/temp/testdata/java_cup.jar"
* <li> args[2] : "-sig"
* <li> args[3] : a method signature like "java_cup.lexer.advance()V" </ul?
*
* @param args
* @throws UnsupportedOperationException
* if command-line is malformed.
*/
static void validateCommandLine(String[] args) {
if (args.length != 4) {
throw new UnsupportedOperationException("must have at exactly 4 command-line arguments");
}
if (!args[0].equals("-appJar")) {
throw new UnsupportedOperationException("invalid command-line, args[0] should be -appJar, but is " + args[0]);
}
if (!args[2].equals("-sig")) {
throw new UnsupportedOperationException("invalid command-line, args[2] should be -sig, but is " + args[0]);
}
}
}

View File

@ -1,212 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Properties;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.slicer.HeapStatement;
import com.ibm.wala.ipa.slicer.SDG;
import com.ibm.wala.ipa.slicer.Statement;
import com.ibm.wala.ipa.slicer.Slicer.ControlDependenceOptions;
import com.ibm.wala.ipa.slicer.Slicer.DataDependenceOptions;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.collections.Filter;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.GraphIntegrity;
import com.ibm.wala.util.graph.GraphSlicer;
import com.ibm.wala.util.graph.NodeDecorator;
import com.ibm.wala.util.graph.GraphIntegrity.UnsoundGraphException;
import com.ibm.wala.util.io.CommandLine;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.DotUtil;
import com.ibm.wala.viz.GVUtil;
/**
*
* This simple example WALA application builds an SDG and fires off ghostview to
* viz a DOT representation.
*
* @author sfink
*/
public class GVSDG {
private final static String PS_FILE = "sdg.ps";
/**
* Usage: GVSDG -appJar [jar file name] -mainclass [main class]
*
* The "jar file name" should be something like
* "c:/temp/testdata/java_cup.jar"
*
* @param args
*/
public static void main(String[] args) {
run(args);
}
/**
*/
public static Process run(String[] args) {
Properties p = CommandLine.parse(args);
validateCommandLine(p);
return run(p.getProperty("appJar"), p.getProperty("mainClass"), getDataDependenceOptions(p), getControlDependenceOptions(p));
}
public static DataDependenceOptions getDataDependenceOptions(Properties p) {
String d = p.getProperty("dd","full");
for (DataDependenceOptions result : DataDependenceOptions.values()) {
if (d.equals(result.getName())) {
return result;
}
}
Assertions.UNREACHABLE("unknown data datapendence option: " + d);
return null;
}
public static ControlDependenceOptions getControlDependenceOptions(Properties p) {
String d = p.getProperty("cd","full");
for (ControlDependenceOptions result : ControlDependenceOptions.values()) {
if (d.equals(result.getName())) {
return result;
}
}
Assertions.UNREACHABLE("unknown control datapendence option: " + d);
return null;
}
/**
* @param appJar
* something like "c:/temp/testdata/java_cup.jar"
*/
public static Process run(String appJar, String mainClass, DataDependenceOptions dOptions, ControlDependenceOptions cOptions) {
try {
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
// generate a WALA-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
SDG sdg = new SDG(cg,builder.getPointerAnalysis(), dOptions, cOptions);
try {
GraphIntegrity.check(sdg);
} catch (UnsoundGraphException e1) {
e1.printStackTrace();
Assertions.UNREACHABLE();
}
System.err.println(sdg);
Properties p = null;
try {
p = WalaExamplesProperties.loadProperties();
p.putAll(WalaProperties.loadProperties());
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String psFile = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PS_FILE;
String dotExe = p.getProperty(WalaExamplesProperties.DOT_EXE);
Graph<Statement> g = pruneSDG(sdg);
DotUtil.dotify(g, makeNodeDecorator(), GVTypeHierarchy.DOT_FILE, psFile, dotExe);
String gvExe = p.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
return GVUtil.launchGV(psFile, gvExe);
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
private static Graph<Statement> pruneSDG(SDG sdg) {
Filter f = new Filter() {
public boolean accepts(Object o) {
Statement s = (Statement)o;
if (s.getNode().equals(s.getNode().getCallGraph().getFakeRootNode())) {
return false;
} else {
return true;
}
}
};
return GraphSlicer.prune(sdg, f);
}
private static NodeDecorator makeNodeDecorator() {
return new NodeDecorator() {
public String getLabel(Object o) throws WalaException {
Statement s = (Statement) o;
switch (s.getKind()) {
case HEAP_PARAM_CALLEE:
case HEAP_PARAM_CALLER:
case HEAP_RET_CALLEE:
case HEAP_RET_CALLER:
HeapStatement h =(HeapStatement)s;
return s.getKind() + "\\n" + h.getNode() + "\\n" + h.getLocation();
case EXC_RET_CALLEE:
case EXC_RET_CALLER:
case NORMAL:
case NORMAL_RET_CALLEE:
case NORMAL_RET_CALLER:
case PARAM_CALLEE:
case PARAM_CALLER:
case PHI:
default:
return s.toString();
}
}
};
}
/**
* Validate that the command-line arguments obey the expected usage.
*
* Usage:
* <ul>
* <li> args[0] : "-appJar"
* <li> args[1] : something like "c:/temp/testdata/java_cup.jar"
* <li> args[2] : "-mainClass"
* <li> args[3] : something like "Lslice/TestRecursion"
*
* @throws UnsupportedOperationException
* if command-line is malformed.
*/
static void validateCommandLine(Properties p) {
if (p.get("appJar") == null) {
throw new UnsupportedOperationException("expected command-line to include -appJar");
}
if (p.get("mainClass") == null) {
throw new UnsupportedOperationException("expected command-line to include -appJar");
}
}
}

View File

@ -1,259 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Collection;
import java.util.Properties;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.core.tests.slicer.SlicerTest;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.slicer.HeapStatement;
import com.ibm.wala.ipa.slicer.NormalStatement;
import com.ibm.wala.ipa.slicer.ParamStatement;
import com.ibm.wala.ipa.slicer.SDG;
import com.ibm.wala.ipa.slicer.Slicer;
import com.ibm.wala.ipa.slicer.Statement;
import com.ibm.wala.ipa.slicer.ParamStatement.CallStatementCarrier;
import com.ibm.wala.ipa.slicer.ParamStatement.ValueNumberCarrier;
import com.ibm.wala.ipa.slicer.Slicer.ControlDependenceOptions;
import com.ibm.wala.ipa.slicer.Slicer.DataDependenceOptions;
import com.ibm.wala.ipa.slicer.Statement.Kind;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAInvokeInstruction;
import com.ibm.wala.util.collections.Filter;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.GraphIntegrity;
import com.ibm.wala.util.graph.GraphSlicer;
import com.ibm.wala.util.graph.NodeDecorator;
import com.ibm.wala.util.graph.GraphIntegrity.UnsoundGraphException;
import com.ibm.wala.util.io.CommandLine;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.DotUtil;
import com.ibm.wala.viz.GVUtil;
/**
*
* This simple example WALA application builds an SDG and fires off ghostview to
* viz a DOT representation of a slice in the SDG
*
* @author sfink
*/
public class GVSlice {
private final static String PS_FILE = "slice.ps";
/**
* Usage: GVSDG -appJar [jar file name] -mainclass [main class] -src [method
* name]
*
* The "jar file name" should be something like
* "c:/temp/testdata/java_cup.jar"
*
* @param args
*/
public static void main(String[] args) {
run(args);
}
/**
*/
public static Process run(String[] args) {
Properties p = CommandLine.parse(args);
validateCommandLine(p);
return run(p.getProperty("appJar"), p.getProperty("mainClass"), p.getProperty("srcCaller"), p.getProperty("srcCallee"),
goBackward(p), GVSDG.getDataDependenceOptions(p), GVSDG.getControlDependenceOptions(p));
}
private static boolean goBackward(Properties p) {
return !p.getProperty("dir","backward").equals("forward");
}
/**
*/
public static Process run(String appJar, String mainClass, String srcCaller, String srcCallee, boolean goBackward, DataDependenceOptions dOptions,
ControlDependenceOptions cOptions) {
try {
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
// generate a WALA-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, cha, scope, warnings);
CallGraph cg = builder.makeCallGraph(options);
SDG sdg = new SDG(cg, builder.getPointerAnalysis(), dOptions, cOptions);
CGNode main = SlicerTest.findMethod(cg, srcCaller);
Statement s = SlicerTest.findCallTo(main, srcCallee);
System.err.println("Statement: " + s);
Collection<Statement> slice = null;
if (goBackward) {
slice = Slicer.computeBackwardSlice(s, cg, builder.getPointerAnalysis(), dOptions, cOptions);
} else {
// for forward slices ... we actually slice from the return value of calls.
s = getReturnStatementForCall(s);
slice = Slicer.computeForwardSlice(s, cg, builder.getPointerAnalysis(), dOptions, cOptions);
}
SlicerTest.dumpSlice(slice);
Graph<Statement> g = pruneSDG(sdg, slice);
try {
GraphIntegrity.check(g);
} catch (UnsoundGraphException e1) {
e1.printStackTrace();
Assertions.UNREACHABLE();
}
Assertions.productionAssertion(g.getNumberOfNodes() == slice.size(), "panic " + g.getNumberOfNodes() + " " + slice.size());
Properties p = null;
try {
p = WalaExamplesProperties.loadProperties();
p.putAll(WalaProperties.loadProperties());
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String psFile = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PS_FILE;
String dotExe = p.getProperty(WalaExamplesProperties.DOT_EXE);
DotUtil.dotify(g, makeNodeDecorator(), GVTypeHierarchy.DOT_FILE, psFile, dotExe);
String gvExe = p.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
return GVUtil.launchGV(psFile, gvExe);
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
/**
* If s is a call statement, return the statement representing the normal return from s
*/
public static Statement getReturnStatementForCall(Statement s) {
if (s.getKind() == Kind.NORMAL) {
SSAInstruction st = ((NormalStatement)s).getInstruction();
if (st instanceof SSAInvokeInstruction) {
return new ParamStatement.NormalReturnCaller(s.getNode(),(SSAInvokeInstruction)st);
} else {
return s;
}
} else {
return s;
}
}
public static Graph<Statement> pruneSDG(SDG sdg, final Collection<Statement> slice) {
Filter f = new Filter() {
public boolean accepts(Object o) {
return slice.contains(o);
}
};
return GraphSlicer.prune(sdg, f);
}
public static NodeDecorator makeNodeDecorator() {
return new NodeDecorator() {
public String getLabel(Object o) throws WalaException {
Statement s = (Statement) o;
switch (s.getKind()) {
case HEAP_PARAM_CALLEE:
case HEAP_PARAM_CALLER:
case HEAP_RET_CALLEE:
case HEAP_RET_CALLER:
HeapStatement h = (HeapStatement) s;
return s.getKind() + "\\n" + h.getNode() + "\\n" + h.getLocation();
case NORMAL:
NormalStatement n = (NormalStatement) s;
return n.getNode() + "\\n" + n.getInstruction();
case PARAM_CALLEE:
case PARAM_CALLER:
if (s instanceof ValueNumberCarrier) {
ValueNumberCarrier vc = (ValueNumberCarrier) s;
if (s instanceof CallStatementCarrier) {
CallStatementCarrier cc = (CallStatementCarrier) s;
return s.getKind() + "\\n" + s.getNode() + "\\n" + cc.getCall() + "\\nv" + vc.getValueNumber();
} else {
return s.getKind() + "\\n" + s.getNode() + "\\nv" + vc.getValueNumber();
}
} else {
if (s instanceof CallStatementCarrier) {
CallStatementCarrier cc = (CallStatementCarrier) s;
return s.getKind() + "\\n" + s.getNode() + "\\n" + cc.getCall();
} else {
return s.toString();
}
}
case EXC_RET_CALLEE:
case EXC_RET_CALLER:
case NORMAL_RET_CALLEE:
case NORMAL_RET_CALLER:
case PHI:
default:
return s.toString();
}
}
};
}
/**
* Validate that the command-line arguments obey the expected usage.
*
* Usage:
* <ul>
* <li> args[0] : "-appJar"
* <li> args[1] : something like "c:/temp/testdata/java_cup.jar"
* <li> args[2] : "-mainClass"
* <li> args[3] : something like "Lslice/TestRecursion" *
* <li> args[4] : "-srcCallee"
* <li> args[5] : something like "print" *
* <li> args[4] : "-srcCaller"
* <li> args[5] : something like "main"
*
* @throws UnsupportedOperationException
* if command-line is malformed.
*/
static void validateCommandLine(Properties p) {
if (p.get("appJar") == null) {
throw new UnsupportedOperationException("expected command-line to include -appJar");
}
if (p.get("mainClass") == null) {
throw new UnsupportedOperationException("expected command-line to include -mainClass");
}
if (p.get("srcCallee") == null) {
throw new UnsupportedOperationException("expected command-line to include -srcCallee");
}
if (p.get("srcCaller") == null) {
throw new UnsupportedOperationException("expected command-line to include -srcCaller");
}
}
}

View File

@ -1,156 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import org.eclipse.emf.ecore.EObject;
import com.ibm.wala.ecore.java.EClassLoaderName;
import com.ibm.wala.ecore.java.EJavaClass;
import com.ibm.wala.ecore.java.ETypeHierarchy;
import com.ibm.wala.emf.wrappers.EObjectGraphImpl;
import com.ibm.wala.emf.wrappers.ETypeHierarchyWrapper;
import com.ibm.wala.emf.wrappers.EUtil;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.CollectionFilter;
import com.ibm.wala.util.collections.Filter;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.GraphSlicer;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.DotUtil;
import com.ibm.wala.viz.GVUtil;
/**
*
* This simple example WALA application builds a TypeHierarchy and fires off
* ghostview to viz a DOT representation.
*
* @author sfink
*/
public class GVTypeHierarchy {
public final static String DOT_FILE = "temp.dt";
private final static String PS_FILE = "th.ps";
public static Properties p;
static {
try {
p = WalaProperties.loadProperties();
p.putAll(WalaExamplesProperties.loadProperties());
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
}
public static void main(String[] args) {
run(args, false);
}
public static Process run(String[] args, boolean readFromFile) {
try {
ETypeHierarchy th = null;
if (readFromFile) {
th = readTypeHierarchy();
} else {
ExportTypeHierarchyToXML.validateCommandLine(args);
String classpath = args[ExportTypeHierarchyToXML.CLASSPATH_INDEX];
th = ExportTypeHierarchyToXML.buildTypeHierarchy(classpath, new WarningSet());
}
Graph<EObject> g = typeHierarchy2Graph(th);
g = pruneForAppLoader(g);
String dotFile = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + DOT_FILE;
String psFile = p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PS_FILE;
String dotExe = p.getProperty(WalaExamplesProperties.DOT_EXE);
String gvExe = p.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
DotUtil.dotify(g, null, dotFile, psFile, dotExe);
return GVUtil.launchGV(psFile, gvExe);
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
/*
* (non-Javadoc)
*
* @see com.ibm.capa.core.EAnalysisEngine#processImpl()
*/
public static Graph<EObject> typeHierarchy2Graph(ETypeHierarchy et) throws WalaException {
ETypeHierarchyWrapper t = new ETypeHierarchyWrapper(et);
EObjectGraphImpl dg = new EObjectGraphImpl();
for (Iterator<? extends EObject> it = t.getClasses().iterateNodes(); it.hasNext();) {
dg.addNode(it.next());
}
for (Iterator<? extends EObject> it = t.getInterfaces().iterateNodes(); it.hasNext();) {
dg.addNode(it.next());
}
for (Iterator<? extends EObject> it = t.getClasses().iterateNodes(); it.hasNext();) {
EJavaClass x = (EJavaClass) it.next();
for (Iterator<? extends EObject> it2 = t.getClasses().getSuccNodes(x); it2.hasNext();) {
dg.addEdge(x, it2.next());
}
for (Iterator<? extends EObject> it2 = t.getImplements(x).iterator(); it2.hasNext();) {
dg.addEdge(it2.next(), x);
}
}
for (Iterator<? extends EObject> it = t.getInterfaces().iterateNodes(); it.hasNext();) {
EJavaClass x = (EJavaClass) it.next();
for (Iterator<? extends EObject> it2 = t.getInterfaces().getSuccNodes(x); it2.hasNext();) {
dg.addEdge(x, it2.next());
}
}
return dg;
}
static Graph<EObject> pruneForAppLoader(Graph<EObject> g) throws WalaException {
Filter f = new Filter() {
public boolean accepts(Object o) {
if (o instanceof EJavaClass) {
EJavaClass klass = (EJavaClass) o;
return (klass.getLoader().equals(EClassLoaderName.APPLICATION_LITERAL));
} else {
return false;
}
}
};
return pruneGraph(g, f);
}
public static <T> Graph<T> pruneGraph(Graph<T> g, Filter f) throws WalaException {
Collection<T> slice = GraphSlicer.slice(g, f);
return GraphSlicer.prune(g, new CollectionFilter(slice));
}
static ETypeHierarchy readTypeHierarchy() throws WalaException {
List<EObject> l = EUtil.readEObjects(ExportTypeHierarchyToXML.getFileName(), ExportTypeHierarchyToXML.class.getClassLoader());
return (ETypeHierarchy) l.get(0);
}
}

View File

@ -1,152 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Properties;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.StringStuff;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.GhostviewUtil;
/**
*
* This simple example application builds a WALA IR and fires off ghostview
* to viz a DOT representation.
*
* @author sfink
*/
public class GVWalaIR {
final public static boolean SANITIZE_CFG = false;
final public static String PS_FILE = "ir.ps";
/**
* Usage: GVWalaIR -appJar [jar file name] -sig [method signature] The "jar
* file name" should be something like "c:/temp/testdata/java_cup.jar" The
* signature should be something like "java_cup.lexer.advance()V"
*
* @param args
*/
public static void main(String[] args) {
run(args);
}
/**
* @param args
* -appJar [jar file name] -sig [method signature] The "jar file
* name" should be something like "c:/temp/testdata/java_cup.jar" The
* signature should be something like "java_cup.lexer.advance()V"
*/
public static Process run(String[] args) {
validateCommandLine(args);
return run(args[1], args[3]);
}
/**
* @param appJar
* should be something like "c:/temp/testdata/java_cup.jar"
* @param methodSig
* should be something like "java_cup.lexer.advance()V"
*/
public static Process run(String appJar, String methodSig) {
try {
if (SWTCallGraph.isDirectory(appJar)) {
appJar = SWTCallGraph.findJarFiles(new String[] { appJar });
}
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
// generate a DOMO-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// invoke DOMO to build a DOMO class hierarchy object
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
MethodReference mr = StringStuff.makeMethodReference(methodSig);
IMethod m = cha.resolveMethod(mr);
if (m == null) {
Assertions.UNREACHABLE("could not resolve " + mr);
}
AnalysisOptions options = new AnalysisOptions();
options.getSSAOptions().setUsePiNodes(true);
IR ir = options.getSSACache().findOrCreateIR(m, Everywhere.EVERYWHERE, cha, options.getSSAOptions(), new WarningSet());
if (ir == null) {
Assertions.UNREACHABLE("Null IR for " + m);
}
System.err.println(ir.toString());
Properties wp = null;
try {
wp = WalaProperties.loadProperties();
wp.putAll(WalaExamplesProperties.loadProperties());
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String psFile = wp.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + GVWalaIR.PS_FILE;
String dotFile = wp.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar
+ GVTypeHierarchy.DOT_FILE;
String dotExe = wp.getProperty(WalaExamplesProperties.DOT_EXE);
String gvExe = wp.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
return GhostviewUtil.ghostviewIR(cha, ir, SANITIZE_CFG, psFile, dotFile, dotExe, gvExe);
} catch (WalaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
/**
* Validate that the command-line arguments obey the expected usage.
*
* Usage:
* <ul>
* <li> args[0] : "-appJar"
* <li> args[1] : something like "c:/temp/testdata/java_cup.jar"
* <li> args[2] : "-sig"
* <li> args[3] : a method signature like "java_cup.lexer.advance()V" </ul?
*
* @param args
* @throws UnsupportedOperationException
* if command-line is malformed.
*/
static void validateCommandLine(String[] args) {
if (args.length != 4) {
throw new UnsupportedOperationException("must have at exactly 4 command-line arguments");
}
if (!args[0].equals("-appJar")) {
throw new UnsupportedOperationException("invalid command-line, args[0] should be -appJar, but is " + args[0]);
}
if (!args[2].equals("-sig")) {
throw new UnsupportedOperationException("invalid command-line, args[2] should be -sig, but is " + args[0]);
}
}
}

View File

@ -1,38 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.util.Iterator;
import java.util.Map;
import com.ibm.wala.util.system.Environment;
import com.ibm.wala.util.warnings.WalaException;
/**
*
* Test the functionality to read the OS environment
*
* @author sfink
*/
public class GetEnv {
public static void main(String[] args) {
try {
Map<String, String> m = Environment.readEnv();
for (Iterator<Map.Entry<String, String>> it = m.entrySet().iterator(); it.hasNext();) {
System.out.println(it.next());
}
} catch (WalaException e) {
e.printStackTrace();
}
}
}

View File

@ -1,198 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import java.util.Properties;
import org.eclipse.jface.window.ApplicationWindow;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphStats;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.GraphIntegrity;
import com.ibm.wala.util.graph.InferGraphRootsImpl;
import com.ibm.wala.util.io.CommandLine;
import com.ibm.wala.util.io.FileUtil;
import com.ibm.wala.util.perf.EngineTimings;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.SWTTreeViewer;
import com.ibm.wala.viz.ViewIRAction;
/**
*
* This application is a WALA client: it invokes an SWT TreeViewer to visualize
* a Call Graph
*
* @author sfink
*/
public class SWTCallGraph {
private final static boolean CHECK_GRAPH = false;
/**
* Usage: SWTCallGraph -appJar [jar file name]
*
* The "jar file name" should be something like
* "c:/temp/testdata/java_cup.jar"
*
* If it's a directory, then we'll try to find all jar files under that
* directory.
*
* @param args
* @throws WalaException
*/
public static void main(String[] args) throws WalaException {
Properties p = CommandLine.parse(args);
GVCallGraph.validateCommandLine(p);
run(p);
}
/**
* @param p
* should contain at least the following properties:
* <ul>
* <li>appJar should be something like
* "c:/temp/testdata/java_cup.jar"
* <li>algorithm (optional) can be one of:
* <ul>
* <li> "ZERO_CFA" (default value)
* <li> "RTA"
* </ul>
* </ul>
*
* @throws WalaException
*/
public static ApplicationWindow run(Properties p) throws WalaException {
try {
String appJar = p.getProperty("appJar");
if (isDirectory(appJar)) {
appJar = SWTCallGraph.findJarFiles(new String[] { appJar });
}
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
String exclusionFile = p.getProperty("exclusions");
if (exclusionFile != null) {
escope.setExclusionFileName(exclusionFile);
}
// generate a DOMO-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// TODO: return the warning set (need a CAPA type)
// invoke DOMO to build a DOMO class hierarchy object
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
// //
// build the call graph
// //
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cha, scope, warnings, null, null);
CallGraph cg = builder.makeCallGraph(options);
System.out.println(CallGraphStats.getStats(cg));
if (CHECK_GRAPH) {
GraphIntegrity.check(cg);
}
Properties wp = null;
try {
wp = WalaProperties.loadProperties();
wp.putAll(WalaExamplesProperties.loadProperties());
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String psFile = wp.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + GVWalaIR.PS_FILE;
String dotFile = wp.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + GVTypeHierarchy.DOT_FILE;
String dotExe = wp.getProperty(WalaExamplesProperties.DOT_EXE);
String gvExe = wp.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
// create and run the viewer
final SWTTreeViewer v = new SWTTreeViewer();
v.setGraphInput(cg);
v.setRootsInput(InferGraphRootsImpl.inferRoots(cg));
v.getPopUpActions().add(new ViewIRAction(v, cg, psFile, dotFile, dotExe, gvExe));
v.run();
return v.getApplicationWindow();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
EngineTimings.report();
}
}
// private static CallGraphConstructionAlgorithm chooseAlgorithm(Properties p)
// throws CapaException {
// String alg = p.getProperty("algorithm", "ZERO_CFA");
// if (alg.equals("ZERO_CFA")) {
// return CallGraphConstructionAlgorithm.ZERO_CFA_LITERAL;
// } else if (alg.equals("RTA")) {
// return CallGraphConstructionAlgorithm.RTA_LITERAL;
// } else if (alg.equals("ZERO_ONE_CFA")) {
// return CallGraphConstructionAlgorithm.VANILLA_ZERO_ONE_CFA_LITERAL;
// } else {
// throw new CapaException("Unsupported algorithm: " + alg);
// }
// }
static boolean isDirectory(String appJar) {
return (new File(appJar).isDirectory());
}
static String findJarFiles(String[] directories) throws WalaException {
Collection<String> result = HashSetFactory.make();
for (int i = 0; i < directories.length; i++) {
for (Iterator<File> it = FileUtil.listFiles(directories[i], ".*\\.jar", true).iterator(); it.hasNext();) {
File f = (File) it.next();
result.add(f.getAbsolutePath());
}
}
return composeString(result);
}
/**
* @param s
* Collection<String>
*/
private static String composeString(Collection<String> s) {
StringBuffer result = new StringBuffer();
Iterator<String> it = s.iterator();
for (int i = 0; i < s.size() - 1; i++) {
result.append(it.next());
result.append(';');
}
if (it.hasNext()) {
result.append(it.next());
}
return result.toString();
}
}

View File

@ -1,100 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.util.Properties;
import org.eclipse.jface.window.ApplicationWindow;
import com.ibm.wala.analysis.pointers.BasicHeapGraph;
import com.ibm.wala.ecore.java.scope.EJavaAnalysisScope;
import com.ibm.wala.emf.wrappers.EMFScopeWrapper;
import com.ibm.wala.emf.wrappers.JavaScopeUtil;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Entrypoints;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.InferGraphRootsImpl;
import com.ibm.wala.util.io.CommandLine;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.util.warnings.WarningSet;
import com.ibm.wala.viz.SWTTreeViewer;
/**
*
* This application is a WALA client: it invokes an SWT TreeViewer to visualize
* a Points-To solution
*
* @author sfink
*/
public class SWTPointsTo {
/**
* Usage: SWTPointsTo -appJar [jar file name] The "jar file name" should be
* something like "c:/temp/testdata/java_cup.jar"
*
* @param args
*/
public static void main(String[] args) {
Properties p = CommandLine.parse(args);
GVCallGraph.validateCommandLine(p);
run(p.getProperty("appJar"));
}
/**
* @param appJar
* should be something like "c:/temp/testdata/java_cup.jar"
*/
public static ApplicationWindow run(String appJar) {
try {
Graph<Object> g = buildPointsTo(appJar);
// create and run the viewer
final SWTTreeViewer v = new SWTTreeViewer();
v.setGraphInput(g);
v.setRootsInput(InferGraphRootsImpl.inferRoots(g));
v.run();
return v.getApplicationWindow();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Graph<Object> buildPointsTo(String appJar) throws WalaException {
EJavaAnalysisScope escope = JavaScopeUtil.makeAnalysisScope(appJar);
// generate a DOMO-consumable wrapper around the incoming scope object
EMFScopeWrapper scope = EMFScopeWrapper.generateScope(escope);
// TODO: return the warning set (need a CAPA type)
// invoke DOMO to build a DOMO class hierarchy object
WarningSet warnings = new WarningSet();
ClassHierarchy cha = ClassHierarchy.make(scope, warnings);
Entrypoints entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
// //
// build the call graph
// //
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cha, scope, warnings, null, null);
CallGraph cg = builder.makeCallGraph(options);
PointerAnalysis pointerAnalysis = builder.getPointerAnalysis();
return new BasicHeapGraph(pointerAnalysis,cg);
}
}

View File

@ -1,75 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.drivers;
import java.util.Collection;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.window.ApplicationWindow;
import com.ibm.wala.ecore.java.ETypeHierarchy;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.InferGraphRootsImpl;
import com.ibm.wala.viz.SWTTreeViewer;
/**
*
* This application is a WALA client: it invokes an SWT TreeViewer to visualize
* a TypeHierarchy in a precomputed file serialized on disk. So, you must run
* ExportTypeHierarchyToXML before running this, to compute the type hierarchy and
* serialize it to disk.
*
* @author sfink
*/
public class SWTTypeHierarchy {
/**
* Usage: SWTTreeViewerBasicPipeline
*/
public static void main(String[] args) {
run();
}
public static ApplicationWindow run() {
try {
ETypeHierarchy th = GVTypeHierarchy.readTypeHierarchy();
if (th.getClasses().getNodes().getContents().size() <1) {
System.err.println("PANIC: th # classes=" + th.getClasses().getNodes().getContents().size());
System.exit(-1);
}
Graph<EObject> g = GVTypeHierarchy.typeHierarchy2Graph(th);
g = GVTypeHierarchy.pruneForAppLoader(g);
if (g.getNumberOfNodes() == 0) {
System.err.println("ERROR: The type hierarchy in " + ExportTypeHierarchyToXML.getFileName() + " has no nodes from the Application loader");
System.exit(-1);
}
// create and run the viewer
final SWTTreeViewer v =new SWTTreeViewer();
v.setGraphInput(g);
Collection<EObject> roots = InferGraphRootsImpl.inferRoots(g);
if (roots.size() < 1) {
System.err.println("PANIC: roots.size()=" + roots.size());
System.exit(-1);
}
v.setRootsInput(roots);
v.run();
return v.getApplicationWindow();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}

View File

@ -1,50 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.examples.properties;
import java.io.File;
import java.net.URL;
import java.util.Properties;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.config.FileProvider;
import com.ibm.wala.util.warnings.WalaException;
public final class WalaExamplesProperties {
public static final String GHOSTVIEW_EXE = "ghostview_exe"; //$NON-NLS-1$
public static final String DOT_EXE = "dot_exe"; //$NON-NLS-1$
public final static String PROPERTY_FILENAME = "wala.examples.properties"; //$NON-NLS-1$
public static Properties loadProperties() throws WalaException {
try {
Properties result = WalaProperties.loadPropertiesFromFile(PROPERTY_FILENAME);
return result;
} catch (Exception e) {
e.printStackTrace();
throw new WalaException("Unable to set up wala examples properties ", e);
}
}
public static String getWalaCoreTestsHomeDirectory() throws WalaException {
final URL url = WalaExamplesProperties.class.getClassLoader().getResource(PROPERTY_FILENAME);
if (url == null) {
throw new WalaException("failed to find URL for capa.examples.properties");
}
return new File(FileProvider.filePathFromURL(url)).getParentFile().getParentFile().getAbsolutePath();
}
}

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="dat"/>
<classpathentry kind="src" path="lib"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.core</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>

View File

@ -1,7 +0,0 @@
#Tue Nov 21 13:03:57 EST 2006
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate

View File

@ -1,3 +0,0 @@
#Mon Oct 02 08:58:11 EDT 2006
eclipse.preferences.version=1
internal.default.compliance=default

View File

@ -1,68 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WALA Core Plug-in
Bundle-SymbolicName: com.ibm.wala.core
Bundle-Version: 1.0.0
Bundle-Activator: com.ibm.wala.core.plugin.CorePlugin
Bundle-Vendor: IBM
Bundle-Localization: plugin
Require-Bundle: com.ibm.wala.emf;visibility:=reexport,
com.ibm.wala.shrike;visibility:=reexport,
org.eclipse.core.resources,
org.eclipse.jface,
org.eclipse.jdt.core
Eclipse-LazyStart: true
Export-Package: .,
com.ibm.wala.analysis.pointers,
com.ibm.wala.analysis.reflection,
com.ibm.wala.analysis.stackMachine,
com.ibm.wala.analysis.typeInference,
com.ibm.wala.cfg,
com.ibm.wala.cfg.cdg,
com.ibm.wala.classLoader,
com.ibm.wala.client,
com.ibm.wala.client.impl,
com.ibm.wala.core.plugin,
com.ibm.wala.dataflow.IFDS,
com.ibm.wala.dataflow.graph,
com.ibm.wala.dataflow.ssa,
com.ibm.wala.dynamic,
com.ibm.wala.emf.wrappers,
com.ibm.wala.escape,
com.ibm.wala.fixedpoint.impl,
com.ibm.wala.fixpoint,
com.ibm.wala.ipa.callgraph,
com.ibm.wala.ipa.callgraph.impl,
com.ibm.wala.ipa.callgraph.propagation,
com.ibm.wala.ipa.callgraph.propagation.cfa,
com.ibm.wala.ipa.callgraph.propagation.rta,
com.ibm.wala.ipa.cfg,
com.ibm.wala.ipa.cha,
com.ibm.wala.ipa.modref,
com.ibm.wala.ipa.slicer,
com.ibm.wala.ipa.summaries,
com.ibm.wala.model,
com.ibm.wala.model.java.lang,
com.ibm.wala.properties,
com.ibm.wala.ssa,
com.ibm.wala.ssa.analysis,
com.ibm.wala.types,
com.ibm.wala.util,
com.ibm.wala.util.bytecode,
com.ibm.wala.util.collections,
com.ibm.wala.util.config,
com.ibm.wala.util.debug,
com.ibm.wala.util.graph,
com.ibm.wala.util.graph.impl,
com.ibm.wala.util.graph.traverse,
com.ibm.wala.util.heapTrace,
com.ibm.wala.util.internationalization,
com.ibm.wala.util.intset,
com.ibm.wala.util.io,
com.ibm.wala.util.logging,
com.ibm.wala.util.math,
com.ibm.wala.util.perf,
com.ibm.wala.util.scope,
com.ibm.wala.util.system,
com.ibm.wala.util.warnings,
com.ibm.wala.viz

View File

@ -1,13 +0,0 @@
bin.includes = lib/primordial.jar.model,\
plugin.properties,\
dat/J2SEClassHierarchyExclusions.xml,\
dat/SyntheticJ2SEModel.xml,\
dat/benign.xml,\
dat/natives.xml,\
META-INF/,\
.
jars.compile.order = .
output.. = bin/
source.. = dat/,\
src/,\
lib/

View File

@ -1,202 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="com.ibm.wala.core" default="build.jars" basedir=".">
<property name="basews" value="${ws}"/>
<property name="baseos" value="${os}"/>
<property name="basearch" value="${arch}"/>
<property name="basenl" value="${nl}"/>
<!-- Compiler settings. -->
<property name="javacFailOnError" value="true"/>
<property name="javacDebugInfo" value="on"/>
<property name="javacVerbose" value="false"/>
<property name="logExtension" value=".log"/>
<property name="compilerArg" value=""/>
<property name="javacSource" value="1.5"/>
<property name="javacTarget" value="1.5"/>
<path id="path_bootclasspath">
<fileset dir="${java.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<property name="bootclasspath" refid="path_bootclasspath"/>
<property name="bundleJavacSource" value="${javacSource}"/>
<property name="bundleJavacTarget" value="${javacTarget}"/>
<property name="bundleBootClasspath" value="${bootclasspath}"/>
<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">
<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}/output"/>
<property name="eclipse.root" value="c:/eclipse"/>
</target>
<target name="properties" if="eclipse.running">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</target>
<target name="build.update.jar" depends="init" description="Build the plug-in: com.ibm.wala.core for an update site.">
<delete dir="${temp.folder}"/>
<mkdir dir="${temp.folder}"/>
<delete dir="${plugin.destination}"/>
<mkdir dir="${plugin.destination}"/>
<antcall target="build.jars"/>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/"/>
</antcall>
<copy todir="${temp.folder}/com.ibm.wala.core_1.0.0" failonerror="true" overwrite="false">
<fileset dir="src/" includes="**/*.java" />
</copy>
<zip destfile="${plugin.destination}/com.ibm.wala.core_1.0.0.jar" basedir="${temp.folder}/com.ibm.wala.core_1.0.0" filesonly="false" whenempty="skip" update="false"/>
<delete dir="${temp.folder}"/>
</target>
<target name="@dot" depends="init" description="Create jar: com.ibm.wala.core @dot.">
<delete dir="${temp.folder}/@dot.bin"/>
<mkdir dir="${temp.folder}/@dot.bin"/>
<path id="@dot.classpath">
<pathelement path="../com.ibm.wala.emf/bin/"/>
<pathelement path="../com.ibm.wala.emf/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.osgi_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.common_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.jobs_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/runtime_registry_compatibility.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.registry_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/resolver.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/xercesImpl.jar"/>
<pathelement path="${eclipse.root}/plugins/org.apache.xerces_2.8.0.v200606131651/xml-apis.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.equinox.preferences_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.contenttype_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.ecore_2.2.0.v200606271057.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.common_2.2.0.v200606271057.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources.compatibility_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.resources.win32_3.2.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.update.configurator_3.2.0.v20060605.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.ant.core_3.1.100.v20060531.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.variables_3.1.100.v20060605.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.expressions_3.2.0.v20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.filesystem_1.0.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.filesystem.win32.x86_1.0.0.v20060603.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.emf.ecore.xmi_2.2.0.v200606271057.jar"/>
<pathelement path="../com.ibm.wala.shrike/bin/"/>
<pathelement path="../com.ibm.wala.shrike/@dot"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.jface_3.2.0.I20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.swt_3.2.0.v3232o.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.swt.win32.win32.x86_3.2.0.v3232m.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.core.commands_3.2.0.I20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.jdt.core_3.2.0.v_671.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.text_3.2.0.v20060605-1400.jar"/>
<pathelement path="${eclipse.root}/plugins/com.ibm.icu_3.4.4.1.jar"/>
<pathelement path="${eclipse.root}/plugins/org.eclipse.team.core_3.2.0.I200606051140.jar"/>
</path>
<!-- compile the source code -->
<javac destdir="${temp.folder}/@dot.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}" >
<compilerarg line="${compilerArg}" compiler="${build.compiler}"/>
<classpath refid="@dot.classpath" />
<src path="dat/" />
<src path="src/" />
<src path="lib/" />
<compilerarg value="@${basedir}/javaCompiler...args" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<compilerarg line="-log '${temp.folder}/@dot.bin${logExtension}'" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</javac>
<!-- Copy necessary resources -->
<copy todir="${temp.folder}/@dot.bin" failonerror="true" overwrite="false">
<fileset dir="dat/" excludes="**/*.java, **/package.htm*" />
<fileset dir="src/" excludes="**/*.java, **/package.htm*" />
<fileset dir="lib/" excludes="**/*.java, **/package.htm*" />
</copy>
<mkdir dir="${build.result.folder}"/>
<copy todir="${build.result.folder}/@dot" failonerror="true" overwrite="false">
<fileset dir="${temp.folder}/@dot.bin" />
</copy>
<delete dir="${temp.folder}/@dot.bin"/>
</target>
<target name="src.zip" depends="init" unless="src.zip">
<mkdir dir="${build.result.folder}"/>
<zip destfile="${build.result.folder}/src.zip" filesonly="false" whenempty="skip" update="false">
<fileset dir="dat/" includes="**/*.java" />
<fileset dir="src/" includes="**/*.java" />
<fileset dir="lib/" includes="**/*.java" />
</zip>
</target>
<target name="build.jars" depends="init" description="Build all the jars for the plug-in: com.ibm.wala.core.">
<available property="@dot" file="${build.result.folder}/@dot"/>
<antcall target="@dot"/>
</target>
<target name="build.sources" depends="init">
<available property="src.zip" file="${build.result.folder}/src.zip"/>
<antcall target="src.zip"/>
</target>
<target name="gather.bin.parts" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/com.ibm.wala.core_1.0.0"/>
<copy todir="${destination.temp.folder}/com.ibm.wala.core_1.0.0" failonerror="true" overwrite="false">
<fileset dir="${build.result.folder}/@dot" includes="**" />
</copy>
<copy todir="${destination.temp.folder}/com.ibm.wala.core_1.0.0" failonerror="true" overwrite="false">
<fileset dir="${basedir}" includes="lib/primordial.jar.model,plugin.properties,lib/extension.jar.model,dat/J2SEClassHierarchyExclusions.xml,dat/SyntheticJ2SEModel.xml,dat/benign.xml,dat/natives.xml,META-INF/" />
</copy>
</target>
<target name="build.zips" depends="init">
</target>
<target name="gather.sources" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/com.ibm.wala.core_1.0.0"/>
<copy file="${build.result.folder}/src.zip" todir="${destination.temp.folder}/com.ibm.wala.core_1.0.0" failonerror="false" overwrite="false"/>
</target>
<target name="gather.logs" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/com.ibm.wala.core_1.0.0"/>
<copy file="${temp.folder}/@dot.bin${logExtension}" todir="${destination.temp.folder}/com.ibm.wala.core_1.0.0" failonerror="false" overwrite="false"/>
</target>
<target name="clean" depends="init" description="Clean the plug-in: com.ibm.wala.core of all the zips, jars and logs created.">
<delete dir="${build.result.folder}/@dot"/>
<delete file="${build.result.folder}/src.zip"/>
<delete file="${plugin.destination}/com.ibm.wala.core_1.0.0.jar"/>
<delete file="${plugin.destination}/com.ibm.wala.core_1.0.0.zip"/>
<delete dir="${temp.folder}"/>
</target>
<target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
<eclipse.convertPath fileSystemPath="C:/temp/walaWorkspace/com.ibm.wala.core" property="resourcePath"/>
<eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
</target>
<target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: com.ibm.wala.core.">
<delete dir="${temp.folder}"/>
<mkdir dir="${temp.folder}"/>
<antcall target="build.jars"/>
<antcall target="build.sources"/>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/"/>
</antcall>
<antcall target="gather.sources">
<param name="destination.temp.folder" value="${temp.folder}/"/>
</antcall>
<delete>
<fileset dir="${temp.folder}" includes="**/*.bin${logExtension}" />
</delete>
<zip destfile="${plugin.destination}/com.ibm.wala.core_1.0.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
<delete dir="${temp.folder}"/>
</target>
</project>

View File

@ -1 +0,0 @@
wala.properties

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="ASCII"?>
<com.ibm.wala.common:EContainer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.ibm.wala.common="http:///com/ibm/wala/wala.ecore.common" xmlns:com.ibm.wala.regex="http:///com/ibm/wala/wala.ecore.regex">
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/awt\/.*"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/lang\/Boolean"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/lang\/Integer"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/lang\/StringBuffer"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/lang\/SecurityManager"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/lang\/Float"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/net\/.*"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="java\/util\/.*"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="javax\/.*"/>
<contents xsi:type="com.ibm.wala.regex:EPattern" pattern="sun\/.*"/>
</com.ibm.wala.common:EContainer>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.wala.java.scope:EJavaAnalysisScope xmlns:com.ibm.wala.java.scope="http:///com/ibm/wala/wala.ecore.java.scope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<loaders loaderName="Primordial">
<modules xsi:type="com.ibm.wala.java.scope:EBuiltInModule" id="primordial_jar_model"/>
</loaders>
</com.ibm.wala.java.scope:EJavaAnalysisScope>

View File

@ -1,15 +0,0 @@
########## General messages
########## Error messages
AbstractPropertyReader.invalid_property_value=Value for property ''{0}'' is invalid.
AbstractPropertyReader.location_error=Path for file ''{0}'' do not exist and can''t be constructed.
AbstractPropertyReader.no_string_value=Property ''{0}'' is not mapped to a string as expected.
AbstractPropertyReader.incorrect_boolean_value=Boolean property ''{0}'' should not be mapped to a string.
AbstractPropertyReader.incorrect_int_value=Integer property ''{0}'' should be mapped to an Integer object.
AbstractPropertyReader.int_conversion_failed=Integer property ''{0}'' cannot convert ''{1}'' to an integer.
CancelCHAConstructionException.cancelation_message=ClassHierarchy construction has been cancelled by progress monitor.
PersistentPropertiesManager.property_file_unreadable=Unable to read property file named ''{0}''.
PersistentPropertiesManager.reading_failure=Failed to load ''{0}''.

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><templates><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
* @return the ${bare_field_name}
*/</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
* @param ${param} the ${bare_field_name} to set
*/</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
* ${tags}
*/</template><template autoinsert="true" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
*
*/</template><template autoinsert="true" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
* @author ${user}
*
* ${tags}
*/</template><template autoinsert="true" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**
*
*/</template><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
* ${tags}
*/</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Javadoc)
* ${see_to_overridden}
*/</template><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
* ${tags}
* ${see_to_target}
*/</template><template autoinsert="false" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">/*******************************************************************************
* Copyright (c) 2006 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_declaration}
${typecomment}
${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
</template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
</template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
</template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
${exception_var}.printStackTrace();</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated method stub
${body_statement}</template><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>

View File

@ -1,251 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<profiles version="10">
<profile name="WALA" version="10">
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="132"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
</profile>
</profiles>

View File

@ -1,16 +0,0 @@
# Handlers installed for the root logger
handlers= java.util.logging.ConsoleHandler java.util.logging.FileHandler
### Configure FileHandler
# Logging file name in temporary directory of the machine.
java.util.logging.FileHandler.pattern = %t/safeLogFile%g.log
# Write 100 kbytes before rotating this file
java.util.logging.FileHandler.limit = 100000
# Number of rotating files to be used
java.util.logging.FileHandler.count = 3
# Formatter to be used with this FileHandler
java.util.logging.FileHandler.formatter = com.ibm.wala.util.logging.SimplifiedFormatter
# Configure ConsoleHandler
java.util.logging.ConsoleHandler.level = WARNING
java.util.logging.ConsoleHandler.formatter = com.ibm.wala.util.logging.SimplifiedFormatter

View File

@ -1,784 +0,0 @@
<?xml version="1.0" ?>
<!-- native methods in the IBM Windows DK 1.3.1 -->
<summary-spec>
<classloader name="Primordial">
<package name="com/ibm/wala/model">
<class name="SyntheticFactory">
<method name="getObject"
descriptor="()Ljava/lang/Object;" factory="true" static="true">
<new def="x" class="Lcom/ibm/wala/Malleable" />
<return value="x" />
</method>
</class>
</package>
<package name="com/ibm/jvm">
<class name="ExtendedSystem">
<method name="isResettableJVM" descriptor="()Z"
static="true">
</method>
<method name="setJVMUnresettableConditionally"
descriptor="(ILjava/lang/String;)V" static="true">
</method>
<method name="resizeArray"
descriptor="(ILjava/lang/Object;II)Ljava/lang/Object;"
factory="true" static="true">
<new def="x" class="Lcom/ibm/wala/Malleable" />
<return value="x" />
</method>
</class>
</package>
<package name="java/io">
<class name="FileDescriptor">
<method name="sync" descriptor="()V"></method>
</class>
<class name="FileInputStream">
<method name="available" descriptor="()I">
<constant name="yes" type="int" value="1" />
<constant name="no" type="int" value="0" />
<return value="yes" />
<return value="no" />
<new def="x" class="Ljava/io/IOException" />
<throw value="x" />
</method>
<method name="close" descriptor="()V">
<new def="x" class="Ljava/io/IOException" />
<throw value="x" />
</method>
<method name="open"
descriptor="(Ljava/lang/String;)V">
<new def="x" class="Ljava/io/IOException" />
<throw value="x" />
</method>
<method name="read" descriptor="()I">
<constant name="yes" type="int" value="1" />
<constant name="no" type="int" value="0" />
<return value="yes" />
<return value="no" />
<new def="x" class="Ljava/io/IOException" />
<throw value="x" />
</method>
<method name="readBytes" descriptor="([BII)I">
<constant name="yes" type="int" value="1" />
<constant name="no" type="int" value="0" />
<return value="yes" />
<return value="no" />
<new def="x" class="Ljava/io/IOException" />
<throw value="x" />
</method>
<method name="readBytes"
descriptor="([BIILjava/io/FileDescriptor;)I">
<constant name="yes" type="int" value="1" />
<constant name="no" type="int" value="0" />
<return value="yes" />
<return value="no" />
<new def="x" class="Ljava/io/IOException" />
<throw value="x" />
</method>
<method name="skip" descriptor="(J)J">
<constant name="yes" type="int" value="1" />
<constant name="no" type="int" value="0" />
<return value="yes" />
<return value="no" />
<new def="x" class="Ljava/io/IOException" />
<throw value="x" />
</method>
</class>
<class name="FileOutputStream">
<method name="close" descriptor="()V"></method>
<method name="open"
descriptor="(Ljava/lang/String;)V">
</method>
<method name="openAppend"
descriptor="(Ljava/lang/String;)V">
</method>
<method name="write" descriptor="(I)V"></method>
<method name="writeBytes" descriptor="([BII)V"></method>
</class>
<class name="ObjectOutputStream">
<method name="doublesToBytes" descriptor="([DI[BII)V"
static="true" />
<method name="floatsToBytes" descriptor="([FI[BII)V"
static="true" />
</class>
<class name="ObjectStreamClass">
<method name="hasStaticInitializer"
descriptor="(Ljava/lang/Class;)Z" static="true">
</method>
</class>
<class name="RandomAccessFile">
<method name="close" descriptor="()V"></method>
<method name="getFilePointer" descriptor="()J"></method>
<method name="length" descriptor="()J"></method>
<method name="open"
descriptor="(Ljava/lang/String;Z)V">
</method>
<method name="open"
descriptor="(Ljava/lang/String;I)V">
</method>
<method name="read" descriptor="()I"></method>
<method name="readBytes"
descriptor="([BIILjava/io/FileDescriptor;)I">
</method>
<method name="seek" descriptor="(J)V"></method>
<method name="write" descriptor="(I)V"></method>
<method name="writeBytes"
descriptor="([BIILjava/io/FileDescriptor;)V">
</method>
<method name="writeBytes" descriptor="([BII)V"></method>
</class>
</package>
<package name="java/lang">
<class name="Class">
<method name="forName"
descriptor="(Ljava/lang/String;)Ljava/lang/Class;"
static="true">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
<new def="y"
class="Ljava/lang/ClassNotFoundException" />
<throw value="y" />
<new def="z" class="Ljava/lang/ClassFormatError" />
<throw value="z" />
</method>
<method name="forName0"
descriptor="(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;"
static="true">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
<new def="y"
class="Ljava/lang/ClassNotFoundException" />
<throw value="y" />
<new def="z" class="Ljava/lang/ClassFormatError" />
<throw value="z" />
</method>
<method name="forName1"
descriptor="(Ljava/lang/String;)Ljava/lang/Class;" static="true">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
<new def="y"
class="Ljava/lang/ClassNotFoundException" />
<throw value="y" />
<new def="z" class="Ljava/lang/ClassFormatError" />
<throw value="z" />
</method>
<method name="getClassLoader0"
descriptor="()Ljava/lang/ClassLoader;">
<new def="x" class="Ljava/lang/ClassLoader" />
<return value="x" />
</method>
<method name="getComponentType"
descriptor="()Ljava/lang/Class;">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
</method>
<method name="getConstructor0"
descriptor="([Ljava/lang/Class;I)Ljava/lang/reflect/Constructor;">
<new def="x" class="Ljava/lang/reflect/Constructor" />
<return value="x" />
</method>
<method name="getField0"
descriptor="(Ljava/lang/String;I)Ljava/lang/reflect/Field;">
<new def="x" class="Ljava/lang/reflect/Field" />
<return value="x" />
</method>
<method name="getInterfaces"
descriptor="()[Ljava/lang/Class;">
<constant name="size" type="int" value="1" />
<new def="x" class="[Ljava/lang/Class" size="size" />
<new def="y" class="Ljava/lang/Class" />
<aastore ref="x" value="y" index="0" />
<return value="x" />
</method>
<method name="getMethod0"
descriptor="(Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;">
<new def="x" class="Ljava/lang/reflect/Method" />
<return value="x" />
</method>
<method name="getMethods0"
descriptor="(I)[Ljava/lang/reflect/Method;">
<constant name="size" type="int" value="1" />
<new def="x" class="[Ljava/lang/reflect/Method"
size="size" />
<new def="y" class="Ljava/lang/reflect/Method" />
<aastore ref="x" value="y" index="0" />
<return value="x" />
</method>
<method name="getModifiers" descriptor="()I"></method>
<method name="getName"
descriptor="()Ljava/lang/String;">
<new def="x" class="Ljava/lang/String" />
<return value="x" />
</method>
<method name="getPrimitiveClass"
descriptor="(Ljava/lang/String;)Ljava/lang/Class;" static="true">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
</method>
<method name="getSigners"
descriptor="()[Ljava/lang/Object;">
<constant name="size" type="int" value="1" />
<new def="x" class="[Ljava/lang/Object" size="size" />
<new def="y" class="Ljava/lang/Class" />
<aastore ref="x" value="y" index="0" />
<return value="x" />
</method>
<method name="getSuperclass"
descriptor="()Ljava/lang/Class;">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
</method>
<method name="getFields"
descriptor="()[Ljava/lang/reflect/Field;">
<constant name="size" type="int" value="1" />
<new def="x" class="[Ljava/lang/reflect/Field" size="size"/>
<new def="y" class="Ljava/lang/reflect/Field" />
<aastore ref="x" value="y" index="0" />
<return value="x" />
</method>
<method name="getConstructors"
descriptor="()[Ljava/lang/reflect/Constructor;">
<constant name="size" type="int" value="1" />
<new def="x"
class="[Ljava/lang/reflect/Constructor" size="size"/>
<new def="y" class="Ljava/lang/reflect/Constructor" />
<aastore ref="x" value="y" index="0" />
<return value="x" />
</method>
<method name="isAssignableFrom"
descriptor="(Ljava/lang/Class;)Z">
</method>
<method name="isArray" descriptor="()Z"></method>
<method name="isInstance"
descriptor="(Ljava/lang/Object;)Z">
</method>
<method name="isInterface" descriptor="()Z"></method>
<method name="isPrimitive" descriptor="()Z"></method>
<method name="newInstance"
descriptor="()Ljava/lang/Object;" factory="true">
<new def="x" class="Lcom/ibm/wala/Malleable" />
<return value="x" />
</method>
</class>
<class name="ClassLoader" allocatable="true">
<method name="findBootstrapClass"
descriptor="(Ljava/lang/String;)Ljava/lang/Class;">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
</method>
<method name="findLoadedClass"
descriptor="(Ljava/lang/String;)Ljava/lang/Class;">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
</method>
<method name="getCallerClassLoader"
descriptor="()Ljava/lang/ClassLoader;" static="true">
<new def="x" class="Ljava/lang/ClassLoader" />
<return value="x" />
</method>
</class>
<class name="Double">
<method name="doubleToLongBits" descriptor="(D)J"
static="true">
</method>
<method name="longBitsToDouble" descriptor="(J)D"
static="true">
</method>
</class>
<class name="Float">
<method name="floatToIntBits" descriptor="(F)I"
static="true">
</method>
<method name="intBitsToFloat" descriptor="(I)F"
static="true">
</method>
</class>
<class name="Object">
<method name="clone"
descriptor="()Ljava/lang/Object;">
<return value="null" />
<!-- Note that propagation-style builders should intercept calls to clone, and this model is OK for RTA -->
</method>
<method name="getClass"
descriptor="()Ljava/lang/Class;">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
</method>
<method name="hashCode" descriptor="()I"></method>
<method name="notify" descriptor="()V"></method>
<method name="notifyAll" descriptor="()V"></method>
<method name="wait" descriptor="(J)V"></method>
</class>
<class name="Runtime">
<method name="freeMemory" descriptor="()J"></method>
<method name="gc" descriptor="()V"></method>
<method name="totalMemory" descriptor="()J"></method>
</class>
<class name="SecurityManager">
<method name="getClassContext"
descriptor="()[Ljava/lang/Class;">
<constant name="size" type="int" value="1" />
<new def="x" class="[Ljava/lang/Class" size="size"/>
<new def="y" class="Ljava/lang/Class" />
<aastore ref="x" value="y" index="0" />
<return value="x" />
</method>
</class>
<class name="StrictMath">
<method name="ceil" descriptor="(D)D" static="true"></method>
<method name="exp" descriptor="(D)D" static="true"></method>
<method name="floor" descriptor="(D)D" static="true"></method>
<method name="pow" descriptor="(DD)D" static="true"></method>
</class>
<class name="String">
<method name="intern"
descriptor="()Ljava/lang/String;">
<new def="x" class="Ljava/lang/String" />
<return value="x" />
<poison
reason="questionable model of java/lang/String/intern()"
level="mild" />
</method>
</class>
<class name="System">
<method name="arraycopy"
descriptor="(Ljava/lang/Object;ILjava/lang/Object;II)V"
static="true">
<call type="static" name="arraycopy"
class="Lcom/ibm/wala/model/java/lang/System"
descriptor="(Ljava/lang/Object;Ljava/lang/Object;)V" arg0="arg0"
arg1="arg2" />
<return />
</method>
<method name="currentTimeMillis" descriptor="()J"
static="true">
</method>
<method name="getCallerClass"
descriptor="()Ljava/lang/Class;" static="true">
<new def="x" class="Ljava/lang/Class" />
<return value="x" />
</method>
<method name="identityHashCode"
descriptor="(Ljava/lang/Object;)I" static="true">
</method>
<method name="initProperties"
descriptor="(Ljava/util/Properties;)Ljava/util/Properties;"
static="true">
<new def="dummy1" class="Ljava/lang/Object" />
<new def="dummy2" class="Ljava/lang/Object" />
<call type="virtual" name="put"
class="Ljava/util/Properties"
descriptor="(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"
arg0="arg0" arg1="dummy1" arg2="dummy2" def="ignore" />
<new def="x" class="Ljava/util/Properties" />
<return value="x" />
</method>
<method name="mapLibraryName"
descriptor="(Ljava/lang/String;)Ljava/lang/String;"
static="true">
<return value="arg0" />
</method>
<method name="setErr0"
descriptor="(Ljava/io/PrintStream;)V" static="true">
</method>
<method name="setIn0"
descriptor="(Ljava/io/InputStream;)V" static="true">
</method>
<method name="setOut0"
descriptor="(Ljava/io/PrintStream;)V" static="true">
</method>
</class>
<class name="Thread">
<method name="currentThread"
descriptor="()Ljava/lang/Thread;" static="true">
<new def="x" class="Ljava/lang/Thread" />
<return value="x" />
</method>
<method name="interrupt0" descriptor="()V"></method>
<method name="&lt;init&gt;" descriptor="()V">
<putfield class="Ljava/lang/Thread" field="runnable"
fieldType="Ljava/lang/Runnable" ref="arg0" value="arg0" />
<putfield class="Ljava/lang/Thread" field="target"
fieldType="Ljava/lang/Runnable" ref="arg0" value="arg0" />
</method>
<method name="&lt;init&gt;"
descriptor="(Ljava/lang/Runnable;)V">
<putfield class="Ljava/lang/Thread" field="runnable"
fieldType="Ljava/lang/Runnable" ref="arg0" value="arg1" />
<putfield class="Ljava/lang/Thread" field="target"
fieldType="Ljava/lang/Runnable" ref="arg0" value="arg0" />
</method>
<method name="isAlive" descriptor="()Z"></method>
<method name="resume0" descriptor="()V" />
<method name="sleep" descriptor="(J)V" static="true">
<new def="x"
class="Ljava/lang/InterruptedException" />
<throw value="x" />
</method>
<method name="start" descriptor="()V">
<putfield class="Ljava/lang/Thread" field="runnable"
fieldType="Ljava/lang/Runnable" ref="arg0" value="arg0" />
<getfield class="Ljava/lang/Thread" field="runnable"
fieldType="Ljava/lang/Runnable" def="x" ref="arg0" />
<call type="interface" name="run"
class="Ljava/lang/Runnable" descriptor="()V" arg0="x" />
<putfield class="Ljava/lang/Thread" field="target"
fieldType="Ljava/lang/Runnable" ref="arg0" value="arg0" />
<getfield class="Ljava/lang/Thread" field="target"
fieldType="Ljava/lang/Runnable" def="y" ref="arg0" />
<call type="interface" name="run"
class="Ljava/lang/Runnable" descriptor="()V" arg0="y" />
</method>
<method name="stop0" descriptor="()V" />
<method name="yield" descriptor="()V" static="true" />
</class>
<class name="Throwable">
<method name="fillInStackTrace"
descriptor="()Ljava/lang/Throwable;">
<return value="arg0" />
</method>
<method name="getStackTraceElement"
descriptor="(I)Ljava/lang/StackTraceElement;">
<new def="x" class="Ljava/lang/StackTraceElement" />
<return value="x" />
</method>
<method name="printStackTrace0"
descriptor="(Ljava/lang/Object;)V" />
<method name="getStackTraceDepth" descriptor="()I" />
</class>
</package>
<package name="java/lang/reflect">
<class name="Array">
<method name="get"
descriptor="(Ljava/lang/Object;I)Ljava/lang/Object;" static="true"
factory="true">
<new def="x" class="Lcom/ibm/wala/Malleable" />
<return value="x" />
<poison
reason="bogus model of java/lang/reflect/Array/get"
level="severe" />
</method>
<method name="getByte"
descriptor="(Ljava/lang/Object;I)B" static="true">
</method>
<method name="getLength"
descriptor="(Ljava/lang/Object;)I" static="true">
</method>
<method name="multiNewArray"
descriptor="(Ljava/lang/Class;[I)Ljava/lang/Object;" static="true"
factory="true">
<new def="x" class="Lcom/ibm/wala/Malleable" />
<return value="x" />
</method>
<method name="newArray"
descriptor="(Ljava/lang/Class;I)Ljava/lang/Object;" static="true"
factory="true">
<new def="x" class="Lcom/ibm/wala/Malleable" />
<return value="x" />
</method>
<method name="newInstance"
descriptor="(Ljava/lang/Class;I)Ljava/lang/Object;" static="true"
factory="true">
<new def="x" class="Lcom/ibm/wala/Malleable" />
<return value="x" />
</method>
<method name="set"
descriptor="(Ljava/lang/Object;ILjava/lang/Object;)V"
static="true">
</method>
<method name="setByte"
descriptor="(Ljava/lang/Object;IB)V" static="true">
</method>
</class>
<class name="Field">
<method name="get"
descriptor="(Ljava/lang/Object;)Ljava/lang/Object;"
factory="true">
<new def="x" class="Lcom/ibm/wala/Malleable" />
<return value="x" />
<poison
reason="bogus model of java/lang/reflect/Field/get"
level="severe" />
</method>
<method name="getBoolean"
descriptor="(Ljava/lang/Object;)Z">
</method>
<method name="getByte"
descriptor="(Ljava/lang/Object;)B">
</method>
<method name="getChar"
descriptor="(Ljava/lang/Object;)C">
</method>
<method name="getDouble"
descriptor="(Ljava/lang/Object;)D">
</method>
<method name="getFloat"
descriptor="(Ljava/lang/Object;)F">
</method>
<method name="getInt"
descriptor="(Ljava/lang/Object;)I">
</method>
<method name="getLong"
descriptor="(Ljava/lang/Object;)J">
</method>
<method name="getShort"
descriptor="(Ljava/lang/Object;)S">
</method>
<method name="set"
descriptor="(Ljava/lang/Object;Ljava/lang/Object;)V">
</method>
<method name="setBoolean"
descriptor="(Ljava/lang/Object;Z)V">
</method>
<method name="setByte"
descriptor="(Ljava/lang/Object;B)V">
</method>
<method name="setChar"
descriptor="(Ljava/lang/Object;C)V">
</method>
<method name="setDouble"
descriptor="(Ljava/lang/Object;D)V">
</method>
<method name="setFloat"
descriptor="(Ljava/lang/Object;F)V">
</method>
<method name="setInt"
descriptor="(Ljava/lang/Object;I)V">
</method>
<method name="setLong"
descriptor="(Ljava/lang/Object;J)V">
</method>
<method name="setShort"
descriptor="(Ljava/lang/Object;S)V">
</method>
</class>
</package>
<package name="java/net">
<class name="PlainDatagramSocketImpl">
<method name="bind"
descriptor="(ILjava/net/InetAddress;)V">
</method>
</class>
<class name="PlainSocketImpl">
<method name="initProto" descriptor="()V" static="true" />
<method name="socketAvailable" descriptor="()I" />
<method name="socketBind"
descriptor="(Ljava/net/InetAddress;I)V" />
<method name="socketClose0" descriptor="(Z)V" />
<method name="socketConnect"
descriptor="(Ljava/net/InetAddress;II)V" />
<method name="socketCreate" descriptor="(Z)V" />
<method name="socketGetOption"
descriptor="(ILjava/lang/Object;)I" />
<method name="socketListen" descriptor="(I)V" />
<method name="socketSetOption"
descriptor="(IZLjava/lang/Object;)V" />
</class>
<class name="SocketInputStream">
<method name="init" descriptor="()V" static="true" />
<method name="socketRead0"
descriptor="(Ljava/io/FileDescriptor;[BIII)I" />
</class>
<class name="SocketOutputStream">
<method name="init" descriptor="()V" static="true" />
<method name="socketWrite0"
descriptor="(Ljava/io/FileDescriptor;[BII)V" />
</class>
</package>
<package name="java/security">
<class name="AccessControlContext">
<method name="getInheritedAccessControlContext"
descriptor="()Ljava/security/AccessControlContext;">
<new def="x" class="Ljava/lang/Object" />
<return value="x" />
<poison
reason="questionable model of java/security/AccessControlContext/getInheritedAccessControlContext"
level="moderate" />
</method>
</class>
<class name="AccessController">
<method name="doPrivileged"
descriptor="(Ljava/security/PrivilegedAction;)Ljava/lang/Object;"
static="true">
<call type="interface" name="run"
class="Ljava/security/PrivilegedAction"
descriptor="()Ljava/lang/Object;" def="x" arg0="arg0" />
<return value="x" />
<new def="y"
class="Ljava/security/PrivilegedActionException" />
<throw value="y" />
<poison
reason="incorrect model of java/security/AccessController/doPrivileged"
level="severe" />
</method>
<method name="doPrivileged"
descriptor="(Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;"
static="true">
<call type="interface" name="run"
class="Ljava/security/PrivilegedExceptionAction"
descriptor="()Ljava/lang/Object;" def="x" arg0="arg0" />
<return value="x" />
<new def="y"
class="Ljava/security/PrivilegedActionException" />
<throw value="y" />
<poison
reason="incorrect model of java/security/AccessController/doPrivileged"
level="severe" />
</method>
<method name="doPrivileged"
descriptor="(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;"
static="true">
<call type="interface" name="run"
class="Ljava/security/PrivilegedAction"
descriptor="()Ljava/lang/Object;" def="x" arg0="arg0" />
<return value="x" />
<new def="y"
class="Ljava/security/PrivilegedActionException" />
<throw value="y" />
<poison
reason="incorrect model of java/security/AccessController/doPrivileged"
level="severe" />
</method>
<method name="doPrivileged"
descriptor="(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;"
static="true">
<call type="interface" name="run"
class="Ljava/security/PrivilegedExceptionAction"
descriptor="()Ljava/lang/Object;" def="x" arg0="arg0" />
<return value="x" />
<new def="y"
class="Ljava/security/PrivilegedActionException" />
<throw value="y" />
<poison
reason="incorrect model of java/security/AccessController/doPrivileged"
level="severe" />
</method>
<method name="getStackAccessControlContext"
descriptor="()Ljava/security/AccessControlContext;"
static="true">
<new def="x"
class="Ljava/security/AccessControlContext" />
<return value="x" />
<poison
reason="questionable model of java/security/AccessController/getStackAccessControlContext"
level="moderate" />
</method>
</class>
</package>
<package name="java/util">
<class name="TimeZone">
<method name="getSystemTimeZoneID"
descriptor="(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"
static="true">
<new def="x" class="Ljava/lang/String" />
<return value="x" />
</method>
</class>
</package>
<package name="java/util/logging">
<class name="FileHandler">
<method name="isSetUID" descriptor="()Z" static="true" />
</class>
</package>
<package name="java/util/prefs">
<class name="FileSystemPreferences">
<method name="chmod" descriptor="(Ljava/lang/String;I)I"
static="true" />
<method name="lockFile0"
descriptor="(Ljava/lang/String;IZ)[I" static="true">
<constant name="size" type="int" value="1" />
<new def="x" class="[I" size="size"/>
<return value="x" />
</method>
<method name="unlockFile0" descriptor="(I)I"
static="true" />
</class>
</package>
<package name="sun/misc">
<class name="AtomicLongCSImpl">
<method name="attemptUpdate" descriptor="(JJ)Z" />
</class>
<class name="AtomicLong">
<method name="VMSupportsCS8" descriptor="()Z"
static="true" />
</class>
<class name="Signal">
<method name="handle0" descriptor="(IJ)J" static="true" />
<method name="findSignal"
descriptor="(Ljava/lang/String;)I" static="true" />
</class>
<class name="Unsafe" allocatable="true">
<method name="getUnsafe" descriptor="()Lsun/misc/Unsafe"
static="true">
<new def="x" class="Lsun/misc/Unsafe" />
<return value="x" />
</method>
<method name="allocateMemory" descriptor="(J)J" />
<method name="copyMemory" descriptor="(JJJ)V" />
<method name="freeMemory" descriptor="(J)V" />
<method name="objectFieldOffset"
descriptor="(Ljava/lang/reflect/Field;)J" />
<method name="getBoolean" descriptor="(J)Z" />
<method name="getByte" descriptor="(J)B" />
<method name="getChar" descriptor="(J)C" />
<method name="getDouble" descriptor="(J)D" />
<method name="getFloat" descriptor="(J)F" />
<method name="getInt" descriptor="(J)I" />
<method name="getLong" descriptor="(J)J" />
<method name="getShort" descriptor="(J)S" />
<method name="getBoolean"
descriptor="(Ljava/lang/Object;J)Z" />
<method name="getByte"
descriptor="(Ljava/lang/Object;J)B" />
<method name="getChar"
descriptor="(Ljava/lang/Object;J)C" />
<method name="getDouble"
descriptor="(Ljava/lang/Object;J)D" />
<method name="getFloat"
descriptor="(Ljava/lang/Object;J)F" />
<method name="getInt"
descriptor="(Ljava/lang/Object;J)I" />
<method name="getLong"
descriptor="(Ljava/lang/Object;J)J" />
<method name="getShort"
descriptor="(Ljava/lang/Object;J)S" />
<method name="putBoolean" descriptor="(JZ)V" />
<method name="putByte" descriptor="(JB)V" />
<method name="putChar" descriptor="(JC)V" />
<method name="putDouble" descriptor="(JD)V" />
<method name="putFloat" descriptor="(JF)V" />
<method name="putInt" descriptor="(JI)V" />
<method name="putLong" descriptor="(JJ)V" />
<method name="putShort" descriptor="(JS)V" />
<method name="registerNatives" descriptor="()V"
static="true" />
</class>
</package>
<package name="sun/nio/ch">
<class name="IOUtil">
<method name="initIDs" descriptor="()V" static="true" />
</class>
<class name="FileDispatcher">
<method name="init" descriptor="()V" static="true" />
</class>
<class name="FileChannelImpl">
<method name="lock0"
descriptor="(Ljava/io/FileDescriptor;ZJJZ)I" />
<method name="initIDs" descriptor="()J" static="true" />
</class>
</package>
</classloader>
</summary-spec>

View File

@ -1,52 +0,0 @@
###############################################################################
# WALA property file
# This file defines the default settings for the core WALA Engine
###############################################################################
################# Mandatory settings without default value ####################
#####
# Identify the directory where Java Runtime libraries are located.
# For instance, on a windows OS it's typically C:/Progra~1/Java/j2reYourVersion/lib
#
# N.B. This directory must contain a valid core.jar (or rt.jar for older VMs)
# On IBM 1.4.x SDKs, this means you need to specify Java14x/jre/lib and not
# Java14x/lib!
#
# Info: Location must be absolute.
#####
java_runtime_dir = Your location
################### Mandatory settings with default value ######################
##### Default output dir
# Identify directory where all generated files without absolute path will be located.
# Default value: results [Non absolute path are relative to WALA home location]
# Info: Can be absolute or relative.
#####
#output_dir = Your location
############################ Optional settings ################################
#####
# Identify the directory where J2EE standard libraries are located.
# Required only if you ask to analyze J2EE code.
# No default value.
# Info: Location must be absolute.
#####
#j2ee_runtime_dir = Your location
#####
# Identify the directory where Eclipse plugins are installed
# Required only if you ask to analyze Eclipse plugins.
# No default value.
# Info: Location must be absolute.
#####
#eclipse_plugins_dir = Your location
##### Report file
# Identify file name where to output WALA trace file.
# Default value: wala_report.txt [Non absolute path are relative to 'output.dir' variable value]
# Info: Can be absolute or relative.
#####
#WALA_report = Your file name

View File

@ -1,27 +0,0 @@
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime_3.2.0.v20060603.jar[~org/eclipse/core/internal/preferences/legacy/*;~org/eclipse/core/internal/runtime/*;+org/eclipse/core/runtime/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.osgi_3.2.0.v20060601.jar[+org/eclipse/osgi/event/*;+org/eclipse/osgi/framework/console/*;+org/eclipse/osgi/framework/eventmgr/*;+org/eclipse/osgi/framework/log/*;+org/eclipse/osgi/service/datalocation/*;+org/eclipse/osgi/service/debug/*;+org/eclipse/osgi/service/environment/*;+org/eclipse/osgi/service/localization/*;+org/eclipse/osgi/service/pluginconversion/*;+org/eclipse/osgi/service/resolver/*;+org/eclipse/osgi/service/runnable/*;+org/eclipse/osgi/service/urlconversion/*;+org/eclipse/osgi/storagemanager/*;+org/eclipse/osgi/util/*;+org/osgi/framework/*;+org/osgi/service/condpermadmin/*;+org/osgi/service/packageadmin/*;+org/osgi/service/permissionadmin/*;+org/osgi/service/startlevel/*;+org/osgi/service/url/*;+org/osgi/util/tracker/*;~org/eclipse/core/runtime/adaptor/*;~org/eclipse/core/runtime/internal/adaptor/*;~org/eclipse/core/runtime/internal/stats/*;~org/eclipse/osgi/baseadaptor/*;~org/eclipse/osgi/baseadaptor/bundlefile/*;~org/eclipse/osgi/baseadaptor/hooks/*;~org/eclipse/osgi/baseadaptor/loader/*;~org/eclipse/osgi/framework/adaptor/*;~org/eclipse/osgi/framework/debug/*;~org/eclipse/osgi/framework/internal/core/*;~org/eclipse/osgi/framework/internal/protocol/*;~org/eclipse/osgi/framework/internal/protocol/bundleentry/*;~org/eclipse/osgi/framework/internal/protocol/bundleresource/*;~org/eclipse/osgi/framework/internal/protocol/reference/*;~org/eclipse/osgi/framework/internal/reliablefile/*;~org/eclipse/osgi/framework/launcher/*;~org/eclipse/osgi/framework/util/*;~org/eclipse/osgi/internal/baseadaptor/*;~org/eclipse/osgi/internal/module/*;~org/eclipse/osgi/internal/profile/*;~org/eclipse/osgi/internal/resolver/*;~org/eclipse/osgi/internal/verifier/*;~org/eclipse/osgi/internal/provisional/verifier/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.equinox.common_3.2.0.v20060603.jar[~org/eclipse/core/internal/runtime/*;~org/eclipse/core/internal/boot/*;+org/eclipse/core/runtime/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.jobs_3.2.0.v20060603.jar[~org/eclipse/core/internal/jobs/*;+org/eclipse/core/runtime/jobs/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/runtime_registry_compatibility.jar[~org/eclipse/core/internal/registry/*;~org/eclipse/core/internal/registry/osgi/*;~org/eclipse/core/internal/registry/spi/*;+org/eclipse/core/runtime/*;+org/eclipse/core/runtime/dynamichelpers/*;+org/eclipse/core/runtime/spi/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603[~org/eclipse/core/internal/registry/*;~org/eclipse/core/internal/registry/osgi/*;~org/eclipse/core/internal/registry/spi/*;+org/eclipse/core/runtime/*;+org/eclipse/core/runtime/dynamichelpers/*;+org/eclipse/core/runtime/spi/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.equinox.registry_3.2.0.v20060601.jar[~org/eclipse/core/internal/registry/*;~org/eclipse/core/internal/registry/osgi/*;~org/eclipse/core/internal/registry/spi/*;+org/eclipse/core/runtime/*;+org/eclipse/core/runtime/dynamichelpers/*;+org/eclipse/core/runtime/spi/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.apache.xerces_2.8.0.v200606131651/resolver.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.apache.xerces_2.8.0.v200606131651/xercesImpl.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.apache.xerces_2.8.0.v200606131651/xml-apis.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.equinox.preferences_3.2.0.v20060601.jar[~org/eclipse/core/internal/preferences/*;~org/eclipse/core/internal/preferences/exchange/*;+org/eclipse/core/runtime/preferences/*;+org/osgi/service/prefs/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility.registry_3.2.0.v20060603/@dot[~org/eclipse/core/internal/registry/*;~org/eclipse/core/internal/registry/osgi/*;~org/eclipse/core/internal/registry/spi/*;+org/eclipse/core/runtime/*;+org/eclipse/core/runtime/dynamichelpers/*;+org/eclipse/core/runtime/spi/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.contenttype_3.2.0.v20060603.jar[~org/eclipse/core/internal/content/*;+org/eclipse/core/runtime/content/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.0.v20060601.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.emf.ecore_2.2.0.v200606271057.jar[+org/eclipse/emf/ecore/*;+org/eclipse/emf/ecore/impl/*;+org/eclipse/emf/ecore/plugin/*;+org/eclipse/emf/ecore/resource/*;+org/eclipse/emf/ecore/resource/impl/*;+org/eclipse/emf/ecore/util/*;+org/eclipse/emf/ecore/xml/namespace/*;+org/eclipse/emf/ecore/xml/namespace/impl/*;+org/eclipse/emf/ecore/xml/namespace/util/*;+org/eclipse/emf/ecore/xml/type/*;+org/eclipse/emf/ecore/xml/type/impl/*;+org/eclipse/emf/ecore/xml/type/internal/*;+org/eclipse/emf/ecore/xml/type/util/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.emf.common_2.2.0.v200606271057.jar[+org/eclipse/emf/common/*;+org/eclipse/emf/common/archive/*;+org/eclipse/emf/common/command/*;+org/eclipse/emf/common/notify/*;+org/eclipse/emf/common/notify/impl/*;+org/eclipse/emf/common/util/*;?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.resources_3.2.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.resources.compatibility_3.2.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.resources.win32_3.2.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.update.configurator_3.2.0.v20060605.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.ant.core_3.1.100.v20060531.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.variables_3.1.100.v20060605.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.expressions_3.2.0.v20060605-1400.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.filesystem_1.0.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.core.filesystem.win32.x86_1.0.0.v20060603.jar[?**/*]
#ADAPTER#ACCESS#eclipse/plugins/org.eclipse.emf.ecore.xmi_2.2.0.v200606271057.jar[+org/eclipse/emf/ecore/xmi/*;+org/eclipse/emf/ecore/xmi/impl/*;+org/eclipse/emf/ecore/xmi/util/*;?**/*]

View File

@ -1,6 +0,0 @@
PLUGINNAME=core WALA analysis engine
VENDORNAME=IBMproviderName = www.example.org
pluginName = PatternSet Model
# ====================================================================
providerName = www.example.org

View File

@ -1,561 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.pointers;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import com.ibm.wala.analysis.reflection.Malleable;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IField;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.LocalPointerKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.CompoundIterator;
import com.ibm.wala.util.IntFunction;
import com.ibm.wala.util.IntMapIterator;
import com.ibm.wala.util.collections.EmptyIterator;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.AbstractNumberedGraph;
import com.ibm.wala.util.graph.EdgeManager;
import com.ibm.wala.util.graph.NodeManager;
import com.ibm.wala.util.graph.NumberedGraph;
import com.ibm.wala.util.graph.NumberedNodeManager;
import com.ibm.wala.util.graph.impl.NumberedNodeIterator;
import com.ibm.wala.util.intset.BasicNonNegativeIntRelation;
import com.ibm.wala.util.intset.IBinaryNonNegativeIntRelation;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.MutableMapping;
import com.ibm.wala.util.intset.MutableSparseIntSet;
import com.ibm.wala.util.intset.OrdinalSet;
import com.ibm.wala.util.intset.OrdinalSetMapping;
import com.ibm.wala.util.intset.SparseIntSet;
/**
* @author sfink
*/
public class BasicHeapGraph extends HeapGraph {
private final static boolean VERBOSE = true;
private final static int VERBOSE_INTERVAL = 10000;
/**
* Pointer analysis solution
*/
private final PointerAnalysis pointerAnalysis;
/**
* The backing graph
*/
private final NumberedGraph<Object> G;
/**
* governing call graph
*/
private final CallGraph callGraph;
/**
* @param P
* governing pointer analysis
*/
public BasicHeapGraph(final PointerAnalysis P, final CallGraph callGraph) {
super(P.getHeapModel());
this.pointerAnalysis = P;
this.callGraph = callGraph;
final OrdinalSetMapping<PointerKey> pointerKeys = getPointerKeys(P);
final NumberedNodeManager<Object> nodeMgr = new NumberedNodeManager<Object>() {
public Iterator<Object> iterateNodes() {
return new CompoundIterator<Object>(pointerKeys.iterator(), P.getInstanceKeyMapping().iterator());
}
public int getNumberOfNodes() {
return pointerKeys.getMappingSize() + P.getInstanceKeyMapping().getMappingSize();
}
public void addNode(Object n) {
Assertions.UNREACHABLE();
}
public void removeNode(Object n) {
Assertions.UNREACHABLE();
}
public int getNumber(Object N) {
if (N instanceof PointerKey) {
return pointerKeys.getMappedIndex((PointerKey) N);
} else {
if (Assertions.verifyAssertions) {
if (!(N instanceof InstanceKey)) {
Assertions.UNREACHABLE(N.getClass().toString());
}
}
int inumber = P.getInstanceKeyMapping().getMappedIndex((InstanceKey) N);
return (inumber == -1) ? -1 : inumber + pointerKeys.getMappingSize();
}
}
public Object getNode(int number) {
if (number >= pointerKeys.getMappingSize()) {
return P.getInstanceKeyMapping().getMappedObject(number - pointerKeys.getMappingSize());
} else {
return pointerKeys.getMappedObject(number);
}
}
public int getMaxNumber() {
return getNumberOfNodes() - 1;
}
public boolean containsNode(Object n) {
return getNumber(n) != -1;
}
public Iterator<Object> iterateNodes(IntSet s) {
return new NumberedNodeIterator<Object>(s, this);
}
};
final IBinaryNonNegativeIntRelation pred = computePredecessors(nodeMgr);
final IntFunction<Object> toNode = new IntFunction<Object>() {
public Object apply(int i) {
return nodeMgr.getNode(i);
}
};
this.G = new AbstractNumberedGraph<Object>() {
private final EdgeManager<Object> edgeMgr = new EdgeManager<Object>() {
public Iterator<Object> getPredNodes(Object N) {
int n = nodeMgr.getNumber(N);
IntSet p = pred.getRelated(n);
if (p == null) {
return EmptyIterator.instance();
} else {
return new IntMapIterator<Object>(p.intIterator(), toNode);
}
}
public int getPredNodeCount(Object N) {
int n = nodeMgr.getNumber(N);
return pred.getRelatedCount(n);
}
public Iterator<? extends Object> getSuccNodes(Object N) {
int[] succ = computeSuccNodeNumbers(N, nodeMgr);
if (succ == null) {
return EmptyIterator.instance();
}
SparseIntSet s = new MutableSparseIntSet(succ);
return new IntMapIterator<Object>(s.intIterator(), toNode);
}
public int getSuccNodeCount(Object N) {
int[] succ = computeSuccNodeNumbers(N, nodeMgr);
return succ == null ? 0 : succ.length;
}
public void addEdge(Object src, Object dst) {
Assertions.UNREACHABLE();
}
public void removeEdge(Object src, Object dst) {
Assertions.UNREACHABLE();
}
public void removeAllIncidentEdges(Object node) {
Assertions.UNREACHABLE();
}
public void removeIncomingEdges(Object node) {
Assertions.UNREACHABLE();
}
public void removeOutgoingEdges(Object node) {
Assertions.UNREACHABLE();
}
public boolean hasEdge(Object src, Object dst) {
Assertions.UNREACHABLE();
return false;
}
};
protected NodeManager<Object> getNodeManager() {
return nodeMgr;
}
protected EdgeManager<Object> getEdgeManager() {
return edgeMgr;
}
};
}
/**
*
*/
private OrdinalSetMapping<PointerKey> getPointerKeys(PointerAnalysis pointerAnalysis) {
MutableMapping<PointerKey> result = new MutableMapping<PointerKey>();
for (Iterator it = pointerAnalysis.getPointerKeys().iterator(); it.hasNext();) {
PointerKey p = (PointerKey) it.next();
result.add(p);
}
return result;
}
private int[] computeSuccNodeNumbers(Object N, NumberedNodeManager<Object> nodeManager) {
if (N instanceof PointerKey) {
PointerKey P = (PointerKey) N;
OrdinalSet S = pointerAnalysis.getPointsToSet(P);
int[] result = new int[S.size()];
int i = 0;
for (Iterator it = S.iterator(); it.hasNext();) {
result[i] = nodeManager.getNumber(it.next());
i++;
}
return result;
} else if (N instanceof InstanceKey) {
InstanceKey I = (InstanceKey) N;
TypeReference T = I.getConcreteType().getReference();
if (Assertions.verifyAssertions) {
if (T == null) {
Assertions._assert(T != null, "null concrete type from " + I.getClass());
}
}
if (T.isArrayType()) {
PointerKey p = getHeapModel().getPointerKeyForArrayContents(I);
if (p == null || !nodeManager.containsNode(p)) {
return null;
} else {
return new int[] { nodeManager.getNumber(p) };
}
} else if (!Malleable.isMalleable(T)) {
IClass klass = getHeapModel().getClassHierarchy().lookupClass(T);
if (Assertions.verifyAssertions) {
if (klass == null) {
Assertions._assert(klass != null, "null klass for type " + T);
}
}
MutableSparseIntSet result = new MutableSparseIntSet();
try {
for (Iterator<IField> it = klass.getAllInstanceFields().iterator(); it.hasNext();) {
IField f = it.next();
if (!f.getFieldReference().getFieldType().isPrimitiveType()) {
PointerKey p = getHeapModel().getPointerKeyForInstanceField(I, f);
if (p != null && nodeManager.containsNode(p)) {
result.add(nodeManager.getNumber(p));
}
}
}
} catch (ClassHierarchyException e) {
// uh oh. skip it for now.
}
return result.toIntArray();
} else {
Assertions._assert(Malleable.isMalleable(T));
return null;
}
} else {
Assertions.UNREACHABLE("Unexpected type: " + N.getClass());
return null;
}
}
/**
* @return R, y \in R(x,y) if the node y is a predecessor of node x
*/
private IBinaryNonNegativeIntRelation computePredecessors(NumberedNodeManager<Object> nodeManager) {
BasicNonNegativeIntRelation R = new BasicNonNegativeIntRelation(new byte[] { BasicNonNegativeIntRelation.SIMPLE },
BasicNonNegativeIntRelation.SIMPLE);
// we split the following loops to improve temporal locality,
// particularly for locals
computePredecessorsForNonLocals(nodeManager, R);
computePredecessorsForLocals(nodeManager, R);
return R;
}
private void computePredecessorsForNonLocals(NumberedNodeManager<Object> nodeManager, BasicNonNegativeIntRelation R) {
// Note: we run this loop backwards on purpose, to avoid lots of resizing of
// bitvectors
// in the backing relation. i.e., we will add the biggest bits first.
// pretty damn tricky.
for (int i = nodeManager.getMaxNumber(); i >= 0; i--) {
if (VERBOSE) {
if (i % VERBOSE_INTERVAL == 0) {
System.err.println("Building HeapGraph: " + i);
}
}
Object n = nodeManager.getNode(i);
if (!(n instanceof LocalPointerKey)) {
int[] succ = computeSuccNodeNumbers(n, nodeManager);
if (succ != null) {
for (int z = 0; z < succ.length; z++) {
int j = succ[z];
R.add(j, i);
}
}
}
}
}
/**
* traverse locals in order, first by node, then by value number: attempt to
* improve locality
*/
private void computePredecessorsForLocals(NumberedNodeManager<Object> nodeManager, BasicNonNegativeIntRelation R) {
ArrayList<LocalPointerKey> list = new ArrayList<LocalPointerKey>();
for (Iterator it = nodeManager.iterateNodes(); it.hasNext();) {
Object n = it.next();
if (n instanceof LocalPointerKey) {
list.add((LocalPointerKey) n);
}
}
Object[] arr = list.toArray();
Arrays.sort(arr, new LocalPointerComparator());
for (int i = 0; i < arr.length; i++) {
if (VERBOSE) {
if (i % VERBOSE_INTERVAL == 0) {
System.err.println("Building HeapGraph: " + i + " of " + arr.length);
}
}
LocalPointerKey n = (LocalPointerKey) arr[i];
int num = nodeManager.getNumber(n);
int[] succ = computeSuccNodeNumbers(n, nodeManager);
if (succ != null) {
for (int z = 0; z < succ.length; z++) {
int j = succ[z];
R.add(j, num);
}
}
}
}
/**
* sorts local pointers by node, then value number
*/
private final class LocalPointerComparator implements Comparator<Object> {
public int compare(Object arg1, Object arg2) {
LocalPointerKey o1 = (LocalPointerKey)arg1;
LocalPointerKey o2 = (LocalPointerKey)arg2;
if (o1.getNode().equals(o2.getNode())) {
return o1.getValueNumber() - o2.getValueNumber();
} else {
return callGraph.getNumber(o1.getNode()) - callGraph.getNumber(o2.getNode());
}
}
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.NumberedNodeManager#getNumber(com.ibm.wala.util.graph.Node)
*/
public int getNumber(Object N) {
return G.getNumber(N);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.NumberedNodeManager#getNode(int)
*/
public Object getNode(int number) {
return G.getNode(number);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.NumberedNodeManager#getMaxNumber()
*/
public int getMaxNumber() {
return G.getMaxNumber();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.NodeManager#iterateNodes()
*/
public Iterator<? extends Object> iterateNodes() {
return G.iterateNodes();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.NodeManager#getNumberOfNodes()
*/
public int getNumberOfNodes() {
return G.getNumberOfNodes();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.EdgeManager#getPredNodes(com.ibm.wala.util.graph.Node)
*/
public Iterator<? extends Object> getPredNodes(Object N) {
return G.getPredNodes(N);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.EdgeManager#getPredNodeCount(com.ibm.wala.util.graph.Node)
*/
public int getPredNodeCount(Object N) {
return G.getPredNodeCount(N);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.EdgeManager#getSuccNodes(com.ibm.wala.util.graph.Node)
*/
public Iterator<? extends Object> getSuccNodes(Object N) {
return G.getSuccNodes(N);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.EdgeManager#getSuccNodeCount(com.ibm.wala.util.graph.Node)
*/
public int getSuccNodeCount(Object N) {
return G.getSuccNodeCount(N);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.NodeManager#addNode(com.ibm.wala.util.graph.Node)
*/
public void addNode(Object n) {
Assertions.UNREACHABLE();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.NodeManager#remove(com.ibm.wala.util.graph.Node)
*/
public void removeNode(Object n) {
Assertions.UNREACHABLE();
}
/*
* (non-Javadoc)
*
*/
public void addEdge(Object from, Object to) {
Assertions.UNREACHABLE();
}
public void removeEdge(Object from, Object to) {
Assertions.UNREACHABLE();
}
/*
* (non-Javadoc)
*
*/
public boolean hasEdge(Object from, Object to) {
Assertions.UNREACHABLE();
return false;
}
public void removeAllIncidentEdges(Object node) {
Assertions.UNREACHABLE();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.util.graph.NodeManager#containsNode(com.ibm.wala.util.graph.Node)
*/
public boolean containsNode(Object N) {
return G.containsNode(N);
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
public String toString() {
StringBuffer result = new StringBuffer();
result.append("Nodes:\n");
for (int i = 0; i < getMaxNumber(); i++) {
Object node = getNode(i);
if (node != null) {
result.append(i).append(" ").append(node).append("\n");
}
}
result.append("Edges:\n");
for (int i = 0; i < getMaxNumber(); i++) {
Object node = getNode(i);
if (node != null) {
result.append(i).append(" -> ");
for (Iterator it = getSuccNodes(node); it.hasNext();) {
Object s = it.next();
result.append(getNumber(s)).append(" ");
}
result.append("\n");
}
}
return result.toString();
}
/*
* (non-Javadoc)
*
*/
public void removeIncomingEdges(Object node) {
// TODO Auto-generated method stub
Assertions.UNREACHABLE();
}
/*
* (non-Javadoc)
*/
public void removeOutgoingEdges(Object node) {
// TODO Auto-generated method stub
Assertions.UNREACHABLE();
}
public IntSet getSuccNodeNumbers(Object node) {
// TODO Auto-generated method stub
Assertions.UNREACHABLE();
return null;
}
public IntSet getPredNodeNumbers(Object node) {
// TODO Auto-generated method stub
Assertions.UNREACHABLE();
return null;
}
}

View File

@ -1,78 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.pointers;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import com.ibm.wala.ipa.callgraph.propagation.HeapModel;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.util.collections.Filter;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.NumberedGraph;
import com.ibm.wala.util.graph.impl.NumberedNodeIterator;
import com.ibm.wala.util.graph.traverse.DFS;
import com.ibm.wala.util.intset.IntSet;
/**
* A Graph view of a pointer analysis solution.
*
* Nodes in the Graph are PointerKeys and InstanceKeys.
*
* There is an edge from a PointerKey P to an InstanceKey I iff the PointerAnalysis
* indicates that P may point to I.
*
* There is an edge from an InstanceKey I to a PointerKey P iff
* - P represents a field of an object instance modelled by I, or
* - P represents the array contents of array instance I.
*
* @author sfink
*
*/
public abstract class HeapGraph implements NumberedGraph<Object> {
private final HeapModel hm;
protected HeapGraph(HeapModel hm) {
this.hm = hm;
}
/* (non-Javadoc)
* @see com.ibm.wala.util.graph.NumberedNodeManager#iterateNodes(com.ibm.wala.util.intset.IntSet)
*/
public Iterator<Object> iterateNodes(IntSet s) {
return new NumberedNodeIterator<Object>(s,this);
}
public Collection<Object> getReachableInstances(Set<Object> roots) {
Filter f = new Filter() {
public boolean accepts(Object o) {
return (o instanceof InstanceKey);
}
};
return DFS.getReachableNodes(this, roots, f);
}
/* (non-Javadoc)
* @see com.ibm.wala.util.graph.Graph#removeNode(com.ibm.wala.util.graph.Node)
*/
public void removeNodeAndEdges(Object N) {
Assertions.UNREACHABLE();
}
/**
* @return Returns the heap model used in this pointer analysis.
*/
public HeapModel getHeapModel() {
return hm;
}
}

View File

@ -1,5 +0,0 @@
<HTML>
<BODY>
This package defines utilities to help navigate pointer analysis results.
</BODY>
</HTML>

View File

@ -1,61 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.reflection;
import java.util.Map;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAInvokeInstruction;
import com.ibm.wala.ssa.SSAInstruction.Visitor;
import com.ibm.wala.util.collections.HashMapFactory;
/**
*
* A mapping from CallSiteReference to SSA InvokeInstruction.
*
* @author sfink
*/
public class CallSiteMap {
/**
* f: CallSiteReference -> InvokeInstruction
*/
private final Map<CallSiteReference, SSAInvokeInstruction> map = HashMapFactory.make();
/**
* @param ir
*/
public CallSiteMap(final IR ir) {
Visitor v = new Visitor() {
public void visitInvoke(SSAInvokeInstruction instruction) {
CallSiteReference site = instruction.getCallSite();
map.put(site, instruction);
}
};
SSAInstruction[] instructions = ir.getInstructions();
for (int i = 0; i < instructions.length; i++) {
if (instructions[i] != null) {
instructions[i].visit(v);
}
}
}
/**
* @param site
* @return the InvokeInstruction corresponding to the call site.
*/
public SSAInvokeInstruction getInstructionForSite(CallSiteReference site) {
SSAInvokeInstruction result = map.get(site);
return result;
}
}

View File

@ -1,80 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.reflection;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextItem;
import com.ibm.wala.ipa.callgraph.ContextKey;
/**
*
* A context which is a <CGNode, CallSiteReference> pair
*
* @author sfink
*/
public class CallerSiteContext implements Context {
private final CGNode caller;
private final CallSiteReference site;
/**
* @param caller
* @param site
*/
public CallerSiteContext(CGNode caller, CallSiteReference site) {
this.caller = caller;
this.site = site;
}
/* (non-Javadoc)
* @see com.ibm.wala.ipa.callgraph.Context#get(com.ibm.wala.ipa.callgraph.ContextKey)
*/
public ContextItem get(ContextKey name) {
return null;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return "[CallerSiteContext: " + caller + "," + site.getProgramCounter() + "]";
}
public CGNode getCaller() {
return caller;
}
public CallSiteReference getSite() {
return site;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object arg0) {
if (getClass().equals(arg0.getClass())) {
CallerSiteContext other = (CallerSiteContext) arg0;
return caller.equals(other.caller) && (site.equals(other.site));
} else {
return false;
}
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return site.hashCode() + 839 * caller.hashCode();
}
}

View File

@ -1,362 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.reflection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.cfg.InducedCFG;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.classLoader.CodeScanner;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IField;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextUtil;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ipa.summaries.SyntheticIR;
import com.ibm.wala.shrikeBT.IInvokeInstruction;
import com.ibm.wala.ssa.DefUse;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAArrayLengthInstruction;
import com.ibm.wala.ssa.SSAGetInstruction;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAInvokeInstruction;
import com.ibm.wala.ssa.SSANewInstruction;
import com.ibm.wala.ssa.SSAOptions;
import com.ibm.wala.ssa.SSAPutInstruction;
import com.ibm.wala.ssa.SSAReturnInstruction;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.Descriptor;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeName;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.collections.NonNullSingletonIterator;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
* A context interpreter for java.lang.Object.clone
*
* TODO: The current implementation does not model CloneNotSupportedExceptions
*
* @author sfink
*/
public class CloneInterpreter implements SSAContextInterpreter {
/**
* Comment for <code>cloneAtom</code>
*/
public final static Atom cloneAtom = Atom.findOrCreateUnicodeAtom("clone");
private final static Descriptor cloneDesc = Descriptor.findOrCreateUTF8("()Ljava/lang/Object;");
/**
* Comment for <code>CLONE</code>
*/
public final static MethodReference CLONE = MethodReference.findOrCreate(TypeReference.JavaLangObject, cloneAtom, cloneDesc);
private final static TypeReference SYNTHETIC_SYSTEM = TypeReference.findOrCreate(ClassLoaderReference.Primordial, TypeName
.string2TypeName("Lcom/ibm/wala/model/java/lang/System"));
private final static Atom arraycopyAtom = Atom.findOrCreateUnicodeAtom("arraycopy");
private final static Descriptor arraycopyDesc = Descriptor.findOrCreateUTF8("(Ljava/lang/Object;Ljava/lang/Object;)V");
private final static MethodReference SYNTHETIC_ARRAYCOPY = MethodReference.findOrCreate(SYNTHETIC_SYSTEM, arraycopyAtom,
arraycopyDesc);
/**
* If the type is an array, the program counter of the synthesized call to
* arraycopy. Doesn't really matter what it is.
*/
private final static int ARRAYCOPY_PC = 3;
private final static CallSiteReference ARRAYCOPY_SITE = CallSiteReference.make(ARRAYCOPY_PC, SYNTHETIC_ARRAYCOPY,
IInvokeInstruction.Dispatch.STATIC);
private final static int NEW_PC = 0;
/**
* Mapping from TypeReference -> IR TODO: Soft references?
*/
private Map<TypeReference, IR> IRCache = HashMapFactory.make();
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.cfa.CFAContextInterpreter#getIR(com.ibm.wala.classLoader.IMethod,
* com.ibm.detox.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public IR getIR(CGNode node, WarningSet warnings) {
if (Assertions.verifyAssertions) {
Assertions._assert(understands(node));
}
IClass cls = ContextUtil.getConcreteClassFromContext(node.getContext());
IR result = IRCache.get(cls.getReference());
if (result == null) {
result = makeIR(node.getMethod(), node.getContext(), cls, warnings);
IRCache.put(cls.getReference(), result);
}
return result;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.cfa.CFAContextInterpreter#getNumberOfStatements(com.ibm.wala.classLoader.IMethod,
* com.ibm.detox.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public int getNumberOfStatements(CGNode node, WarningSet warnings) {
if (Assertions.verifyAssertions) {
Assertions._assert(understands(node));
}
return getIR(node, warnings).getInstructions().length;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.rta.RTAContextInterpreter#understands(com.ibm.wala.classLoader.IMethod,
* com.ibm.detox.ipa.callgraph.Context)
*/
public boolean understands(CGNode node) {
return (node.getMethod().getReference().equals(CLONE) && ContextUtil.getConcreteClassFromContext(node.getContext()) != null);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.rta.RTAContextInterpreter#getAllocatedTypes(com.ibm.wala.classLoader.IMethod,
* com.ibm.detox.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator<NewSiteReference> iterateNewSites(CGNode node, WarningSet warnings) {
if (Assertions.verifyAssertions) {
Assertions._assert(understands(node));
}
IClass cls = ContextUtil.getConcreteClassFromContext(node.getContext());
return new NonNullSingletonIterator<NewSiteReference>(NewSiteReference.make(NEW_PC, cls.getReference()));
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.rta.RTAContextInterpreter#getCallSites(com.ibm.wala.classLoader.IMethod,
* com.ibm.detox.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator<CallSiteReference> iterateCallSites(CGNode node, WarningSet warnings) {
if (Assertions.verifyAssertions) {
Assertions._assert(understands(node));
}
return new NonNullSingletonIterator<CallSiteReference>(ARRAYCOPY_SITE);
}
/**
* @return an array of statements that encode the behavior of the clone method
* for a given type.
*/
private SSAInstruction[] makeStatements(IClass klass) {
if (Assertions.verifyAssertions) {
Assertions._assert(klass != null);
}
ArrayList<SSAInstruction> statements = new ArrayList<SSAInstruction>();
// value number 1 is "this".
int nextLocal = 2;
int retValue = nextLocal++;
// value number of the result of the clone()
NewSiteReference ref = NewSiteReference.make(NEW_PC, klass.getReference());
SSANewInstruction N = null;
if (klass.isArrayClass()) {
int length = nextLocal++;
statements.add(new SSAArrayLengthInstruction(length, 1));
int[] sizes = new int[klass.getReference().getDimensionality()];
Arrays.fill(sizes,length);
N = new SSANewInstruction(retValue, ref, sizes);
} else {
N = new SSANewInstruction(retValue, ref);
}
statements.add(N);
int exceptionValue = nextLocal++;
if (klass.getReference().isArrayType()) {
// generate a synthetic arraycopy from this (v.n. 1) to the clone
int[] params = new int[2];
params[0] = 1;
params[1] = retValue;
SSAInvokeInstruction S = new SSAInvokeInstruction(params, exceptionValue, ARRAYCOPY_SITE);
statements.add(S);
} else {
// copy the fields over, one by one.
// TODO:
IClass k = klass;
while (k != null) {
for (Iterator<IField> it = klass.getDeclaredInstanceFields().iterator(); it.hasNext();) {
IField f = it.next();
int tempValue = nextLocal++;
SSAGetInstruction G = new SSAGetInstruction(tempValue, 1, f.getFieldReference());
statements.add(G);
SSAPutInstruction P = new SSAPutInstruction(retValue, tempValue, f.getFieldReference());
statements.add(P);
}
try {
k = k.getSuperclass();
} catch (ClassHierarchyException e) {
Assertions.UNREACHABLE();
}
}
}
SSAReturnInstruction R = new SSAReturnInstruction(retValue, false);
statements.add(R);
SSAInstruction[] result = new SSAInstruction[statements.size()];
Iterator<SSAInstruction> it = statements.iterator();
for (int i = 0; i < result.length; i++) {
result[i] = it.next();
}
return result;
}
/**
* @return an IR that encodes the behavior of the clone method for a given
* type.
*/
private IR makeIR(IMethod method, Context context, IClass klass, WarningSet warnings) {
if (Assertions.verifyAssertions) {
Assertions._assert(klass != null);
}
SSAInstruction instrs[] = makeStatements(klass);
return new SyntheticIR(method, context, new InducedCFG(instrs, method, context), instrs, SSAOptions.defaultOptions(), null,
warnings);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.cfa.CFAContextInterpreter#recordFactoryType(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.classLoader.IClass)
*/
public boolean recordFactoryType(CGNode node, IClass klass) {
return false;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.rta.RTAContextInterpreter#setWarnings(com.ibm.wala.util.warnings.WarningSet)
*/
public void setWarnings(WarningSet newWarnings) {
// this object is not bound to a WarningSet
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#iterateFieldsRead(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator iterateFieldsRead(CGNode node, WarningSet warnings) {
SSAInstruction[] statements = getIR(node, warnings).getInstructions();
return CodeScanner.getFieldsRead(statements).iterator();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#iterateFieldsWritten(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator iterateFieldsWritten(CGNode node, WarningSet warnings) {
SSAInstruction[] statements = getIR(node, warnings).getInstructions();
return CodeScanner.getFieldsWritten(statements).iterator();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#getCaughtExceptions(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Set getCaughtExceptions(CGNode node, WarningSet warnings) {
SSAInstruction[] statements = getIR(node, warnings).getInstructions();
return CodeScanner.getCaughtExceptions(statements);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#hasObjectArrayLoad(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public boolean hasObjectArrayLoad(CGNode node, WarningSet warnings) {
SSAInstruction[] statements = getIR(node, warnings).getInstructions();
return CodeScanner.hasObjectArrayLoad(statements);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#hasObjectArrayStore(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public boolean hasObjectArrayStore(CGNode node, WarningSet warnings) {
SSAInstruction[] statements = getIR(node, warnings).getInstructions();
return CodeScanner.hasObjectArrayStore(statements);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.xta.XTAContextInterpreter#iterateCastTypes(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator iterateCastTypes(CGNode node, WarningSet warnings) {
SSAInstruction[] statements = getIR(node, warnings).getInstructions();
return CodeScanner.iterateCastTypes(statements);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.cfg.CFGProvider#getCFG(com.ibm.wala.ipa.callgraph.CGNode)
*/
public ControlFlowGraph getCFG(CGNode N, WarningSet warnings) {
return getIR(N, warnings).getControlFlowGraph();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter#getDU(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public DefUse getDU(CGNode node, WarningSet warnings) {
return new DefUse(getIR(node, warnings));
}
}

View File

@ -1,809 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.reflection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.ibm.wala.analysis.typeInference.ConeType;
import com.ibm.wala.analysis.typeInference.PointType;
import com.ibm.wala.analysis.typeInference.SetType;
import com.ibm.wala.analysis.typeInference.TypeAbstraction;
import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.cfg.InducedCFG;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.classLoader.CodeScanner;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.classLoader.SyntheticMethod;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ReflectionSpecification;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
import com.ibm.wala.ipa.callgraph.propagation.rta.RTAContextInterpreter;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.summaries.ReflectionSummary;
import com.ibm.wala.ipa.summaries.SummarizedMethod;
import com.ibm.wala.ipa.summaries.SyntheticIR;
import com.ibm.wala.ipa.summaries.XMLReflectionReader;
import com.ibm.wala.shrikeBT.IInvokeInstruction;
import com.ibm.wala.shrikeCT.InvalidClassFileException;
import com.ibm.wala.ssa.ConstantValue;
import com.ibm.wala.ssa.DefUse;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAInvokeInstruction;
import com.ibm.wala.ssa.SSANewInstruction;
import com.ibm.wala.ssa.SSAOptions;
import com.ibm.wala.ssa.SSAReturnInstruction;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.warnings.Warning;
import com.ibm.wala.util.warnings.WarningSet;
/**
*
* Logic to interpret "factory" methods in context.
*
* @author sfink
*/
public class FactoryBypassInterpreter implements RTAContextInterpreter, SSAContextInterpreter {
private static final boolean DEBUG = false;
private final static int CONE_BOUND = 10;
private int indexLocal = 100;
private final Map<TypeReference, Integer> typeIndexMap = HashMapFactory.make();
/**
* A Map from CallerSiteContext -> Set <TypeReference>represents the types a
* factory method might create in a particular context
*/
private final Map<Context, Set<TypeReference>> map = HashMapFactory.make();
/**
* A cache of synthetic method implementations, indexed by Context
*/
private final Map<Context, SpecializedFactoryMethod> syntheticMethodCache = HashMapFactory.make();
/**
* Governing analysis options
*/
private final AnalysisOptions options;
/**
* Governing class hierarchy
*/
private final ClassHierarchy cha;
/**
* Keep track of analysis warnings
*/
private WarningSet warnings;
/**
* User-defined reflection specification
*/
private final ReflectionSpecification userSpec;
/**
*
* @param options
* governing analysis options
* @param cha
* governing class hierarchy
* @param userSpec
* @param warnings
* object to track analysis warnings
*/
public FactoryBypassInterpreter(AnalysisOptions options, ClassHierarchy cha, ReflectionSpecification userSpec, WarningSet warnings) {
this.options = options;
this.cha = cha;
this.warnings = warnings;
this.userSpec = userSpec;
}
private int getLocalForType(TypeReference T) {
Integer I = typeIndexMap.get(T);
if (I == null) {
typeIndexMap.put(T, I = new Integer(indexLocal += 2));
}
return I.intValue();
}
private int getExceptionsForType(TypeReference T) {
return getLocalForType(T) + 1;
}
private int getCallSiteForType(TypeReference T) {
return getLocalForType(T);
}
private int getNewSiteForType(TypeReference T) {
return getLocalForType(T) + 1;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.cfa.CFAContextInterpreter#getIR(com.ibm.wala.classLoader.IMethod,
* com.ibm.wala.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public IR getIR(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
return options.getSSACache().findOrCreateIR(m, node.getContext(), cha, options.getSSAOptions(), warnings);
}
private Set getTypesForContext(Context context) {
// first try user spec
XMLReflectionReader spec = (XMLReflectionReader) userSpec;
if (spec != null && context instanceof CallerSiteContext) {
CallerSiteContext site = (CallerSiteContext) context;
MethodReference m = site.getCaller().getMethod().getReference();
ReflectionSummary summary = spec.getSummary(m);
if (summary != null) {
Set types = summary.getTypesForProgramLocation(site.getSite().getProgramCounter());
if (types != null) {
return types;
}
}
}
Set types = map.get(context);
return types;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.cfa.CFAContextInterpreter#getNumberOfStatements(com.ibm.wala.classLoader.IMethod,
* com.ibm.wala.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public int getNumberOfStatements(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
return m.allInstructions.size();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.rta.RTAContextInterpreter#understands(com.ibm.wala.classLoader.IMethod,
* com.ibm.wala.ipa.callgraph.Context)
*/
public boolean understands(CGNode node) {
return getTypesForContext(node.getContext()) != null;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.rta.RTAContextInterpreter#getNewSites(com.ibm.wala.classLoader.IMethod,
* com.ibm.wala.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator<NewSiteReference> iterateNewSites(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
HashSet<NewSiteReference> result = HashSetFactory.make(5);
for (Iterator<SSAInstruction> it = m.getAllocationStatements().iterator(); it.hasNext();) {
SSANewInstruction s = (SSANewInstruction) it.next();
result.add(s.getNewSite());
}
return result.iterator();
}
public Iterator<SSAInstruction> getInvokeStatements(CGNode node) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
return m.getInvokeStatements().iterator();
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.rta.RTAContextInterpreter#getCallSites(com.ibm.wala.classLoader.IMethod,
* com.ibm.detox.ipa.callgraph.Context,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator<CallSiteReference> iterateCallSites(CGNode node, WarningSet warnings) {
final Iterator<SSAInstruction> I = getInvokeStatements(node);
return new Iterator<CallSiteReference>() {
public boolean hasNext() {
return I.hasNext();
}
public CallSiteReference next() {
SSAInvokeInstruction s = (SSAInvokeInstruction) I.next();
return s.getCallSite();
}
public void remove() {
Assertions.UNREACHABLE();
}
};
}
/**
* @author sfink
*
*/
protected class SpecializedFactoryMethod extends SyntheticMethod {
/**
* List of synthetic allocation statements we model for this specialized
* instance
*/
private ArrayList<SSAInstruction> allocations = new ArrayList<SSAInstruction>();
/**
* List of synthetic invoke instructions we model for this specialized
* instance.
*/
private ArrayList<SSAInstruction> calls = new ArrayList<SSAInstruction>();
/**
* List of all instructions
*/
private ArrayList<SSAInstruction> allInstructions = new ArrayList<SSAInstruction>();
/**
* The method being modelled
*/
private final IMethod method;
/**
* Context being modelled
*/
private final Context context;
/**
* next free local value number;
*/
private int nextLocal;
/**
* value number for integer constant 1
*/
private int valueNumberForConstantOne = -1;
private void initValueNumberForConstantOne() {
if (valueNumberForConstantOne == -1) {
valueNumberForConstantOne = nextLocal++;
}
}
private final HashSet<TypeReference> types = HashSetFactory.make(5);
private SpecializedFactoryMethod(final SummarizedMethod m, Context context, final Set S) {
super(m, m.getDeclaringClass(), m.isStatic(), true);
this.context = context;
if (DEBUG) {
Trace.println("Create SpecializedFactoryMethod " + m + S);
}
this.method = m;
if (Assertions.verifyAssertions) {
Assertions._assert(S != null);
Assertions._assert(m.getDeclaringClass() != null, "null declaring class for " + m);
}
// add original statements from the method summary
nextLocal = addOriginalStatements(m);
for (Iterator it = S.iterator(); it.hasNext();) {
TypeReference type = (TypeReference) it.next();
TypeAbstraction T = typeRef2TypeAbstraction(type);
addStatementsForTypeAbstraction(T);
}
}
private void addStatementsForTypeAbstraction(TypeAbstraction T) {
if (DEBUG) {
Trace.println("adding " + T + " to " + method);
}
T = interceptType(T);
if (T == null) {
return;
}
if ((T instanceof PointType) || (T instanceof ConeType)) {
TypeReference ref = T.getType().getReference();
NewSiteReference site = NewSiteReference.make(0, ref);
IClass klass = options.getClassTargetSelector().getAllocatedTarget(null, site);
if (DEBUG) {
Trace.println("Selected allocated target: " + klass + " for " + T);
}
if (T instanceof PointType) {
addStatementsForConcreteType(ref);
} else if (T instanceof ConeType) {
if (DEBUG) {
Trace.println("Cone clause for " + T);
}
if (((ConeType) T).isInterface()) {
Set implementors = cha.getImplementors(ref);
if (DEBUG) {
Trace.println("Implementors for " + T + " " + implementors);
}
if (implementors.isEmpty()) {
if (DEBUG) {
Trace.println("Found no implementors of type " + T);
}
warnings.add(NoSubtypesWarning.create(T));
}
if (implementors.size() > CONE_BOUND) {
warnings.add(ManySubtypesWarning.create(T, implementors.size()));
}
addStatementsForSetOfTypes(implementors.iterator());
} else {
Collection subclasses = cha.computeSubClasses(ref);
if (DEBUG) {
Trace.println("Subclasses for " + T + " " + subclasses);
}
if (subclasses.isEmpty()) {
if (DEBUG) {
Trace.println("Found no subclasses of type " + T);
}
warnings.add(NoSubtypesWarning.create(T));
}
if (subclasses.size() > CONE_BOUND) {
warnings.add(ManySubtypesWarning.create(T, subclasses.size()));
}
addStatementsForSetOfTypes(subclasses.iterator());
}
} else {
Assertions.UNREACHABLE("Unexpected type " + T.getClass());
}
} else if (T instanceof SetType) {
addStatementsForSetOfTypes(((SetType) T).iteratePoints());
} else {
Assertions.UNREACHABLE("Unexpected type " + T.getClass());
}
}
private TypeAbstraction interceptType(TypeAbstraction T) {
TypeReference type = T.getType().getReference();
if (type.equals(TypeReference.JavaIoSerializable)) {
warnings.add(IgnoreSerializableWarning.create());
return null;
} else {
return T;
}
}
/**
* Set up a method summary which allocates and returns an instance of
* concrete type T.
*
* @param T
*/
private void addStatementsForConcreteType(final TypeReference T) {
if (types.contains(T))
return;
types.add(T);
if (DEBUG) {
Trace.println("addStatementsForConcreteType: " + T);
}
NewSiteReference ref = NewSiteReference.make(getNewSiteForType(T), T);
int alloc = getLocalForType(T);
SSANewInstruction a = new SSANewInstruction(alloc, ref);
if (DEBUG) {
Trace.println("Added allocation: " + a);
}
allocations.add(a);
allInstructions.add(a);
SSAReturnInstruction r = new SSAReturnInstruction(alloc, false);
allInstructions.add(r);
if (T.isArrayType()) {
MethodReference init = MethodReference.findOrCreate(T, MethodReference.initAtom, MethodReference.defaultInitDesc);
CallSiteReference site = CallSiteReference.make(getCallSiteForType(T), init, IInvokeInstruction.Dispatch.SPECIAL);
int[] params = new int[1];
params[0] = alloc;
int exc = getExceptionsForType(T);
SSAInvokeInstruction s = new SSAInvokeInstruction(params, exc, site);
calls.add(s);
allInstructions.add(s);
}
}
private int addOriginalStatements(SummarizedMethod m) {
SSAInstruction[] original = m.getStatements(options.getSSAOptions(), warnings);
// local value number 1 is "this", so the next free value number is 2
int nextLocal = 2;
for (int i = 0; i < original.length; i++) {
SSAInstruction s = original[i];
allInstructions.add(s);
if (s instanceof SSAInvokeInstruction) {
calls.add(s);
}
if (s instanceof SSANewInstruction) {
allocations.add(s);
}
for (int j = 0; j < s.getNumberOfDefs(); j++) {
int def = s.getDef(j);
if (def >= nextLocal) {
nextLocal = def + 1;
}
}
for (int j = 0; j < s.getNumberOfUses(); j++) {
int use = s.getUse(j);
if (use >= nextLocal) {
nextLocal = use + 1;
}
}
}
return nextLocal;
}
private void addStatementsForSetOfTypes(Iterator it) {
if (!it.hasNext()) { // Uh. No types. Hope the caller reported a warning.
SSAReturnInstruction r = new SSAReturnInstruction(nextLocal, false);
allInstructions.add(r);
}
for (; it.hasNext();) {
IClass klass = (IClass) it.next();
TypeReference T = klass.getReference();
if (klass.isAbstract() || types.contains(T)) {
continue;
}
types.add(T);
int i = getLocalForType(T);
NewSiteReference ref = NewSiteReference.make(getNewSiteForType(T), T);
SSANewInstruction a = null;
if (T.isArrayType()) {
int[] sizes = new int[T.getDimensionality()];
initValueNumberForConstantOne();
Arrays.fill(sizes, valueNumberForConstantOne);
a = new SSANewInstruction(i, ref, sizes);
} else {
a = new SSANewInstruction(i, ref);
}
allocations.add(a);
allInstructions.add(a);
SSAReturnInstruction r = new SSAReturnInstruction(i, false);
allInstructions.add(r);
MethodReference init = MethodReference.findOrCreate(T, MethodReference.initAtom, MethodReference.defaultInitDesc);
CallSiteReference site = CallSiteReference.make(getCallSiteForType(T), init, IInvokeInstruction.Dispatch.SPECIAL);
int[] params = new int[1];
params[0] = i;
SSAInvokeInstruction s = new SSAInvokeInstruction(params, getExceptionsForType(T), site);
calls.add(s);
allInstructions.add(s);
}
}
public List<SSAInstruction> getAllocationStatements() {
return allocations;
}
public List<SSAInstruction> getInvokeStatements() {
return calls;
}
/**
* Two specialized methods can be different, even if they represent the same
* source method. So, revert to object identity for testing equality. TODO:
* this is non-optimal; could try to re-use specialized methods that have
* the same context.
*
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
return this == obj;
}
public int hashCode() { // TODO: change this to avoid non-determinism!
return System.identityHashCode(this);
}
public String toString() {
return super.toString();
}
public SSAInstruction[] getStatements(WarningSet warnings) {
SSAInstruction[] result = new SSAInstruction[allInstructions.size()];
int i = 0;
for (Iterator<SSAInstruction> it = allInstructions.iterator(); it.hasNext();) {
result[i++] = it.next();
}
return result;
}
public IClass getDeclaringClass() {
if (Assertions.verifyAssertions) {
if (method.getDeclaringClass() == null) {
Assertions._assert(method.getDeclaringClass() != null, "null declaring class for original method " + method);
}
}
return method.getDeclaringClass();
}
public int getNumberOfParameters() {
return method.getNumberOfParameters();
}
public TypeReference getParameterType(int i) {
return method.getParameterType(i);
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IMethod#getIR(com.ibm.wala.util.WarningSet)
*/
public IR makeIR(SSAOptions options, WarningSet warnings) {
SSAInstruction[] instrs = getStatements(warnings);
Map<Integer, ConstantValue> constants = null;
if (valueNumberForConstantOne > -1) {
constants = HashMapFactory.make(1);
constants.put(new Integer(valueNumberForConstantOne), new ConstantValue(new Integer(1)));
}
return new SyntheticIR(this, context, new InducedCFG(instrs, this, context), instrs, options, constants, warnings);
}
}
public boolean recordType(Context context, TypeReference type) {
Set<TypeReference> types = map.get(context);
if (types == null) {
types = HashSetFactory.make(2);
map.put(context, types);
}
if (types.contains(type)) {
return false;
} else {
types.add(type);
// update any extant synthetic method
SpecializedFactoryMethod m = syntheticMethodCache.get(context);
if (m != null) {
TypeAbstraction T = typeRef2TypeAbstraction(type);
m.addStatementsForTypeAbstraction(T);
options.getSSACache().invalidate(m, context);
}
return true;
}
}
/**
* @param type
* @return a TypeAbstraction object representing this type. We just use
* ConeTypes by default, since we don't propagate information allowing
* us to distinguish between points and cones yet.
*/
private TypeAbstraction typeRef2TypeAbstraction(TypeReference type) {
IClass klass = cha.lookupClass(type);
if (klass != null) {
return new ConeType(klass, cha);
// if (klass.isAbstract() || klass.isInterface()) {
// return new ConeType(klass, cha);
// } else {
// return new PointType(klass, cha);
// }
}
Assertions.UNREACHABLE(type.toString());
return null;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.rta.RTAContextInterpreter#recordFactoryType(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.classLoader.IClass)
*/
public boolean recordFactoryType(CGNode node, IClass klass) {
return recordType(node.getContext(), klass.getReference());
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.rta.RTAContextInterpreter#setWarnings(com.ibm.wala.util.warnings.WarningSet)
*/
public void setWarnings(WarningSet newWarnings) {
this.warnings = newWarnings;
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.rta.RTAContextInterpreter#iterateFieldsRead(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator iterateFieldsRead(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
try {
return CodeScanner.iterateFieldsRead(m, warnings);
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
return null;
}
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.rta.RTAContextInterpreter#iterateFieldsWritten(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public Iterator iterateFieldsWritten(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
try {
return CodeScanner.iterateFieldsWritten(m, warnings);
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
return null;
}
}
private SpecializedFactoryMethod findOrCreateSpecializedFactoryMethod(CGNode node) {
SpecializedFactoryMethod m = syntheticMethodCache.get(node.getContext());
if (m == null) {
Set types = getTypesForContext(node.getContext());
m = new SpecializedFactoryMethod((SummarizedMethod) node.getMethod(), node.getContext(), types);
syntheticMethodCache.put(node.getContext(), m);
}
return m;
}
public Set getCaughtExceptions(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
try {
return CodeScanner.getCaughtExceptions(m, warnings);
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
return null;
}
}
public boolean hasObjectArrayLoad(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
try {
return CodeScanner.hasObjectArrayLoad(m, warnings);
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
return false;
}
}
public boolean hasObjectArrayStore(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
try {
return CodeScanner.hasObjectArrayStore(m, warnings);
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
return false;
}
}
public Iterator iterateCastTypes(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
try {
return CodeScanner.iterateCastTypes(m, warnings);
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
return null;
}
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.cfg.CFGProvider#getCFG(com.ibm.wala.ipa.callgraph.CGNode)
*/
public ControlFlowGraph getCFG(CGNode N, WarningSet warnings) {
return getIR(N, warnings).getControlFlowGraph();
}
/**
* @author sfink
*
* A waring when we expect excessive pollution from a factory method
*/
private static class ManySubtypesWarning extends Warning {
final int nImplementors;
final TypeAbstraction T;
ManySubtypesWarning(TypeAbstraction T, int nImplementors) {
super(Warning.MODERATE);
this.T = T;
this.nImplementors = nImplementors;
}
public String getMsg() {
return getClass().toString() + " : " + T + " " + nImplementors;
}
public static ManySubtypesWarning create(TypeAbstraction T, int n) {
return new ManySubtypesWarning(T, n);
}
}
/**
* @author sfink
*
* A warning when we fail to find subtypes for a factory method
*/
private static class NoSubtypesWarning extends Warning {
final TypeAbstraction T;
NoSubtypesWarning(TypeAbstraction T) {
super(Warning.SEVERE);
this.T = T;
}
public String getMsg() {
return getClass().toString() + " : " + T;
}
public static NoSubtypesWarning create(TypeAbstraction T) {
return new NoSubtypesWarning(T);
}
}
/**
* @author sfink
*
* A waring when we find flow of a factory allocation to a cast to
* serializable
*/
private static class IgnoreSerializableWarning extends Warning {
private static IgnoreSerializableWarning instance = new IgnoreSerializableWarning();
public String getMsg() {
return getClass().toString();
}
public static IgnoreSerializableWarning create() {
return instance;
}
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter#getDU(com.ibm.wala.ipa.callgraph.CGNode,
* com.ibm.wala.util.warnings.WarningSet)
*/
public DefUse getDU(CGNode node, WarningSet warnings) {
SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node);
return options.getSSACache().findOrCreateDU(m, node.getContext(), cha, options.getSSAOptions(), warnings);
}
}

View File

@ -1,139 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.reflection;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.SyntheticMethod;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.util.warnings.WarningSet;
/**
* For synthetic methods marked as "Factories", we analyze in a context defined by the caller.
*
* @author sfink
*/
public class FactoryContextSelector implements ContextSelector {
private final MethodTargetSelector methodTargetSelector;
private final ClassHierarchy cha;
/**
* @param methodTargetSelector
*/
public FactoryContextSelector(ClassHierarchy cha, MethodTargetSelector methodTargetSelector) {
this.cha = cha;
this.methodTargetSelector = methodTargetSelector;
}
/* (non-Javadoc)
* @see com.ibm.wala.ipa.callgraph.ContextSelector#getCalleeTarget(com.ibm.wala.ipa.callgraph.CGNode, com.ibm.wala.classLoader.CallSiteReference, com.ibm.wala.classLoader.IMethod)
*/
public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey receiver) {
if (callee.isSynthetic()) {
SyntheticMethod s = (SyntheticMethod) callee;
if (s.isFactoryMethod()) {
return new CallerSiteContext(caller, site);
}
}
return null;
}
/* (non-Javadoc)
* @see com.ibm.wala.ipa.callgraph.ContextSelector#mayUnderstand(com.ibm.wala.ipa.callgraph.CGNode, com.ibm.wala.classLoader.CallSiteReference, com.ibm.wala.classLoader.IMethod, com.ibm.wala.ipa.callgraph.propagation.InstanceKey)
*/
public boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance) {
if (targetMethod.isSynthetic()) {
SyntheticMethod s = (SyntheticMethod) targetMethod;
if (s.isFactoryMethod()) {
return true;
}
}
return false;
}
/* (non-Javadoc)
* @see com.ibm.wala.ipa.callgraph.ContextSelector#getBoundOnNumberOfTargets(com.ibm.wala.ipa.callgraph.CGNode, com.ibm.wala.classLoader.CallSiteReference, com.ibm.wala.classLoader.IMethod)
*/
public int getBoundOnNumberOfTargets(CGNode caller, CallSiteReference site, IMethod callee) {
if (callee.isSynthetic()) {
SyntheticMethod s = (SyntheticMethod) callee;
if (s.isFactoryMethod()) {
return 1;
}
}
return -1;
}
/* (non-Javadoc)
* @see com.ibm.wala.ipa.callgraph.rta.RTAContextInterpreter#setWarnings(com.ibm.wala.util.warnings.WarningSet)
*/
public void setWarnings(WarningSet newWarnings) {
// this object is not bound to a WarningSet
}
/* (non-Javadoc)
* @see com.ibm.wala.ipa.callgraph.ContextSelector#contextIsIrrelevant(com.ibm.wala.classLoader.CallSiteReference)
*/
public boolean contextIsIrrelevant(CGNode node, CallSiteReference site) {
boolean result = methodTargetSelector.mightReturnSyntheticMethod(node,site);
if (result) {
IMethod callee = methodTargetSelector.getCalleeTarget(node, site, null);
if (callee != null && callee.isSynthetic()) {
SyntheticMethod s = (SyntheticMethod) callee;
if (s.isFactoryMethod()) {
return false;
} else {
return true;
}
} else {
return true;
}
} else {
return true;
}
}
/* (non-Javadoc)
* @see com.ibm.wala.ipa.callgraph.ContextSelector#contextIsIrrelevant(com.ibm.wala.types.MethodReference)
*/
public boolean allSitesDispatchIdentically(CGNode node, CallSiteReference site) {
boolean result = methodTargetSelector.mightReturnSyntheticMethod(node,site);
if (result) {
IClass recv = cha.lookupClass(site.getDeclaredTarget().getDeclaringClass());
if (recv == null) {
return false;
}
IMethod callee = methodTargetSelector.getCalleeTarget(node, site, recv);
if (callee != null && callee.isSynthetic()) {
SyntheticMethod s = (SyntheticMethod) callee;
if (s.isFactoryMethod()) {
return false;
} else {
return true;
}
} else {
return true;
}
} else {
return true;
}
}
}

View File

@ -1,28 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.reflection;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
/**
*
* An instance key which has an associated node
*
* @author sfink
*/
public interface InstanceKeyWithNode extends InstanceKey {
/**
* @return the node which created this instance.
*/
CGNode getNode();
}

View File

@ -1,67 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.reflection;
import com.ibm.wala.analysis.typeInference.TypeAbstraction;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextItem;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.util.debug.Assertions;
/**
*
* Implement a Context which corresponds to a given type abstraction.
* Thus, this maps the name "TYPE" to a JavaTypeAbstraction.
*
* @author sfink
*/
public class JavaTypeContext implements Context {
private final TypeAbstraction type;
public JavaTypeContext(TypeAbstraction type) {
if (Assertions.verifyAssertions) {
Assertions._assert(type != null);
}
this.type = type;
}
public ContextItem get(ContextKey name) {
if (Assertions.verifyAssertions) {
Assertions._assert(name == ContextKey.RECEIVER);
}
return type;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return "JavaTypeContext<" + type + ">";
}
public int hashCode() {
return 6367 * type.hashCode();
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (getClass().equals(obj.getClass())) {
JavaTypeContext other = (JavaTypeContext)obj;
return type.equals(other.type);
} else {
return false;
}
}
}

View File

@ -1,35 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 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.analysis.reflection;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.TypeName;
import com.ibm.wala.types.TypeReference;
/**
*
* some utility support for dealing with "malleable" reflection allocations
*
* @author sfink
*/
public class Malleable {
private final static TypeName MalleableName = TypeName.string2TypeName("Lcom/ibm/wala/Malleable");
public final static TypeReference Malleable = TypeReference.findOrCreate(ClassLoaderReference.Primordial, MalleableName);
public final static TypeReference ExtMalleable = TypeReference.findOrCreate(ClassLoaderReference.Extension, MalleableName);
public final static TypeReference MalleableCollection = TypeReference.findOrCreate(ClassLoaderReference.Primordial,
"Lcom/ibm/wala/model/java/util/MalleableCollection");
public static boolean isMalleable(TypeReference T) {
return T.equals(Malleable) || T.equals(ExtMalleable);
}
}

View File

@ -1,5 +0,0 @@
<HTML>
<BODY>
This package provides functions to deal with reflection.
</BODY>
</HTML>

View File

@ -1,6 +0,0 @@
<HTML>
<BODY>
This package provides a layer to perform abstract interpretation over
the JVM stack machine.
</BODY>
</HTML>

Some files were not shown because too many files have changed in this diff Show More