changeset 8478:e9dad49ce336

made method substitutions for System be interpretable
author Doug Simon <doug.simon@oracle.com>
date Tue, 26 Mar 2013 12:53:02 +0100
parents abf5a4554bae
children a6ba61be2b5f
files graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/HotSpotMethodSubstitutionTest.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java
diffstat 3 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/HotSpotMethodSubstitutionTest.java	Tue Mar 26 12:48:44 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/HotSpotMethodSubstitutionTest.java	Tue Mar 26 12:53:02 2013 +0100
@@ -125,6 +125,12 @@
     public void testSystemSubstitutions() {
         test("systemTime");
         test("systemIdentityHashCode");
+
+        SystemSubstitutions.currentTimeMillis();
+        SystemSubstitutions.nanoTime();
+        for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) {
+            assertEquals(System.identityHashCode(o), SystemSubstitutions.identityHashCode(o));
+        }
     }
 
     @SuppressWarnings("all")
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java	Tue Mar 26 12:48:44 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java	Tue Mar 26 12:53:02 2013 +0100
@@ -52,5 +52,7 @@
     }
 
     @NodeIntrinsic
-    public static native int call(Object object);
+    public static int call(Object object) {
+        return System.identityHashCode(object);
+    }
 }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java	Tue Mar 26 12:48:44 2013 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BranchProbabilityNode.java	Tue Mar 26 12:53:02 2013 +0100
@@ -75,7 +75,9 @@
         GraphUtil.killCFG(this);
     }
 
+    @SuppressWarnings("unused")
     @NodeIntrinsic
-    public static native void probability(@ConstantNodeParameter double probability);
+    public static void probability(@ConstantNodeParameter double probability) {
+    }
 
 }