changeset 8893:1c11cbea6bf0

Remove references to G1
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Mon, 08 Apr 2013 16:26:17 +0200
parents d47b52b0ff68
children dedbfa40d6a1
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java
diffstat 5 files changed, 10 insertions(+), 169 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Apr 05 18:53:57 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Mon Apr 08 16:26:17 2013 +0200
@@ -554,10 +554,6 @@
             memoryRead.dependencies().add(tool.createNullCheckGuard(object));
 
             graph.replaceFixedWithFixed(loadField, memoryRead);
-            if (config.useG1GC && field.getKind() == Kind.Object && field.getDeclaringClass().getName().toString().equals("Ljava/lang/ref/Reference;") && field.getName().equals("referent")) {
-                WriteBarrierPre writeBarrierPre = graph.add(new WriteBarrierPre(memoryRead.object(), memoryRead, location, false));
-                graph.addAfterFixed(memoryRead, writeBarrierPre);
-            }
 
             if (loadField.isVolatile()) {
                 MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_READ));
@@ -578,18 +574,9 @@
             FixedWithNextNode first = memoryWrite;
 
             if (field.getKind() == Kind.Object && !memoryWrite.value().objectStamp().alwaysNull()) {
-                if (config.useG1GC) {
-                    WriteBarrierPre writeBarrierPre = graph.add(new WriteBarrierPre(memoryWrite.object(), null, memoryWrite.location(), true));
-                    WriteBarrierPost writeBarrierPost = graph.add(new WriteBarrierPost(memoryWrite.object(), memoryWrite.value(), memoryWrite.location(), false));
-                    graph.addBeforeFixed(memoryWrite, writeBarrierPre);
-                    graph.addAfterFixed(memoryWrite, writeBarrierPost);
-                    first = writeBarrierPre;
-                    last = writeBarrierPost;
-                } else {
-                    FieldWriteBarrier writeBarrier = graph.add(new FieldWriteBarrier(memoryWrite.object()));
-                    graph.addAfterFixed(memoryWrite, writeBarrier);
-                    last = writeBarrier;
-                }
+                FieldWriteBarrier writeBarrier = graph.add(new FieldWriteBarrier(memoryWrite.object()));
+                graph.addAfterFixed(memoryWrite, writeBarrier);
+                last = writeBarrier;
             }
             if (storeField.isVolatile()) {
                 MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_WRITE));
@@ -606,23 +593,10 @@
                 ResolvedJavaType type = cas.object().objectStamp().type();
                 if (type != null && !type.isArray() && !MetaUtil.isJavaLangObject(type)) {
                     // Use a field write barrier since it's not an array store
-                    if (config.useG1GC) {
-                        WriteBarrierPre writeBarrierPre = graph.add(new WriteBarrierPre(cas.object(), null, location, true));
-                        WriteBarrierPost writeBarrierPost = graph.add(new WriteBarrierPost(cas.object(), cas.newValue(), location, false));
-                        graph.addBeforeFixed(cas, writeBarrierPre);
-                        graph.addAfterFixed(cas, writeBarrierPost);
-                    } else {
-                        graph.addAfterFixed(cas, graph.add(new FieldWriteBarrier(cas.object())));
-                    }
+                    graph.addAfterFixed(cas, graph.add(new FieldWriteBarrier(cas.object())));
                 } else {
                     // This may be an array store so use an array write barrier
-                    if (config.useG1GC) {
-                        WriteBarrierPre writeBarrierPre = graph.add(new WriteBarrierPre(cas.object(), null, location, true));
-                        graph.addBeforeFixed(cas, writeBarrierPre);
-                        graph.addAfterFixed(cas, graph.add(new WriteBarrierPost(cas.object(), cas.newValue(), location, true)));
-                    } else {
-                        graph.addAfterFixed(cas, graph.add(new ArrayWriteBarrier(cas.object(), location)));
-                    }
+                    graph.addAfterFixed(cas, graph.add(new ArrayWriteBarrier(cas.object(), location)));
                 }
             }
         } else if (n instanceof LoadIndexedNode) {
@@ -666,14 +640,7 @@
             graph.replaceFixedWithFixed(storeIndexed, memoryWrite);
 
             if (elementKind == Kind.Object && !value.objectStamp().alwaysNull()) {
-                if (config.useG1GC) {
-                    WriteBarrierPre writeBarrierPre = graph.add(new WriteBarrierPre(array, null, arrayLocation, true));
-                    graph.addBeforeFixed(memoryWrite, writeBarrierPre);
-                    WriteBarrierPost writeBarrierPost = graph.add(new WriteBarrierPost(array, value, arrayLocation, true));
-                    graph.addAfterFixed(memoryWrite, writeBarrierPost);
-                } else {
-                    graph.addAfterFixed(memoryWrite, graph.add(new ArrayWriteBarrier(array, arrayLocation)));
-                }
+                graph.addAfterFixed(memoryWrite, graph.add(new ArrayWriteBarrier(array, arrayLocation)));
             }
         } else if (n instanceof UnsafeLoadNode) {
             UnsafeLoadNode load = (UnsafeLoadNode) n;
@@ -696,22 +663,10 @@
                 // WriteBarrier writeBarrier;
                 if (type != null && !type.isArray() && !MetaUtil.isJavaLangObject(type)) {
                     // Use a field write barrier since it's not an array store
-                    if (config.useG1GC) {
-                        WriteBarrierPre writeBarrierPre = new WriteBarrierPre(object, null, location, true);
-                        graph.addBeforeFixed(write, graph.add(writeBarrierPre));
-                        graph.addAfterFixed(write, graph.add(new WriteBarrierPost(object, write.value(), location, false)));
-                    } else {
-                        graph.addAfterFixed(write, graph.add(new FieldWriteBarrier(object)));
-                    }
+                    graph.addAfterFixed(write, graph.add(new FieldWriteBarrier(object)));
                 } else {
                     // This may be an array store so use an array write barrier
-                    if (config.useG1GC) {
-                        WriteBarrierPre writeBarrierPre = graph.add(new WriteBarrierPre(object, null, location, true));
-                        graph.addBeforeFixed(write, writeBarrierPre);
-                        graph.addAfterFixed(write, graph.add(new WriteBarrierPost(object, write.value(), location, true)));
-                    } else {
-                        graph.addAfterFixed(write, graph.add(new ArrayWriteBarrier(object, location)));
-                    }
+                    graph.addAfterFixed(write, graph.add(new ArrayWriteBarrier(object, location)));
                 }
             }
         } else if (n instanceof LoadHubNode) {
@@ -748,10 +703,6 @@
             writeBarrierSnippets.lower((FieldWriteBarrier) n, tool);
         } else if (n instanceof ArrayWriteBarrier) {
             writeBarrierSnippets.lower((ArrayWriteBarrier) n, tool);
-        } else if (n instanceof WriteBarrierPre) {
-            writeBarrierSnippets.lower((WriteBarrierPre) n, tool);
-        } else if (n instanceof WriteBarrierPost) {
-            writeBarrierSnippets.lower((WriteBarrierPost) n, tool);
         } else if (n instanceof TLABAllocateNode) {
             newObjectSnippets.lower((TLABAllocateNode) n, tool);
         } else if (n instanceof InitializeObjectNode) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java	Fri Apr 05 18:53:57 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java	Mon Apr 08 16:26:17 2013 +0200
@@ -75,7 +75,7 @@
     public boolean fillContents() {
         // We fill contents when G1 GC is used since we want to record
         // the original field values prior to stores
-        return HotSpotSnippetUtils.useG1GC() ? true : fillContents;
+        return fillContents;
     }
 
     public boolean locked() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java	Fri Apr 05 18:53:57 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java	Mon Apr 08 16:26:17 2013 +0200
@@ -57,7 +57,7 @@
     }
 
     public boolean fillContents() {
-        return HotSpotSnippetUtils.useG1GC() ? true : fillContents;
+        return fillContents;
     }
 
     public boolean locked() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Fri Apr 05 18:53:57 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Mon Apr 08 16:26:17 2013 +0200
@@ -40,85 +40,6 @@
 public class WriteBarrierSnippets implements Snippets {
 
     @Snippet
-    public static void g1PreWriteBarrier(@Parameter("object") Object obj, @Parameter("expectedObject") Object expobj, @Parameter("location") Object location,
-                    @ConstantParameter("doLoad") boolean doLoad) {
-        Word thread = thread();
-        Object object = FixedValueAnchorNode.getObject(obj);
-        Object expectedObject = FixedValueAnchorNode.getObject(expobj);
-        Word field = (Word) Word.fromArray(object, location);
-        Word previousOop = (Word) Word.fromObject(expectedObject);
-        byte markingValue = thread.readByte(HotSpotSnippetUtils.g1SATBQueueMarkingOffset());
-
-        Word bufferAddress = thread.readWord(HotSpotSnippetUtils.g1SATBQueueBufferOffset());
-        Word indexAddress = thread.add(HotSpotSnippetUtils.g1SATBQueueIndexOffset());
-        Word indexValue = indexAddress.readWord(0);
-
-        if (markingValue != (byte) 0) {
-            if (doLoad) {
-                previousOop = field.readWord(0);
-            }
-            if (previousOop.notEqual(Word.zero())) {
-                if (indexValue.notEqual(Word.zero())) {
-                    Word nextIndex = indexValue.subtract(HotSpotSnippetUtils.wordSize());
-                    Word logAddress = bufferAddress.add(nextIndex);
-                    logAddress.writeWord(0, previousOop);
-                    indexAddress.writeWord(0, nextIndex);
-                } else {
-                    WriteBarrierPreStubCall.call(previousOop);
-
-                }
-            }
-        }
-    }
-
-    @Snippet
-    public static void g1PostWriteBarrier(@Parameter("object") Object obj, @Parameter("value") Object value, @Parameter("location") Object location, @ConstantParameter("usePrecise") boolean usePrecise) {
-        Word thread = thread();
-        Object object = FixedValueAnchorNode.getObject(obj);
-        Object wrObject = FixedValueAnchorNode.getObject(value);
-        Word oop = (Word) Word.fromObject(object);
-        Word field;
-        if (usePrecise) {
-            field = (Word) Word.fromArray(object, location);
-        } else {
-            field = oop;
-        }
-        Word writtenValue = (Word) Word.fromObject(wrObject);
-        Word bufferAddress = thread.readWord(HotSpotSnippetUtils.g1CardQueueBufferOffset());
-        Word indexAddress = thread.add(HotSpotSnippetUtils.g1CardQueueIndexOffset());
-        Word indexValue = thread.readWord(HotSpotSnippetUtils.g1CardQueueIndexOffset());
-        Word xorResult = (field.xor(writtenValue)).unsignedShiftRight(HotSpotSnippetUtils.logOfHRGrainBytes());
-
-        // Card Table
-        Word cardBase = field.unsignedShiftRight(cardTableShift());
-        long startAddress = cardTableStart();
-        int displacement = 0;
-        if (((int) startAddress) == startAddress) {
-            displacement = (int) startAddress;
-        } else {
-            cardBase = cardBase.add(Word.unsigned(cardTableStart()));
-        }
-        Word cardAddress = cardBase.add(displacement);
-
-        if (xorResult.notEqual(Word.zero())) {
-            if (writtenValue.notEqual(Word.zero())) {
-                byte cardByte = cardAddress.readByte(0);
-                if (cardByte != (byte) 0) {
-                    cardAddress.writeByte(0, (byte) 0); // smash zero into card
-                    if (indexValue.notEqual(Word.zero())) {
-                        Word nextIndex = indexValue.subtract(HotSpotSnippetUtils.wordSize());
-                        Word logAddress = bufferAddress.add(nextIndex);
-                        logAddress.writeWord(0, cardAddress);
-                        indexAddress.writeWord(0, nextIndex);
-                    } else {
-                        WriteBarrierPostStubCall.call(object, cardAddress);
-                    }
-                }
-            }
-        }
-    }
-
-    @Snippet
     public static void serialFieldWriteBarrier(@Parameter("object") Object obj) {
         Object object = FixedValueAnchorNode.getObject(obj);
         Pointer oop = Word.fromObject(object);
@@ -152,15 +73,11 @@
 
         private final ResolvedJavaMethod serialFieldWriteBarrier;
         private final ResolvedJavaMethod serialArrayWriteBarrier;
-        private final ResolvedJavaMethod g1PreWriteBarrier;
-        private final ResolvedJavaMethod g1PostWriteBarrier;
 
         public Templates(CodeCacheProvider runtime, Replacements replacements, TargetDescription target) {
             super(runtime, replacements, target, WriteBarrierSnippets.class);
             serialFieldWriteBarrier = snippet("serialFieldWriteBarrier", Object.class);
             serialArrayWriteBarrier = snippet("serialArrayWriteBarrier", Object.class, Object.class);
-            g1PreWriteBarrier = snippet("g1PreWriteBarrier", Object.class, Object.class, Object.class, boolean.class);
-            g1PostWriteBarrier = snippet("g1PostWriteBarrier", Object.class, Object.class, Object.class, boolean.class);
         }
 
         public void lower(ArrayWriteBarrier arrayWriteBarrier, @SuppressWarnings("unused") LoweringTool tool) {
@@ -182,29 +99,5 @@
             template.instantiate(runtime, fieldWriteBarrier, DEFAULT_REPLACER, arguments);
         }
 
-        public void lower(WriteBarrierPre writeBarrierPre, @SuppressWarnings("unused") LoweringTool tool) {
-            ResolvedJavaMethod method = g1PreWriteBarrier;
-            Key key = new Key(method);
-            key.add("doLoad", writeBarrierPre.doLoad());
-            Arguments arguments = new Arguments();
-            arguments.add("object", writeBarrierPre.getObject());
-            arguments.add("expectedObject", writeBarrierPre.getExpectedObject());
-            arguments.add("location", writeBarrierPre.getLocation());
-            SnippetTemplate template = cache.get(key);
-            template.instantiate(runtime, writeBarrierPre, DEFAULT_REPLACER, arguments);
-        }
-
-        public void lower(WriteBarrierPost writeBarrierPost, @SuppressWarnings("unused") LoweringTool tool) {
-            ResolvedJavaMethod method = g1PostWriteBarrier;
-            Key key = new Key(method);
-            key.add("usePrecise", writeBarrierPost.usePrecise());
-            Arguments arguments = new Arguments();
-            arguments.add("object", writeBarrierPost.getObject());
-            arguments.add("location", writeBarrierPost.getLocation());
-            arguments.add("value", writeBarrierPost.getValue());
-            SnippetTemplate template = cache.get(key);
-            template.instantiate(runtime, writeBarrierPost, DEFAULT_REPLACER, arguments);
-        }
-
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Fri Apr 05 18:53:57 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Mon Apr 08 16:26:17 2013 +0200
@@ -95,9 +95,6 @@
      *         operation was unsuccessful
      */
     static Word refillAllocate(Word intArrayHub, int sizeInBytes, boolean log) {
-        if (useG1GC()) {
-            return Word.zero();
-        }
         if (!useTLAB()) {
             return edenAllocate(Word.unsigned(sizeInBytes), log);
         }