Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/CompiledMethodTest.java @ 5541:b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 09 Jun 2012 16:52:12 +0200 |
parents | a891c53a295b |
children | 0083a59ced84 |
comparison
equal
deleted
inserted
replaced
5540:a891c53a295b | 5541:b4c406861c33 |
---|---|
64 graph.replaceFloating(constant, ConstantNode.forObject("-", runtime, graph)); | 64 graph.replaceFloating(constant, ConstantNode.forObject("-", runtime, graph)); |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 final RiResolvedMethod riMethod = runtime.getRiMethod(method); | 69 final ResolvedJavaMethod riMethod = runtime.getResolvedJavaMethod(method); |
70 InstalledCode compiledMethod = compile(riMethod, graph); | 70 InstalledCode compiledMethod = compile(riMethod, graph); |
71 try { | 71 try { |
72 Object result = compiledMethod.execute("1", "2", "3"); | 72 Object result = compiledMethod.execute("1", "2", "3"); |
73 Assert.assertEquals("1-2-3", result); | 73 Assert.assertEquals("1-2-3", result); |
74 } catch (MethodInvalidatedException t) { | 74 } catch (MethodInvalidatedException t) { |
78 | 78 |
79 @Test | 79 @Test |
80 public void test3() { | 80 public void test3() { |
81 Method method = getMethod("testMethod"); | 81 Method method = getMethod("testMethod"); |
82 final StructuredGraph graph = parse(method); | 82 final StructuredGraph graph = parse(method); |
83 final RiResolvedMethod riMethod = runtime.getRiMethod(method); | 83 final ResolvedJavaMethod riMethod = runtime.getResolvedJavaMethod(method); |
84 InstalledCode compiledMethod = compile(riMethod, graph); | 84 InstalledCode compiledMethod = compile(riMethod, graph); |
85 try { | 85 try { |
86 Object result = compiledMethod.executeVarargs("1", "2", "3"); | 86 Object result = compiledMethod.executeVarargs("1", "2", "3"); |
87 Assert.assertEquals("1 2 3", result); | 87 Assert.assertEquals("1 2 3", result); |
88 } catch (MethodInvalidatedException t) { | 88 } catch (MethodInvalidatedException t) { |
92 | 92 |
93 @Test | 93 @Test |
94 public void test4() { | 94 public void test4() { |
95 Method method = getMethod("testMethodVirtual"); | 95 Method method = getMethod("testMethodVirtual"); |
96 final StructuredGraph graph = parse(method); | 96 final StructuredGraph graph = parse(method); |
97 final RiResolvedMethod riMethod = runtime.getRiMethod(method); | 97 final ResolvedJavaMethod riMethod = runtime.getResolvedJavaMethod(method); |
98 InstalledCode compiledMethod = compile(riMethod, graph); | 98 InstalledCode compiledMethod = compile(riMethod, graph); |
99 try { | 99 try { |
100 f1 = "0"; | 100 f1 = "0"; |
101 Object result = compiledMethod.executeVarargs(this, "1", "2", "3"); | 101 Object result = compiledMethod.executeVarargs(this, "1", "2", "3"); |
102 Assert.assertEquals("0 1 2 3", result); | 102 Assert.assertEquals("0 1 2 3", result); |
106 } | 106 } |
107 | 107 |
108 @Test | 108 @Test |
109 public void test2() throws NoSuchMethodException, SecurityException { | 109 public void test2() throws NoSuchMethodException, SecurityException { |
110 Method method = CompilableObjectImpl.class.getDeclaredMethod("executeHelper", ObjectCompiler.class, String.class); | 110 Method method = CompilableObjectImpl.class.getDeclaredMethod("executeHelper", ObjectCompiler.class, String.class); |
111 RiResolvedMethod riMethod = runtime.getRiMethod(method); | 111 ResolvedJavaMethod riMethod = runtime.getResolvedJavaMethod(method); |
112 StructuredGraph graph = new StructuredGraph(riMethod); | 112 StructuredGraph graph = new StructuredGraph(riMethod); |
113 new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(graph); | 113 new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(graph); |
114 new CanonicalizerPhase(null, runtime, null).apply(graph); | 114 new CanonicalizerPhase(null, runtime, null).apply(graph); |
115 new DeadCodeEliminationPhase().apply(graph); | 115 new DeadCodeEliminationPhase().apply(graph); |
116 | 116 |