changeset 9044:5eab174fb727

Remove non-test from InstalledCodeExecuteHelperTest
author Matthias Grimmer <grimmer@ssw.jku.at>
date Fri, 12 Apr 2013 16:43:20 +0200
parents 340eb23d3a0a
children d4da9378903d
files graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotInstalledCodeExecuteNode.java
diffstat 2 files changed, 9 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java	Fri Apr 12 16:20:55 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java	Fri Apr 12 16:43:20 2013 +0200
@@ -38,15 +38,10 @@
 
 public class InstalledCodeExecuteHelperTest extends GraalCompilerTest {
 
-    private static final int ITERATIONS = 1000000;
+    private static final int ITERATIONS = 100000;
     private final MetaAccessProvider metaAccessProvider;
     Object[] argsToBind;
 
-    public static void main(String[] args) throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        InstalledCodeExecuteHelperTest main = new InstalledCodeExecuteHelperTest();
-        main.testWithTime();
-    }
-
     public InstalledCodeExecuteHelperTest() {
         this.metaAccessProvider = Graal.getRequiredCapability(MetaAccessProvider.class);
     }
@@ -69,32 +64,12 @@
 
     }
 
-    public void testWithTime() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = InstalledCodeExecuteHelperTest.class.getMethod("foo", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-
-        argsToBind = new Object[]{fooCode};
-
-        final Method benchmarkMethod = InstalledCodeExecuteHelperTest.class.getMethod("benchmark", HotSpotInstalledCode.class);
-        final ResolvedJavaMethod benchmarkJavaMethod = metaAccessProvider.lookupJavaMethod(benchmarkMethod);
-        final HotSpotInstalledCode installedBenchmarkCodeotInstalledCode = (HotSpotInstalledCode) getCode(benchmarkJavaMethod, parse(benchmarkMethod));
-
-        long start = System.currentTimeMillis();
-        benchmark(fooCode);
-        long end = System.currentTimeMillis();
-        System.out.println((end - start));
-
-        start = System.currentTimeMillis();
-        installedBenchmarkCodeotInstalledCode.executeVarargs(argsToBind[0]);
-        end = System.currentTimeMillis();
-        System.out.println((end - start));
-    }
-
     public static Integer benchmark(HotSpotInstalledCode code) throws InvalidInstalledCodeException {
         int val = 0;
-        for (int i = 0; i < ITERATIONS; i++) {
-            val = (Integer) code.execute(null, null, null);
+        for (int j = 0; j < 100; j++) {
+            for (int i = 0; i < ITERATIONS; i++) {
+                val = (Integer) code.execute(null, null, null);
+            }
         }
         return val;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotInstalledCodeExecuteNode.java	Fri Apr 12 16:20:55 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotInstalledCodeExecuteNode.java	Fri Apr 12 16:43:20 2013 +0200
@@ -55,7 +55,10 @@
         if (code.isConstant() && code.asConstant().asObject() instanceof HotSpotInstalledCode) {
             HotSpotInstalledCode hsCode = (HotSpotInstalledCode) code.asConstant().asObject();
             InvokeNode invoke = replaceWithInvoke(tool.getRuntime());
-            InliningUtil.inline(invoke, (StructuredGraph) hsCode.getGraph(), false);
+            StructuredGraph graph = (StructuredGraph) hsCode.getGraph();
+            if (graph != null) {
+                InliningUtil.inline(invoke, (StructuredGraph) hsCode.getGraph(), false);
+            }
         } else {
             replaceWithInvoke(tool.getRuntime());
         }