fix bug with phi instructions in synthetic IRs
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2638 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
32a7543322
commit
413bed8c84
|
@ -108,28 +108,6 @@ public class CallGraphTest extends WalaTestCase {
|
|||
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, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.HELLO, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
|
@ -140,6 +118,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
doCallGraphs(options, new AnalysisCache(), cha, scope);
|
||||
}
|
||||
|
||||
|
||||
public void testRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA,
|
||||
CallGraphTestUtil.REGRESSION_EXCLUSIONS);
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*******************************************************************************
|
||||
* 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.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
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.eclipse.util.CancelException;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
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.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.SubtypesEntrypoint;
|
||||
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.ClassLoaderReference;
|
||||
import com.ibm.wala.types.MethodReference;
|
||||
import com.ibm.wala.types.TypeReference;
|
||||
|
||||
/**
|
||||
* Tests for synthetic methods
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
|
||||
public class SyntheticTest extends WalaTestCase {
|
||||
|
||||
public void testMultiSubtypes() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA,
|
||||
CallGraphTestUtil.REGRESSION_EXCLUSIONS);
|
||||
ClassHierarchy cha = ClassHierarchy.make(scope);
|
||||
TypeReference t = TypeReference.findOrCreate(ClassLoaderReference.Application, "LmultiTypes/Foo");
|
||||
MethodReference mref = MethodReference.findOrCreate(t, "foo", "(LmultiTypes/Foo$A;)V");
|
||||
IMethod m = cha.resolveMethod(mref);
|
||||
assert m != null;
|
||||
SubtypesEntrypoint e = new SubtypesEntrypoint(m, cha);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, Collections.<Entrypoint>singleton(e));
|
||||
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
|
||||
TypeReference tA = TypeReference.findOrCreate(ClassLoaderReference.Application, "LmultiTypes/Foo$A");
|
||||
MethodReference barA = MethodReference.findOrCreate(tA, "bar", "()V");
|
||||
TypeReference tB = TypeReference.findOrCreate(ClassLoaderReference.Application, "LmultiTypes/Foo$B");
|
||||
MethodReference barB = MethodReference.findOrCreate(tB, "bar", "()V");
|
||||
assertTrue(cg.getNodes(barA).size() == 1);
|
||||
assertTrue(cg.getNodes(barB).size() == 1);
|
||||
|
||||
CGNode root = cg.getFakeRootNode();
|
||||
IR ir = root.getIR();
|
||||
assertTrue(ir.iteratePhis().hasNext());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue