changeset 12767:5a51864f3088

moved raw memory TLAB allocation routine into NewInstanceStub and unsnippetized it
author Doug Simon <doug.simon@oracle.com>
date Thu, 14 Nov 2013 15:02:17 +0100
parents 0b7172f093d0
children 2842b357c316
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java
diffstat 2 files changed, 18 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Wed Nov 13 11:14:31 2013 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Thu Nov 14 15:02:17 2013 +0100
@@ -80,23 +80,6 @@
 
     public static final ProfileMode PROFILE_MODE = ProfileMode.Total;
 
-    @Snippet
-    public static Word allocate(int size) {
-        Word thread = thread();
-        Word top = readTlabTop(thread);
-        Word end = readTlabEnd(thread);
-        Word newTop = top.add(size);
-        /*
-         * this check might lead to problems if the TLAB is within 16GB of the address space end
-         * (checked in c++ code)
-         */
-        if (probability(FAST_PATH_PROBABILITY, newTop.belowOrEqual(end))) {
-            writeTlabTop(thread, newTop);
-            return top;
-        }
-        return Word.zero();
-    }
-
     @Fold
     private static String createName(String path, String typeContext) {
         switch (PROFILE_MODE) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Wed Nov 13 11:14:31 2013 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Thu Nov 14 15:02:17 2013 +0100
@@ -26,8 +26,8 @@
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.hotspot.nodes.DirectCompareAndSwapNode.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
-import static com.oracle.graal.hotspot.replacements.NewObjectSnippets.*;
 import static com.oracle.graal.hotspot.stubs.StubUtil.*;
+import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
@@ -73,6 +73,22 @@
         return args;
     }
 
+    private static Word allocate(int size) {
+        Word thread = thread();
+        Word top = readTlabTop(thread);
+        Word end = readTlabEnd(thread);
+        Word newTop = top.add(size);
+        /*
+         * this check might lead to problems if the TLAB is within 16GB of the address space end
+         * (checked in c++ code)
+         */
+        if (probability(FAST_PATH_PROBABILITY, newTop.belowOrEqual(end))) {
+            writeTlabTop(thread, newTop);
+            return top;
+        }
+        return Word.zero();
+    }
+
     @Fold
     private static boolean logging() {
         return Boolean.getBoolean("graal.logNewInstanceStub");
@@ -190,7 +206,7 @@
                 end = top.add(tlabRefillSizeInBytes.subtract(alignmentReserveInBytes));
                 initializeTlab(thread, top, end);
 
-                return allocate(sizeInBytes);
+                return NewInstanceStub.allocate(sizeInBytes);
             } else {
                 return Word.zero();
             }