changeset 7238:7f55fd5f897d

introduced graal.newArrayStub.forceSlowPath and graal.newInstanceStub.forceSlowPath system properties
author Doug Simon <doug.simon@oracle.com>
date Mon, 17 Dec 2012 11:45:09 +0100
parents 509d72a1d81b
children 885a6849ee9e
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Mon Dec 17 11:29:06 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Mon Dec 17 11:45:09 2012 +0100
@@ -33,6 +33,7 @@
 import com.oracle.graal.hotspot.snippets.*;
 import com.oracle.graal.snippets.*;
 import com.oracle.graal.snippets.Snippet.ConstantParameter;
+import com.oracle.graal.snippets.Snippet.Fold;
 import com.oracle.graal.snippets.Snippet.Parameter;
 import com.oracle.graal.snippets.SnippetTemplate.Key;
 
@@ -81,7 +82,7 @@
         log(log, "newArray: hub=%p\n", hub.toLong());
 
         // check that array length is small enough for fast path.
-        if (length <= MAX_ARRAY_FAST_PATH_ALLOCATION_LENGTH) {
+        if (!forceSlowPath() && length <= MAX_ARRAY_FAST_PATH_ALLOCATION_LENGTH) {
             Word memory;
             if (refillTLAB(intArrayHub, Word.fromLong(tlabIntArrayMarkWord()), tlabAlignmentReserveInHeapWords() * wordSize(), log)) {
                 memory = allocate(sizeInBytes);
@@ -98,4 +99,9 @@
         log(log, "newArray: calling new_array_slow", 0L);
         return verifyOop(NewArraySlowStubCall.call(hub, length));
     }
+
+    @Fold
+    private static boolean forceSlowPath() {
+        return Boolean.getBoolean("graal.newArrayStub.forceSlowPath");
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Mon Dec 17 11:29:06 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Mon Dec 17 11:45:09 2012 +0100
@@ -34,8 +34,7 @@
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.snippets.*;
 import com.oracle.graal.snippets.*;
-import com.oracle.graal.snippets.Snippet.ConstantParameter;
-import com.oracle.graal.snippets.Snippet.Parameter;
+import com.oracle.graal.snippets.Snippet.*;
 import com.oracle.graal.snippets.SnippetTemplate.Key;
 
 /**
@@ -70,7 +69,7 @@
                     @ConstantParameter("intArrayHub") Word intArrayHub,
                     @ConstantParameter("log") boolean log) {
         int sizeInBytes = loadIntFromWord(hub, klassInstanceSizeOffset());
-        if (inlineContiguousAllocationSupported()) {
+        if (!forceSlowPath() && inlineContiguousAllocationSupported()) {
             if (loadIntFromWord(hub, klassStateOffset()) == klassStateFullyInitialized()) {
                 Word memory;
                 if (refillTLAB(intArrayHub, Word.fromLong(tlabIntArrayMarkWord()), tlabAlignmentReserveInHeapWords() * wordSize(), log)) {
@@ -204,6 +203,11 @@
         }
     }
 
+    @Fold
+    private static boolean forceSlowPath() {
+        return Boolean.getBoolean("graal.newInstanceStub.forceSlowPath");
+    }
+
     static void log(boolean enabled, String format, long value) {
         if (enabled) {
             Log.printf(format, value);