# HG changeset patch # User Christos Kotselidis # Date 1362594904 -3600 # Node ID 41fc46da946a794e9dd2428df35b57428a4c0f6c # Parent 992f62c457b074b9ce79672eefb7432982fc9ab7 -More fixes and passrate(fop) diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Wed Mar 06 19:35:04 2013 +0100 @@ -608,8 +608,10 @@ memoryWrite.setStateAfter(storeField.stateAfter()); graph.replaceFixedWithFixed(storeField, memoryWrite); FixedWithNextNode last = memoryWrite; + FixedWithNextNode first = memoryWrite; + if (field.getKind() == Kind.Object && !memoryWrite.value().objectStamp().alwaysNull()) { - if (!config.useG1GC) { + if (!HotSpotSnippetUtils.useG1GC()) { FieldWriteBarrier writeBarrier = graph.add(new FieldWriteBarrier(memoryWrite.object())); graph.addAfterFixed(memoryWrite, writeBarrier); last = writeBarrier; @@ -619,13 +621,14 @@ WriteBarrierPost writeBarrierPost = graph.add(new WriteBarrierPost(memoryWrite.object(), memoryWrite.value(), memoryWrite.location())); graph.addBeforeFixed(memoryWrite, writeBarrierPre); graph.addAfterFixed(memoryWrite, writeBarrierPost); + first = writeBarrierPre; last = writeBarrierPost; } } if (storeField.isVolatile()) { MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_WRITE)); - graph.addBeforeFixed(memoryWrite, preMembar); + graph.addBeforeFixed(first, preMembar); MembarNode postMembar = graph.add(new MembarNode(JMM_POST_VOLATILE_WRITE)); graph.addAfterFixed(last, postMembar); } @@ -637,7 +640,7 @@ 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) { + if (!HotSpotSnippetUtils.useG1GC()) { FieldWriteBarrier writeBarrier = graph.add(new FieldWriteBarrier(cas.object())); graph.addAfterFixed(cas, writeBarrier); } else { @@ -651,7 +654,7 @@ } else { LocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, cas.expected().kind(), cas.displacement(), cas.offset(), graph, false); // This may be an array store so use an array write barrier - if (!config.useG1GC) { + if (!HotSpotSnippetUtils.useG1GC()) { graph.addAfterFixed(cas, graph.add(new ArrayWriteBarrier(cas.object(), (IndexedLocationNode) location))); } else { graph.addBeforeFixed(cas, graph.add(new WriteBarrierPre(cas.object(), location, true))); @@ -702,7 +705,7 @@ graph.replaceFixedWithFixed(storeIndexed, memoryWrite); if (elementKind == Kind.Object && !value.objectStamp().alwaysNull()) { - if (!config.useG1GC) { + if (!HotSpotSnippetUtils.useG1GC()) { graph.addAfterFixed(memoryWrite, graph.add(new ArrayWriteBarrier(array, (IndexedLocationNode) arrayLocation))); } else { graph.addBeforeFixed(memoryWrite, graph.add(new WriteBarrierPre(array, arrayLocation, true))); @@ -730,21 +733,21 @@ // 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) { + if (!HotSpotSnippetUtils.useG1GC()) { FieldWriteBarrier writeBarrier = graph.add(new FieldWriteBarrier(object)); graph.addAfterFixed(write, writeBarrier); } else { graph.addBeforeFixed(write, graph.add(new WriteBarrierPre(object, location, true))); - graph.addAfterFixed(write, graph.add(new WriteBarrierPost(object, write.value(), write.location()))); + graph.addAfterFixed(write, graph.add(new WriteBarrierPost(object, write.value(), location))); } } else { // This may be an array store so use an array write barrier - if (!config.useG1GC) { + if (!HotSpotSnippetUtils.useG1GC()) { ArrayWriteBarrier writeBarrier = graph.add(new ArrayWriteBarrier(object, location)); graph.addAfterFixed(write, writeBarrier); } else { graph.addBeforeFixed(write, graph.add(new WriteBarrierPre(object, location, true))); - graph.addAfterFixed(write, graph.add(new WriteBarrierPost(object, store.value(), location))); + graph.addAfterFixed(write, graph.add(new WriteBarrierPost(object, write.value(), location))); } } } diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java Wed Mar 06 19:35:04 2013 +0100 @@ -23,7 +23,7 @@ package com.oracle.graal.hotspot.nodes; import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.snippets.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -73,7 +73,7 @@ } public boolean fillContents() { - return HotSpotGraalRuntime.getInstance().getConfig().useG1GC ? true : fillContents; + return HotSpotSnippetUtils.useG1GC() ? true : fillContents; } public boolean locked() { diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java Wed Mar 06 19:35:04 2013 +0100 @@ -24,6 +24,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.snippets.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -57,7 +58,7 @@ } public boolean fillContents() { - return HotSpotGraalRuntime.getInstance().getConfig().useG1GC ? true : fillContents; + return HotSpotSnippetUtils.useG1GC() ? true : fillContents; } public boolean locked() { diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPostStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPostStubCall.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPostStubCall.java Wed Mar 06 19:35:04 2013 +0100 @@ -48,7 +48,7 @@ @Override public void generate(LIRGenerator gen) { RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(WriteBarrierPostStubCall.WBPOSTCALL); - gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(object), gen.operand(card)); + gen.emitCall(stub, stub.getCallingConvention(), false, gen.operand(object), gen.operand(card)); } @NodeIntrinsic diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPreStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPreStubCall.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierPreStubCall.java Wed Mar 06 19:35:04 2013 +0100 @@ -45,7 +45,7 @@ @Override public void generate(LIRGenerator gen) { RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(WriteBarrierPreStubCall.WBPRECALL); - gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(object)); + gen.emitCall(stub, stub.getCallingConvention(), false, gen.operand(object)); } @NodeIntrinsic diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Wed Mar 06 19:35:04 2013 +0100 @@ -283,6 +283,11 @@ } @Fold + public static boolean useG1GC() { + return config().useG1GC; + } + + @Fold static int uninitializedIdentityHashCodeValue() { return config().uninitializedIdentityHashCodeValue; } diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Wed Mar 06 19:35:04 2013 +0100 @@ -74,10 +74,7 @@ if (newTop.belowOrEqual(end)) { probability(FAST_PATH_PROBABILITY); thread.writeWord(threadTlabTopOffset(), newTop); - trace(true, " Allocate object at: 0x%016lx\n", newTop); - return top; - } return Word.zero(); } diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/WriteBarrierSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/WriteBarrierSnippets.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/WriteBarrierSnippets.java Wed Mar 06 19:35:04 2013 +0100 @@ -41,7 +41,7 @@ public class WriteBarrierSnippets implements SnippetsInterface { private static final boolean TRACE = false; - private static final SnippetCounter.Group counters = WriteBarrierSnippets.TRACE ? new SnippetCounter.Group("GC") : null; + public static final SnippetCounter.Group counters = WriteBarrierSnippets.TRACE ? new SnippetCounter.Group("GC") : null; private static final SnippetCounter g1PreCounter = new SnippetCounter(counters, "G1-PRE", "G1-PRE"); private static final SnippetCounter g1PostCounter = new SnippetCounter(counters, "G1-POST", "G1-POST"); @@ -55,7 +55,8 @@ Pointer field = Word.fromArray(object, location); Pointer previousOop = field.readWord(0); - VerOopStubCall.call(oop); + // VerOopStubCall.call(oop); + long oopv = oop.rawValue(); byte markingValue = thread.readByte(HotSpotSnippetUtils.g1SATBQueueMarkingOffset()); @@ -97,6 +98,9 @@ } } } + if (oopv != oop.rawValue()) { + trace(true, "---------------G1 PRE ERROR: %lu\n", Word.unsigned(oopv)); + } trace(WriteBarrierSnippets.TRACE, "---------------G1 PRE Exit: %lu\n", Word.unsigned(g1PreCounter.value())); g1PreCounter.inc(); @@ -111,7 +115,8 @@ Pointer field = Word.fromArray(object, location); Pointer writtenValue = Word.fromObject(value); - VerOopStubCall.call(oop); + // VerOopStubCall.call(oop); + long oopv = oop.rawValue(); Word bufferAddress = thread.readWord(HotSpotSnippetUtils.g1CardQueueBufferOffset()); Word indexAddress = thread.add(HotSpotSnippetUtils.g1CardQueueIndexOffset()); @@ -172,6 +177,9 @@ // } trace(WriteBarrierSnippets.TRACE, "---------------G1 POST EXIT: %lu\n", Word.unsigned(g1PostCounter.value())); g1PostCounter.inc(); + if (oopv != oop.rawValue()) { + trace(true, "---------------G1 POST ERROR: %lu\n", Word.unsigned(oopv)); + } } private static void trace(boolean enabled, String format, WordBase value) { diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java Wed Mar 06 19:35:04 2013 +0100 @@ -96,8 +96,9 @@ * operation was unsuccessful */ static Word refillAllocate(Word intArrayHub, int sizeInBytes, boolean log) { - if (HotSpotGraalRuntime.getInstance().getRuntime().config.useG1GC) + if (useG1GC()) { return Word.zero(); + } Word intArrayMarkWord = Word.unsigned(tlabIntArrayMarkWord()); int alignmentReserveInBytes = tlabAlignmentReserveInHeapWords() * wordSize(); @@ -174,12 +175,6 @@ } } - private static void trace(boolean enabled, String format, WordBase value) { - if (enabled) { - Log.printf(format, value.rawValue()); - } - } - /** * Attempts to allocate a chunk of memory from Eden space. * @@ -188,7 +183,6 @@ * @return the allocated chunk or {@link Word#zero()} if allocation fails */ static Word edenAllocate(Word sizeInBytes, boolean log) { - trace(true, "REFILLTLAB: retaining TLAB 0x%16lu", Word.zero()); Word heapTopAddress = Word.unsigned(heapTopAddress()); Word heapEndAddress = Word.unsigned(heapEndAddress()); diff -r 992f62c457b0 -r 41fc46da946a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Tue Mar 05 18:53:26 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Wed Mar 06 19:35:04 2013 +0100 @@ -84,6 +84,15 @@ if (receiverStamp.nonNull()) { ResolvedJavaType receiverType = receiverStamp.type(); ResolvedJavaField field = receiverType.findInstanceFieldWithOffset(displacement()); + // ResolvedJavaField[] instanceFields = +// tool.runtime().lookupJavaType(java.lang.ref.Reference.class).getInstanceFields(false); + // for (ResolvedJavaField field1 : instanceFields) { + // if (field != null && (field1.getName() == field.getName())) { + // System.out.println("Match field name: " + field.getName()); + // } else if (field != null) { + // System.out.println("Non matching field name: " + field.getName()); + // } + // } if (field != null) { return this.graph().add(new LoadFieldNode(object(), field)); } diff -r 992f62c457b0 -r 41fc46da946a mx/sanitycheck.py --- a/mx/sanitycheck.py Tue Mar 05 18:53:26 2013 +0100 +++ b/mx/sanitycheck.py Wed Mar 06 19:35:04 2013 +0100 @@ -27,6 +27,8 @@ import re, mx, commands, os, sys, StringIO, subprocess from os.path import isfile, join, exists +gc='UseG1GC' + dacapoSanityWarmup = { 'avrora': [0, 0, 3, 6, 13], 'batik': [0, 0, 5, 5, 20], @@ -106,7 +108,7 @@ success = re.compile(r"^Valid run, Score is [0-9]+$", re.MULTILINE) matcher = ValuesMatcher(score, {'group' : 'SPECjbb2005', 'name' : 'score', 'score' : ''}) classpath = ['jbb.jar', 'check.jar'] - return Test("SPECjbb2005", ['spec.jbb.JBBmain', '-propfile', 'SPECjbb.props'] + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+UseSerialGC', '-XX:-UseCompressedOops', '-cp', os.pathsep.join(classpath)], defaultCwd=specjbb2005) + return Test("SPECjbb2005", ['spec.jbb.JBBmain', '-propfile', 'SPECjbb.props'] + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+'+gc, '-XX:-UseCompressedOops', '-cp', os.pathsep.join(classpath)], defaultCwd=specjbb2005) def getSPECjbb2013(benchArgs = []): @@ -119,7 +121,7 @@ success = re.compile(r"org.spec.jbb.controller: Run finished", re.MULTILINE) matcherMax = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'max', 'score' : ''}) matcherCritical = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'critical', 'score' : ''}) - return Test("SPECjbb2013", ['-jar', 'specjbb2013.jar', '-m', 'composite'] + benchArgs, [success], [], [matcherCritical, matcherMax], vmOpts=['-Xms7g', '-XX:+UseSerialGC', '-XX:-UseCompressedOops'], defaultCwd=specjbb2013) + return Test("SPECjbb2013", ['-jar', 'specjbb2013.jar', '-m', 'composite'] + benchArgs, [success], [], [matcherCritical, matcherMax], vmOpts=['-Xms7g', '-XX:+'+gc, '-XX:-UseCompressedOops'], defaultCwd=specjbb2013) def getSPECjvm2008(benchArgs = [], skipCheck=False, skipKitValidation=False, warmupTime=None, iterationTime=None): @@ -143,7 +145,7 @@ if skipCheck: opts += ['-ict'] - return Test("SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + opts + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+UseSerialGC', '-XX:-UseCompressedOops'], defaultCwd=specjvm2008) + return Test("SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + opts + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+'+gc, '-XX:-UseCompressedOops'], defaultCwd=specjvm2008) def getDacapos(level=SanityCheckLevel.Normal, gateBuildLevel=None, dacapoArgs=[]): checks = [] @@ -175,7 +177,7 @@ dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : 'DaCapo', 'name' : '', 'score' : '