# HG changeset patch # User Michael Van De Vanter # Date 1400031078 25200 # Node ID dcaf3993ad175bc2e6b4440886099ddd9fe3c333 # Parent 8de99b84c9cd099721565e3fbe36d2a5a9ca0d6b# Parent 55be15d24e45e5636ee14d657616c6ffac039178 Merge with 55be15d24e45e5636ee14d657616c6ffac039178 diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Tue May 13 18:31:18 2014 -0700 @@ -274,40 +274,9 @@ } private Value emitReinterpretMemory(PlatformKind to, Access access) { - Kind from = getMemoryKind(access); - assert to != from : "should have been eliminated"; - - /* - * Conversions between integer to floating point types require moves between CPU and FPU - * registers. - */ - switch ((Kind) to) { - case Int: - switch (from) { - case Float: - return emitConvert2MemoryOp(to, MOV_F2I, access); - } - break; - case Long: - switch (from) { - case Double: - return emitConvert2MemoryOp(to, MOV_D2L, access); - } - break; - case Float: - switch (from) { - case Int: - return emitConvert2MemoryOp(to, MOV_I2F, access); - } - break; - case Double: - switch (from) { - case Long: - return emitConvert2MemoryOp(to, MOV_L2D, access); - } - break; - } - throw GraalInternalError.shouldNotReachHere(); + AMD64AddressValue address = makeAddress(access); + LIRFrameState state = getState(access); + return getLIRGeneratorTool().emitLoad(to, address, state); } protected AMD64Arithmetic getOp(ValueNode operation, Access access) { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java --- a/graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java Tue May 13 18:31:18 2014 -0700 @@ -139,14 +139,6 @@ } /** - * Determines if the runtime supports {@link StackSlot}s in {@link DebugInfo} associated with - * HSAIL code. - */ - public boolean canHandleDeoptStackSlots() { - return false; - } - - /** * Determines if the runtime has the capabilities required by this test. */ protected boolean supportsRequiredCapabilities() { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/KernelTester.java --- a/graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/KernelTester.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/KernelTester.java Tue May 13 18:31:18 2014 -0700 @@ -34,16 +34,19 @@ import java.util.logging.*; import com.amd.okra.*; +import com.oracle.graal.test.*; /** * Abstract class on which the HSAIL unit tests are built. Executes a method or lambda on both the * Java side and the Okra side and compares the results for fields that are annotated with - * {@link KernelTester.Result}. + * {@link Result}. */ -public abstract class KernelTester { +public abstract class KernelTester extends GraalTest { /** - * Denotes a field whose value is to be compared as part of computing the result of a test. + * Denotes a field whose value is to be + * {@linkplain KernelTester#assertResultFieldsEqual(KernelTester) compared} as part of computing + * the result of a test. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) @@ -129,171 +132,27 @@ public abstract void runTest(); - // Default comparison is to compare all things marked @Result. - public boolean compareResults(KernelTester base) { + /** + * Asserts that the value of all {@link Result} annotated fields in this object and + * {@code other} are {@linkplain #assertDeepEquals(Object, Object) equal}. + * + * @throws AssertionError if the value of a result field in this and {@code other} are not equal + */ + public void assertResultFieldsEqual(KernelTester other) { Class clazz = this.getClass(); while (clazz != null && clazz != KernelTester.class) { for (Field f : clazz.getDeclaredFields()) { if (!Modifier.isStatic(f.getModifiers())) { Result annos = f.getAnnotation(Result.class); if (annos != null) { - logger.fine("@Result field = " + f); - Object myResult = getFieldFromObject(f, this); - Object otherResult = getFieldFromObject(f, base); - boolean same = compareObjects(myResult, otherResult); - logger.fine("comparing " + myResult + ", " + otherResult + ", match=" + same); - if (!same) { - logger.severe("mismatch comparing " + f + ", " + myResult + " vs. " + otherResult); - logSevere("FAILED!!! " + this.getClass()); - return false; - } + Object actualResult = getFieldFromObject(f, this); + Object expectedResult = getFieldFromObject(f, other); + assertDeepEquals(f.toString(), expectedResult, actualResult); } } } clazz = clazz.getSuperclass(); } - logInfo("PASSED: " + this.getClass()); - return true; - } - - private boolean compareObjects(Object first, Object second) { - if (first == null) { - return (second == null); - } - if (second == null) { - return (first == null); - } - Class clazz = first.getClass(); - if (clazz != second.getClass()) { - return false; - } - if (!clazz.isArray()) { - // Non arrays. - if (clazz.equals(float.class) || clazz.equals(double.class)) { - return isEqualsFP((double) first, (double) second); - } else { - return first.equals(second); - } - } else { - // Handle the case where Objects are arrays. - ArrayComparer comparer; - if (clazz.equals(float[].class) || clazz.equals(double[].class)) { - comparer = new FPArrayComparer(); - } else if (clazz.equals(long[].class) || clazz.equals(int[].class) || clazz.equals(byte[].class)) { - comparer = new IntArrayComparer(); - } else if (clazz.equals(boolean[].class)) { - comparer = new BooleanArrayComparer(); - } else { - comparer = new ObjArrayComparer(); - } - return comparer.compareArrays(first, second); - } - } - - static final int MISMATCHLIMIT = 10; - static final int ELEMENTDISPLAYLIMIT = 20; - - public int getMisMatchLimit() { - return MISMATCHLIMIT; - } - - public int getElementDisplayLimit() { - return ELEMENTDISPLAYLIMIT; - } - - abstract class ArrayComparer { - - abstract Object getElement(Object ary, int index); - - // Equality test, can be overridden - boolean isEquals(Object firstElement, Object secondElement) { - return firstElement.equals(secondElement); - } - - boolean compareArrays(Object first, Object second) { - int len = Array.getLength(first); - if (len != Array.getLength(second)) { - return false; - } - // If info logLevel, build string of first few elements from first array. - if (logLevel.intValue() <= Level.INFO.intValue()) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < Math.min(len, getElementDisplayLimit()); i++) { - sb.append(getElement(first, i)); - sb.append(", "); - } - logger.info(sb.toString()); - } - boolean success = true; - int mismatches = 0; - for (int i = 0; i < len; i++) { - Object firstElement = getElement(first, i); - Object secondElement = getElement(second, i); - if (!isEquals(firstElement, secondElement)) { - logSevere("mismatch at index " + i + ", expected " + secondElement + ", saw " + firstElement); - success = false; - mismatches++; - if (mismatches >= getMisMatchLimit()) { - logSevere("...Truncated"); - break; - } - } - } - return success; - } - } - - class FPArrayComparer extends ArrayComparer { - - @Override - Object getElement(Object ary, int index) { - return Array.getDouble(ary, index); - } - - @Override - boolean isEquals(Object firstElement, Object secondElement) { - return isEqualsFP((double) firstElement, (double) secondElement); - } - } - - class IntArrayComparer extends ArrayComparer { - - @Override - Object getElement(Object ary, int index) { - return Array.getLong(ary, index); - } - } - - class BooleanArrayComparer extends ArrayComparer { - - @Override - Object getElement(Object ary, int index) { - return Array.getBoolean(ary, index); - } - } - - class ObjArrayComparer extends ArrayComparer { - - @Override - Object getElement(Object ary, int index) { - return Array.get(ary, index); - } - - @Override - boolean isEquals(Object firstElement, Object secondElement) { - return compareObjects(firstElement, secondElement); - } - } - - /** - * Tests two floating point values for equality. - */ - public boolean isEqualsFP(double first, double second) { - // Special case for checking whether expected and actual values are both NaNs. - if (Double.isNaN(first) && Double.isNaN(second)) { - return true; - } - return first == second; } public void setDispatchMode(DispatchMode dispatchMode) { @@ -761,8 +620,8 @@ } } - private void compareOkraToSeq(HsailMode hsailModeToUse) { - compareOkraToSeq(hsailModeToUse, false); + private void assertOkraEqualsSeq(HsailMode hsailModeToUse) { + assertOkraEqualsSeq(hsailModeToUse, false); } /** @@ -770,7 +629,7 @@ * runOkraFirst flag controls which order they are done in. Note the compiler must use eager * resolving if Okra is done first. */ - private void compareOkraToSeq(HsailMode hsailModeToUse, boolean useLambda) { + private void assertOkraEqualsSeq(HsailMode hsailModeToUse, boolean useLambda) { KernelTester testerSeq; if (runOkraFirst) { runOkraInstance(hsailModeToUse, useLambda); @@ -779,7 +638,7 @@ testerSeq = runSeqInstance(); runOkraInstance(hsailModeToUse, useLambda); } - assertTrue("failed comparison to SEQ", compareResults(testerSeq)); + assertResultFieldsEqual(testerSeq); } private void runOkraInstance(HsailMode hsailModeToUse, boolean useLambda) { @@ -800,19 +659,19 @@ } public void testGeneratedHsail() { - compareOkraToSeq(HsailMode.COMPILED); + assertOkraEqualsSeq(HsailMode.COMPILED); } public void testGeneratedHsailUsingLambdaMethod() { - compareOkraToSeq(HsailMode.COMPILED, true); + assertOkraEqualsSeq(HsailMode.COMPILED, true); } public void testInjectedHsail() { - newInstance().compareOkraToSeq(HsailMode.INJECT_HSAIL); + newInstance().assertOkraEqualsSeq(HsailMode.INJECT_HSAIL); } public void testInjectedOpencl() { - newInstance().compareOkraToSeq(HsailMode.INJECT_OCL); + newInstance().assertOkraEqualsSeq(HsailMode.INJECT_OCL); } protected static Object getFieldFromObject(Field f, Object fromObj) { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/BoundsCatchManyBase.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/BoundsCatchManyBase.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/BoundsCatchManyBase.java Tue May 13 18:31:18 2014 -0700 @@ -33,11 +33,6 @@ return (gid < 4096 && gid % 512 == 1); } - @Override - public int getMisMatchLimit() { - return 1000; - } - public void run(int gid) { int outval = getOutval(gid); try { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/FloatDivPrecisionTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/FloatDivPrecisionTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/FloatDivPrecisionTest.java Tue May 13 18:31:18 2014 -0700 @@ -49,8 +49,8 @@ } @Override - public boolean isEqualsFP(double first, double second) { - return Math.abs(first - second) == 0; + protected double equalFloatsOrDoublesDelta() { + return 0.0D; } @Test diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/ObjSpillDeoptBase.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/ObjSpillDeoptBase.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/ObjSpillDeoptBase.java Tue May 13 18:31:18 2014 -0700 @@ -86,4 +86,8 @@ dispatchMethodKernel(getSize()); } + @Override + protected boolean supportsRequiredCapabilities() { + return canDeoptimize(); + } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticDoubleSpillBoundsCatchOneTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticDoubleSpillBoundsCatchOneTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticDoubleSpillBoundsCatchOneTest.java Tue May 13 18:31:18 2014 -0700 @@ -130,9 +130,13 @@ dispatchMethodKernel(size, out, in, aux); } + @Override + protected boolean supportsRequiredCapabilities() { + return canDeoptimize(); + } + @Test public void test() { testGeneratedHsail(); } - } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticDoubleSpillBoundsCatchTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticDoubleSpillBoundsCatchTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticDoubleSpillBoundsCatchTest.java Tue May 13 18:31:18 2014 -0700 @@ -133,6 +133,11 @@ dispatchMethodKernel(size, out, in, aux); } + @Override + protected boolean supportsRequiredCapabilities() { + return canDeoptimize(); + } + @Test public void test() { testGeneratedHsail(); diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Tue May 13 18:31:18 2014 -0700 @@ -300,7 +300,7 @@ final ValueNode getResult(String snippet) { processMethod(snippet); - assertEquals(1, graph.getNodes(ReturnNode.class).count()); + assertDeepEquals(1, graph.getNodes(ReturnNode.class).count()); return graph.getNodes(ReturnNode.class).first().result(); } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java Tue May 13 18:31:18 2014 -0700 @@ -132,7 +132,7 @@ result = getResult(getCanonicalizedGraph("integerTestCanonicalization2")); assertTrue(result.isConstant() && result.asConstant().asLong() == 1); StructuredGraph graph = getCanonicalizedGraph("integerTestCanonicalization3"); - assertEquals(1, graph.getNodes(ReturnNode.class).count()); + assertDeepEquals(1, graph.getNodes(ReturnNode.class).count()); assertTrue(graph.getNodes(ReturnNode.class).first().result() instanceof ConditionalNode); } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java Tue May 13 18:31:18 2014 -0700 @@ -100,7 +100,7 @@ new ConditionalEliminationPhase(getMetaAccess()).apply(graph, context); canonicalizer.apply(graph, context); - assertEquals(1, graph.getNodes().filter(GuardNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(GuardNode.class).count()); } public static String testInstanceOfCheckCastSnippet(Object e) { @@ -123,7 +123,7 @@ new ConditionalEliminationPhase(getMetaAccess()).apply(graph, context); canonicalizer.apply(graph, context); - assertEquals(0, graph.getNodes().filter(GuardNode.class).count()); + assertDeepEquals(0, graph.getNodes().filter(GuardNode.class).count()); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSenReduTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSenReduTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSenReduTest.java Tue May 13 18:31:18 2014 -0700 @@ -61,7 +61,7 @@ @Test public void redundantCheckCastTest() { - assertEquals(i7, redundantCheckCastSnippet(i7)); + assertDeepEquals(i7, redundantCheckCastSnippet(i7)); StructuredGraph result = afterFlowSensitiveReduce("redundantCheckCastSnippet"); nodeCountEquals(result, CheckCastNode.class, 0); nodeCountEquals(result, InstanceOfNode.class, 1); @@ -79,7 +79,7 @@ @Test public void redundantInstanceOfTest01() { String snippet = "redundantInstanceOfSnippet01"; - assertEquals(true, redundantInstanceOfSnippet01(i7)); + assertDeepEquals(true, redundantInstanceOfSnippet01(i7)); nodeCountEquals(afterFlowSensitiveReduce(snippet), InstanceOfNode.class, 1); } @@ -100,9 +100,9 @@ @Test public void redundantInstanceOfTest02() { String snippet = "redundantInstanceOfSnippet02"; - assertEquals(i7, redundantInstanceOfSnippet02(i7)); + assertDeepEquals(i7, redundantInstanceOfSnippet02(i7)); int ioAfter = getNodes(afterFlowSensitiveReduce(snippet), InstanceOfNode.class).size(); - assertEquals(ioAfter, 1); + assertDeepEquals(ioAfter, 1); } /* @@ -121,18 +121,18 @@ @Test public void devirtualizationTest() { String snippet = "devirtualizationSnippet"; - assertEquals(i7, devirtualizationSnippet(i7, i7)); + assertDeepEquals(i7, devirtualizationSnippet(i7, i7)); nodeCountEquals(afterFlowSensitiveReduce(snippet), CheckCastNode.class, 0); StructuredGraph graph = afterFlowSensitiveReduce(snippet); - assertEquals(0, graph.getNodes().filter(CheckCastNode.class).count()); + assertDeepEquals(0, graph.getNodes().filter(CheckCastNode.class).count()); List invokeNodes = getNodes(afterFlowSensitiveReduce(snippet), InvokeNode.class); - assertEquals(1, invokeNodes.size()); + assertDeepEquals(1, invokeNodes.size()); MethodCallTargetNode target = (MethodCallTargetNode) invokeNodes.get(0).callTarget(); - assertEquals(MethodCallTargetNode.InvokeKind.Special, target.invokeKind()); - assertEquals("HotSpotMethod", target.targetMethod().toString()); + assertDeepEquals(MethodCallTargetNode.InvokeKind.Special, target.invokeKind()); + assertDeepEquals("HotSpotMethod", target.targetMethod().toString()); } /* @@ -154,7 +154,7 @@ @Test public void t5a() { String snippet = "t5Snippet"; - assertEquals(false, t5Snippet(null, true)); + assertDeepEquals(false, t5Snippet(null, true)); StructuredGraph resultGraph = canonicalize(afterFlowSensitiveReduce(snippet)); nodeCountEquals(resultGraph, ReturnNode.class, 2); @@ -164,8 +164,8 @@ ConstantNode c1 = (ConstantNode) iter.next().result(); ConstantNode c2 = (ConstantNode) iter.next().result(); - assertEquals(c1, c2); - assertEquals(0, c1.getValue().asInt()); + assertDeepEquals(c1, c2); + assertDeepEquals(0, c1.getValue().asInt()); } @Test @@ -215,16 +215,16 @@ StructuredGraph graph = afterFlowSensitiveReduce(snippet); graph = dce(canonicalize(graph)); // TODO how to simplify IfNode(false) - assertEquals(1, getNodes(graph, InstanceOfNode.class).size()); + assertDeepEquals(1, getNodes(graph, InstanceOfNode.class).size()); List returnNodes = getNodes(graph, ReturnNode.class); - assertEquals(2, returnNodes.size()); + assertDeepEquals(2, returnNodes.size()); Iterator iter = returnNodes.iterator(); ConstantNode c1 = (ConstantNode) iter.next().result(); ConstantNode c2 = (ConstantNode) iter.next().result(); - assertEquals(c1, c2); + assertDeepEquals(c1, c2); Assert.assertTrue(c1.getValue().isNull()); } @@ -253,14 +253,14 @@ String snippet = "devirtualizationSnippet02"; StructuredGraph graph = afterFlowSensitiveReduce(snippet); - assertEquals(1, getNodes(graph, InvokeNode.class).size()); + assertDeepEquals(1, getNodes(graph, InvokeNode.class).size()); List invokeNodes = getNodes(graph, InvokeNode.class); - assertEquals(1, invokeNodes.size()); + assertDeepEquals(1, invokeNodes.size()); MethodCallTargetNode target = (MethodCallTargetNode) invokeNodes.get(0).callTarget(); - assertEquals(MethodCallTargetNode.InvokeKind.Special, target.invokeKind()); - assertEquals("HotSpotMethod", target.targetMethod().toString()); + assertDeepEquals(MethodCallTargetNode.InvokeKind.Special, target.invokeKind()); + assertDeepEquals("HotSpotMethod", target.targetMethod().toString()); } /* @@ -312,7 +312,7 @@ dce(graph); List returnNodes = getNodes(graph, ReturnNode.class); - assertEquals(2, returnNodes.size()); + assertDeepEquals(2, returnNodes.size()); Iterator iter = returnNodes.iterator(); ValueNode c1 = GraphUtil.unproxify(iter.next().result()); @@ -339,7 +339,7 @@ String snippet = "deduplicateInstanceOfSnippet"; StructuredGraph graph = afterFlowSensitiveReduce(snippet); List ioNodes = getNodes(graph, InstanceOfNode.class); - assertEquals(1, ioNodes.size()); + assertDeepEquals(1, ioNodes.size()); } @@ -371,7 +371,7 @@ } public void nodeCountEquals(StructuredGraph graph, Class nodeClass, int expected) { - assertEquals(expected, getNodes(graph, nodeClass).size()); + assertDeepEquals(expected, getNodes(graph, nodeClass).size()); } public StructuredGraph afterFlowSensitiveReduce(String snippet) { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSensitiveReductionTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSensitiveReductionTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSensitiveReductionTest.java Tue May 13 18:31:18 2014 -0700 @@ -209,7 +209,7 @@ new FlowSensitiveReductionPhase(getMetaAccess()).apply(graph, context); InvokeNode invoke = graph.getNodes().filter(InvokeNode.class).first(); - assertEquals(InvokeKind.Special, ((MethodCallTargetNode) invoke.callTarget()).invokeKind()); + assertDeepEquals(InvokeKind.Special, ((MethodCallTargetNode) invoke.callTarget()).invokeKind()); } public static void testTypeMergingSnippet(Object o, boolean b) { @@ -240,7 +240,7 @@ new FlowSensitiveReductionPhase(getMetaAccess()).apply(graph, context); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders(), null)); - assertEquals(0, graph.getNodes().filter(StoreFieldNode.class).count()); + assertDeepEquals(0, graph.getNodes().filter(StoreFieldNode.class).count()); } public static String testInstanceOfCheckCastSnippet(Object e) { @@ -258,7 +258,7 @@ new FlowSensitiveReductionPhase(getMetaAccess()).apply(graph, context); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders(), null)); - assertEquals(0, graph.getNodes().filter(CheckCastNode.class).count()); + assertDeepEquals(0, graph.getNodes().filter(CheckCastNode.class).count()); } public static int testDuplicateNullChecksSnippet(Object a) { @@ -287,7 +287,7 @@ new FlowSensitiveReductionPhase(getMetaAccess()).apply(graph, context); canonicalizer.apply(graph, context); - assertEquals(1, graph.getNodes().filter(GuardNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(GuardNode.class).count()); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Tue May 13 18:31:18 2014 -0700 @@ -27,7 +27,6 @@ import static com.oracle.graal.compiler.common.GraalOptions.*; import static com.oracle.graal.nodes.ConstantNode.*; -import java.io.*; import java.lang.reflect.*; import java.util.*; import java.util.concurrent.atomic.*; @@ -277,76 +276,6 @@ private static AtomicInteger compilationId = new AtomicInteger(); - /** - * Compares two given objects for {@linkplain Assert#assertEquals(Object, Object) equality}. - * Does a deep copy equality comparison if {@code expected} is an array. - */ - protected void assertEquals(Object expected, Object actual) { - if (expected != null && expected.getClass().isArray()) { - Assert.assertTrue(expected != null); - Assert.assertTrue(actual != null); - Assert.assertEquals(expected.getClass(), actual.getClass()); - if (expected instanceof int[]) { - Assert.assertArrayEquals((int[]) expected, (int[]) actual); - } else if (expected instanceof byte[]) { - Assert.assertArrayEquals((byte[]) expected, (byte[]) actual); - } else if (expected instanceof char[]) { - Assert.assertArrayEquals((char[]) expected, (char[]) actual); - } else if (expected instanceof short[]) { - Assert.assertArrayEquals((short[]) expected, (short[]) actual); - } else if (expected instanceof float[]) { - Assert.assertArrayEquals((float[]) expected, (float[]) actual, 0.0f); - } else if (expected instanceof long[]) { - Assert.assertArrayEquals((long[]) expected, (long[]) actual); - } else if (expected instanceof double[]) { - Assert.assertArrayEquals((double[]) expected, (double[]) actual, 0.0d); - } else if (expected instanceof boolean[]) { - new ExactComparisonCriteria().arrayEquals(null, expected, actual); - } else if (expected instanceof Object[]) { - Assert.assertArrayEquals((Object[]) expected, (Object[]) actual); - } else { - Assert.fail("non-array value encountered: " + expected); - } - } else { - Assert.assertEquals(expected, actual); - } - } - - @SuppressWarnings("serial") - public static class MultiCauseAssertionError extends AssertionError { - - private Throwable[] causes; - - public MultiCauseAssertionError(String message, Throwable... causes) { - super(message); - this.causes = causes; - } - - @Override - public void printStackTrace(PrintStream out) { - super.printStackTrace(out); - int num = 0; - for (Throwable cause : causes) { - if (cause != null) { - out.print("cause " + (num++)); - cause.printStackTrace(out); - } - } - } - - @Override - public void printStackTrace(PrintWriter out) { - super.printStackTrace(out); - int num = 0; - for (Throwable cause : causes) { - if (cause != null) { - out.print("cause " + (num++) + ": "); - cause.printStackTrace(out); - } - } - } - } - protected void testN(int n, final String name, final Object... args) { final List errors = new ArrayList<>(n); Thread[] threads = new Thread[n]; @@ -599,7 +528,7 @@ actual.exception.printStackTrace(); Assert.fail("expected " + expect.returnValue + " but got an exception"); } - assertEquals(expect.returnValue, actual.returnValue); + assertDeepEquals(expect.returnValue, actual.returnValue); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Tue May 13 18:31:18 2014 -0700 @@ -66,7 +66,7 @@ for (Infopoint sp : cr.getInfopoints()) { assertNotNull(sp.reason); if (sp instanceof Call) { - assertEquals(InfopointReason.CALL, sp.reason); + assertDeepEquals(InfopointReason.CALL, sp.reason); } } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Tue May 13 18:31:18 2014 -0700 @@ -65,8 +65,8 @@ StructuredGraph graph = getGraph("testSynchronizedSnippet"); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders(), null)); new LockEliminationPhase().apply(graph); - assertEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count()); - assertEquals(1, graph.getNodes().filter(MonitorExitNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count()); } public static void testSynchronizedMethodSnippet(A x) { @@ -83,8 +83,8 @@ StructuredGraph graph = getGraph("testSynchronizedMethodSnippet"); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders(), null)); new LockEliminationPhase().apply(graph); - assertEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count()); - assertEquals(1, graph.getNodes().filter(MonitorExitNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count()); } private StructuredGraph getGraph(String snippet) { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Tue May 13 18:31:18 2014 -0700 @@ -164,7 +164,7 @@ @Test public void testLoop1() { SchedulePhase schedule = getFinalSchedule("testLoop1Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(6, schedule.getCFG().getBlocks().size()); + assertDeepEquals(6, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, true); assertReadWithinAllReturnBlocks(schedule, false); } @@ -189,7 +189,7 @@ @Test public void testLoop2() { SchedulePhase schedule = getFinalSchedule("testLoop2Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(6, schedule.getCFG().getBlocks().size()); + assertDeepEquals(6, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, false); assertReadWithinAllReturnBlocks(schedule, true); } @@ -211,7 +211,7 @@ @Test public void testLoop3() { SchedulePhase schedule = getFinalSchedule("testLoop3Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(6, schedule.getCFG().getBlocks().size()); + assertDeepEquals(6, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, true); assertReadWithinAllReturnBlocks(schedule, false); } @@ -247,7 +247,7 @@ @Test public void testLoop5() { SchedulePhase schedule = getFinalSchedule("testLoop5Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(10, schedule.getCFG().getBlocks().size()); + assertDeepEquals(10, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, false); assertReadWithinAllReturnBlocks(schedule, false); } @@ -264,10 +264,10 @@ public void testArrayCopy() { SchedulePhase schedule = getFinalSchedule("testArrayCopySnippet", TestMode.INLINED_WITHOUT_FRAMESTATES); StructuredGraph graph = schedule.getCFG().getStartBlock().getBeginNode().graph(); - assertEquals(1, graph.getNodes(ReturnNode.class).count()); + assertDeepEquals(1, graph.getNodes(ReturnNode.class).count()); ReturnNode ret = graph.getNodes(ReturnNode.class).first(); assertTrue(ret.result() + " should be a FloatingReadNode", ret.result() instanceof FloatingReadNode); - assertEquals(schedule.getCFG().blockFor(ret), schedule.getCFG().blockFor(ret.result())); + assertDeepEquals(schedule.getCFG().blockFor(ret), schedule.getCFG().blockFor(ret.result())); assertReadWithinAllReturnBlocks(schedule, true); } @@ -285,7 +285,7 @@ @Test public void testIfRead1() { SchedulePhase schedule = getFinalSchedule("testIfRead1Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(3, schedule.getCFG().getBlocks().size()); + assertDeepEquals(3, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, true); assertReadAndWriteInSameBlock(schedule, false); } @@ -306,8 +306,8 @@ @Test public void testIfRead2() { SchedulePhase schedule = getFinalSchedule("testIfRead2Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(3, schedule.getCFG().getBlocks().size()); - assertEquals(1, schedule.getCFG().graph.getNodes().filter(FloatingReadNode.class).count()); + assertDeepEquals(3, schedule.getCFG().getBlocks().size()); + assertDeepEquals(1, schedule.getCFG().graph.getNodes().filter(FloatingReadNode.class).count()); assertReadWithinStartBlock(schedule, false); assertReadWithinAllReturnBlocks(schedule, false); assertReadAndWriteInSameBlock(schedule, false); @@ -328,7 +328,7 @@ @Test public void testIfRead3() { SchedulePhase schedule = getFinalSchedule("testIfRead3Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(4, schedule.getCFG().getBlocks().size()); + assertDeepEquals(4, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, false); assertReadWithinAllReturnBlocks(schedule, true); } @@ -349,7 +349,7 @@ @Test public void testIfRead4() { SchedulePhase schedule = getFinalSchedule("testIfRead4Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(3, schedule.getCFG().getBlocks().size()); + assertDeepEquals(3, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, false); assertReadWithinAllReturnBlocks(schedule, false); assertReadAndWriteInSameBlock(schedule, true); @@ -368,7 +368,7 @@ @Test public void testIfRead5() { SchedulePhase schedule = getFinalSchedule("testIfRead5Snippet", TestMode.WITHOUT_FRAMESTATES); - assertEquals(4, schedule.getCFG().getBlocks().size()); + assertDeepEquals(4, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, false); assertReadWithinAllReturnBlocks(schedule, true); assertReadAndWriteInSameBlock(schedule, false); @@ -397,9 +397,9 @@ StructuredGraph graph = schedule.getCFG().graph; NodeIterable writeNodes = graph.getNodes().filter(WriteNode.class); - assertEquals(1, schedule.getCFG().getBlocks().size()); - assertEquals(8, writeNodes.count()); - assertEquals(1, graph.getNodes().filter(FloatingReadNode.class).count()); + assertDeepEquals(1, schedule.getCFG().getBlocks().size()); + assertDeepEquals(8, writeNodes.count()); + assertDeepEquals(1, graph.getNodes().filter(FloatingReadNode.class).count()); FloatingReadNode read = graph.getNodes().filter(FloatingReadNode.class).first(); @@ -554,7 +554,7 @@ } returnBlocks++; } - assertEquals(withRead == returnBlocks, withinReturnBlock); + assertDeepEquals(withRead == returnBlocks, withinReturnBlock); } private void assertReadWithinStartBlock(SchedulePhase schedule, boolean withinStartBlock) { @@ -564,7 +564,7 @@ readEncountered = true; } } - assertEquals(withinStartBlock, readEncountered); + assertDeepEquals(withinStartBlock, readEncountered); } private static void assertReadAndWriteInSameBlock(SchedulePhase schedule, boolean inSame) { @@ -617,7 +617,7 @@ SchedulePhase schedule = new SchedulePhase(schedulingStrategy, memsched); schedule.apply(graph); - assertEquals(1, graph.getNodes().filter(StartNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(StartNode.class).count()); return schedule; } } catch (Throwable e) { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MergeCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MergeCanonicalizerTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MergeCanonicalizerTest.java Tue May 13 18:31:18 2014 -0700 @@ -61,6 +61,6 @@ new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders(), new Assumptions(false))); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders(), new Assumptions(false))); Debug.dump(graph, "Graph"); - assertEquals(returnCount, graph.getNodes(ReturnNode.class).count()); + assertDeepEquals(returnCount, graph.getNodes(ReturnNode.class).count()); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java Tue May 13 18:31:18 2014 -0700 @@ -65,24 +65,24 @@ List blocks = cfg.getBlocks(); // check number of blocks - assertEquals(4, blocks.size()); + assertDeepEquals(4, blocks.size()); // check block - node assignment - assertEquals(blocks.get(0), cfg.blockFor(graph.start())); - assertEquals(blocks.get(0), cfg.blockFor(ifNode)); - assertEquals(blocks.get(1), cfg.blockFor(trueBegin)); - assertEquals(blocks.get(1), cfg.blockFor(trueEnd)); - assertEquals(blocks.get(2), cfg.blockFor(falseBegin)); - assertEquals(blocks.get(2), cfg.blockFor(falseEnd)); - assertEquals(blocks.get(3), cfg.blockFor(merge)); - assertEquals(blocks.get(3), cfg.blockFor(returnNode)); + assertDeepEquals(blocks.get(0), cfg.blockFor(graph.start())); + assertDeepEquals(blocks.get(0), cfg.blockFor(ifNode)); + assertDeepEquals(blocks.get(1), cfg.blockFor(trueBegin)); + assertDeepEquals(blocks.get(1), cfg.blockFor(trueEnd)); + assertDeepEquals(blocks.get(2), cfg.blockFor(falseBegin)); + assertDeepEquals(blocks.get(2), cfg.blockFor(falseEnd)); + assertDeepEquals(blocks.get(3), cfg.blockFor(merge)); + assertDeepEquals(blocks.get(3), cfg.blockFor(returnNode)); // check postOrder Iterator it = cfg.postOrder().iterator(); for (int i = blocks.size() - 1; i >= 0; i--) { assertTrue(it.hasNext()); Block b = it.next(); - assertEquals(blocks.get(i), b); + assertDeepEquals(blocks.get(i), b); } // check dominators diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EAMergingTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EAMergingTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EAMergingTest.java Tue May 13 18:31:18 2014 -0700 @@ -33,7 +33,7 @@ @Test public void testSimpleMerge() { testEscapeAnalysis("simpleMergeSnippet", null, false); - assertEquals(1, returnNodes.size()); + assertDeepEquals(1, returnNodes.size()); assertTrue(returnNodes.get(0).result() instanceof ValuePhiNode); PhiNode phi = (PhiNode) returnNodes.get(0).result(); assertTrue(phi.valueAt(0) instanceof ParameterNode); diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Tue May 13 18:31:18 2014 -0700 @@ -74,12 +74,12 @@ public void testSimple() { ValueNode result = getReturn("testSimpleSnippet").result(); assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); - assertEquals(graph.getParameter(0), result); + assertDeepEquals(graph.getParameter(0), result); } final ReturnNode getReturn(String snippet) { processMethod(snippet); - assertEquals(1, graph.getNodes(ReturnNode.class).count()); + assertDeepEquals(1, graph.getNodes(ReturnNode.class).count()); return graph.getNodes(ReturnNode.class).first(); } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Tue May 13 18:31:18 2014 -0700 @@ -87,7 +87,7 @@ ValueNode result = getReturn("testSimpleSnippet").result(); assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); assertTrue(result.isConstant()); - assertEquals(2, result.asConstant().asInt()); + assertDeepEquals(2, result.asConstant().asInt()); } @SuppressWarnings("all") @@ -115,7 +115,7 @@ public void testParam() { ValueNode result = getReturn("testParamSnippet").result(); assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); - assertEquals(graph.getParameter(1), result); + assertDeepEquals(graph.getParameter(1), result); } @SuppressWarnings("all") @@ -129,7 +129,7 @@ public void testMaterialized() { ValueNode result = getReturn("testMaterializedSnippet").result(); assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); - assertEquals(graph.getParameter(0), result); + assertDeepEquals(graph.getParameter(0), result); } @SuppressWarnings("all") @@ -145,7 +145,7 @@ public void testSimpleLoop() { ValueNode result = getReturn("testSimpleLoopSnippet").result(); assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); - assertEquals(graph.getParameter(1), result); + assertDeepEquals(graph.getParameter(1), result); } @SuppressWarnings("all") @@ -162,7 +162,7 @@ @Test public void testBadLoop() { ValueNode result = getReturn("testBadLoopSnippet").result(); - assertEquals(0, graph.getNodes().filter(LoadFieldNode.class).count()); + assertDeepEquals(0, graph.getNodes().filter(LoadFieldNode.class).count()); assertTrue(result instanceof ProxyNode); assertTrue(((ProxyNode) result).value() instanceof ValuePhiNode); } @@ -180,7 +180,7 @@ @Test public void testBadLoop2() { ValueNode result = getReturn("testBadLoop2Snippet").result(); - assertEquals(1, graph.getNodes().filter(LoadFieldNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(LoadFieldNode.class).count()); assertTrue(result instanceof LoadFieldNode); } @@ -199,7 +199,7 @@ processMethod("testPhiSnippet"); assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); List returnNodes = graph.getNodes(ReturnNode.class).snapshot(); - assertEquals(2, returnNodes.size()); + assertDeepEquals(2, returnNodes.size()); assertTrue(returnNodes.get(0).predecessor() instanceof StoreFieldNode); assertTrue(returnNodes.get(1).predecessor() instanceof StoreFieldNode); assertTrue(returnNodes.get(0).result().isConstant()); @@ -215,7 +215,7 @@ @Test public void testSimpleStore() { processMethod("testSimpleStoreSnippet"); - assertEquals(1, graph.getNodes().filter(StoreFieldNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(StoreFieldNode.class).count()); } public static int testValueProxySnippet(boolean b, TestObject o) { @@ -233,12 +233,12 @@ @Test public void testValueProxy() { processMethod("testValueProxySnippet"); - assertEquals(2, graph.getNodes().filter(LoadFieldNode.class).count()); + assertDeepEquals(2, graph.getNodes().filter(LoadFieldNode.class).count()); } final ReturnNode getReturn(String snippet) { processMethod(snippet); - assertEquals(1, graph.getNodes(ReturnNode.class).count()); + assertDeepEquals(1, graph.getNodes(ReturnNode.class).count()); return graph.getNodes(ReturnNode.class).first(); } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java Tue May 13 18:31:18 2014 -0700 @@ -171,7 +171,7 @@ @Test public void testReference1() { prepareGraph("testReference1Snippet", false); - assertEquals(1, graph.getNodes().filter(NewInstanceNode.class).count()); + assertDeepEquals(1, graph.getNodes().filter(NewInstanceNode.class).count()); } @SafeVarargs diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Tue May 13 18:31:18 2014 -0700 @@ -374,11 +374,16 @@ throw new GraalInternalError("Cannot execute GPU kernel if device is not initialized"); } int[] oopMapArray = ((HSAILHotSpotNmethod) kernel).getOopMapArray(); - int saveAreaCounts = OopMapArrayBuilder.getSaveAreaCounts(oopMapArray); - int numDRegs = (saveAreaCounts >> 8) & 0xff; - int numStackSlots = (saveAreaCounts >> 16); - // pessimistically assume that any of the DRegs or stackslots could be oops - Object[] oopsSaveArea = new Object[maxDeoptIndex * (numDRegs + numStackSlots)]; + Object[] oopsSaveArea; + if (getRuntime().getConfig().useHSAILDeoptimization) { + int saveAreaCounts = OopMapArrayBuilder.getSaveAreaCounts(oopMapArray); + int numDRegs = (saveAreaCounts >> 8) & 0xff; + int numStackSlots = (saveAreaCounts >> 16); + // pessimistically assume that any of the DRegs or stackslots could be oops + oopsSaveArea = new Object[maxDeoptIndex * (numDRegs + numStackSlots)]; + } else { + oopsSaveArea = null; + } return executeKernel0(kernel, jobSize, args, oopsSaveArea, donorThreadPool.get().getThreads(), HsailAllocBytesPerWorkitem.getValue(), oopMapArray); } @@ -765,7 +770,7 @@ // numStackSlots is the number of 8-byte locations used for stack variables int numStackSlots = (numStackSlotBytes + 7) / 8; - final int offsetToDeoptSaveStates = config.hsailSaveStatesOffset0; + final int offsetToDeoptSaveStates = config.hsailDeoptimizationInfoHeaderSize; final int bytesPerSaveArea = 4 * numSRegs + 8 * numDRegs + 8 * numStackSlots; final int sizeofKernelDeopt = config.hsailKernelDeoptimizationHeaderSize + config.hsailFrameHeaderSize + bytesPerSaveArea; final int offsetToNeverRanArray = config.hsailNeverRanArrayOffset; @@ -854,7 +859,7 @@ asm.emitComment("// store PC"); asm.emitStore(Kind.Int, codeBufferOffsetReg, pcStoreAddr); - asm.emitComment("// store regCounts (" + numSRegs + " $s registers and " + numDRegs + " $d registers" + numStackSlots + " stack slots)"); + asm.emitComment("// store regCounts (" + numSRegs + " $s registers, " + numDRegs + " $d registers, " + numStackSlots + " stack slots)"); asm.emitStore(Kind.Int, Constant.forInt(numSRegs + (numDRegs << 8) + (numStackSlots << 16)), regCountsAddr); // loop thru the usedValues storing each of the registers that are used. diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Tue May 13 18:31:18 2014 -0700 @@ -66,19 +66,19 @@ @Test public void testStaticFinalObjectAOT() { StructuredGraph result = compile("getStaticFinalObject", true); - assertEquals(1, getConstantNodes(result).count()); - assertEquals(getCodeCache().getTarget().wordKind, getConstantNodes(result).first().getKind()); - assertEquals(2, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes().filter(ReadNode.class).count()); + assertDeepEquals(1, getConstantNodes(result).count()); + assertDeepEquals(getCodeCache().getTarget().wordKind, getConstantNodes(result).first().getKind()); + assertDeepEquals(2, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count()); } @Test public void testStaticFinalObject() { StructuredGraph result = compile("getStaticFinalObject", false); - assertEquals(1, getConstantNodes(result).count()); - assertEquals(Kind.Object, getConstantNodes(result).first().getKind()); - assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes().filter(ReadNode.class).count()); + assertDeepEquals(1, getConstantNodes(result).count()); + assertDeepEquals(Kind.Object, getConstantNodes(result).first().getKind()); + assertDeepEquals(0, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count()); } public static Class getClassObject() { @@ -90,12 +90,12 @@ StructuredGraph result = compile("getClassObject", true); NodeIterable filter = getConstantNodes(result); - assertEquals(1, filter.count()); + assertDeepEquals(1, filter.count()); HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) getMetaAccess().lookupJavaType(AheadOfTimeCompilationTest.class); - assertEquals(type.klass(), filter.first().asConstant()); + assertDeepEquals(type.klass(), filter.first().asConstant()); - assertEquals(1, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes().filter(ReadNode.class).count()); + assertDeepEquals(1, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count()); } @Test @@ -103,13 +103,13 @@ StructuredGraph result = compile("getClassObject", false); NodeIterable filter = getConstantNodes(result); - assertEquals(1, filter.count()); + assertDeepEquals(1, filter.count()); Object mirror = HotSpotObjectConstant.asObject(filter.first().asConstant()); - assertEquals(Class.class, mirror.getClass()); - assertEquals(AheadOfTimeCompilationTest.class, mirror); + assertDeepEquals(Class.class, mirror.getClass()); + assertDeepEquals(AheadOfTimeCompilationTest.class, mirror); - assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes().filter(ReadNode.class).count()); + assertDeepEquals(0, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count()); } public static Class getPrimitiveClassObject() { @@ -120,24 +120,24 @@ public void testPrimitiveClassObjectAOT() { StructuredGraph result = compile("getPrimitiveClassObject", true); NodeIterable filter = getConstantNodes(result); - assertEquals(1, filter.count()); - assertEquals(getCodeCache().getTarget().wordKind, filter.first().getKind()); + assertDeepEquals(1, filter.count()); + assertDeepEquals(getCodeCache().getTarget().wordKind, filter.first().getKind()); - assertEquals(2, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes().filter(ReadNode.class).count()); + assertDeepEquals(2, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count()); } @Test public void testPrimitiveClassObject() { StructuredGraph result = compile("getPrimitiveClassObject", false); NodeIterable filter = getConstantNodes(result); - assertEquals(1, filter.count()); + assertDeepEquals(1, filter.count()); Object mirror = HotSpotObjectConstant.asObject(filter.first().asConstant()); - assertEquals(Class.class, mirror.getClass()); - assertEquals(Integer.TYPE, mirror); + assertDeepEquals(Class.class, mirror.getClass()); + assertDeepEquals(Integer.TYPE, mirror); - assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes().filter(ReadNode.class).count()); + assertDeepEquals(0, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count()); } public static String getStringObject() { @@ -159,13 +159,13 @@ StructuredGraph result = compile("getStringObject", compileAOT); NodeIterable filter = getConstantNodes(result); - assertEquals(1, filter.count()); + assertDeepEquals(1, filter.count()); Object mirror = HotSpotObjectConstant.asObject(filter.first().asConstant()); - assertEquals(String.class, mirror.getClass()); - assertEquals("test string", mirror); + assertDeepEquals(String.class, mirror.getClass()); + assertDeepEquals("test string", mirror); - assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes().filter(ReadNode.class).count()); + assertDeepEquals(0, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(0, result.getNodes().filter(ReadNode.class).count()); } public static Boolean getBoxedBoolean() { @@ -177,23 +177,23 @@ public void testBoxedBooleanAOT() { StructuredGraph result = compile("getBoxedBoolean", true); - assertEquals(2, result.getNodes(FloatingReadNode.class).count()); - assertEquals(1, result.getNodes(PiNode.class).count()); - assertEquals(1, getConstantNodes(result).count()); + assertDeepEquals(2, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(1, result.getNodes(PiNode.class).count()); + assertDeepEquals(1, getConstantNodes(result).count()); ConstantNode constant = getConstantNodes(result).first(); - assertEquals(Kind.Long, constant.getKind()); - assertEquals(((HotSpotResolvedObjectType) getMetaAccess().lookupJavaType(Boolean.class)).klass(), constant.asConstant()); + assertDeepEquals(Kind.Long, constant.getKind()); + assertDeepEquals(((HotSpotResolvedObjectType) getMetaAccess().lookupJavaType(Boolean.class)).klass(), constant.asConstant()); } @Test public void testBoxedBoolean() { StructuredGraph result = compile("getBoxedBoolean", false); - assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes(PiNode.class).count()); - assertEquals(1, getConstantNodes(result).count()); + assertDeepEquals(0, result.getNodes(FloatingReadNode.class).count()); + assertDeepEquals(0, result.getNodes(PiNode.class).count()); + assertDeepEquals(1, getConstantNodes(result).count()); ConstantNode constant = getConstantNodes(result).first(); - assertEquals(Kind.Object, constant.getKind()); - assertEquals(Boolean.TRUE, HotSpotObjectConstant.asObject(constant.asConstant())); + assertDeepEquals(Kind.Object, constant.getKind()); + assertDeepEquals(Boolean.TRUE, HotSpotObjectConstant.asObject(constant.asConstant())); } private StructuredGraph compile(String test, boolean compileAOT) { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ExplicitExceptionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ExplicitExceptionTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ExplicitExceptionTest.java Tue May 13 18:31:18 2014 -0700 @@ -37,7 +37,7 @@ @Override protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph graph) { InstalledCode installedCode = super.getCode(method, graph); - assertEquals(expectedForeignCallCount, graph.getNodes().filter(ForeignCallNode.class).count()); + assertDeepEquals(expectedForeignCallCount, graph.getNodes().filter(ForeignCallNode.class).count()); return installedCode; } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMethodSubstitutionTest.java Tue May 13 18:31:18 2014 -0700 @@ -45,8 +45,8 @@ Object obj = new Object(); - assertEquals("a string".getClass(), ObjectSubstitutions.getClass("a string")); - assertEquals(obj.hashCode(), ObjectSubstitutions.hashCode(obj)); + assertDeepEquals("a string".getClass(), ObjectSubstitutions.getClass("a string")); + assertDeepEquals(obj.hashCode(), ObjectSubstitutions.hashCode(obj)); } @SuppressWarnings("all") @@ -75,14 +75,14 @@ test("getComponentType"); for (Class c : new Class[]{getClass(), Cloneable.class, int[].class, String[][].class}) { - assertEquals(c.getModifiers(), ClassSubstitutions.getModifiers(c)); - assertEquals(c.isInterface(), ClassSubstitutions.isInterface(c)); - assertEquals(c.isArray(), ClassSubstitutions.isArray(c)); - assertEquals(c.isPrimitive(), ClassSubstitutions.isPrimitive(c)); - assertEquals(c.getSuperclass(), ClassSubstitutions.getSuperclass(c)); - assertEquals(c.getComponentType(), ClassSubstitutions.getComponentType(c)); + assertDeepEquals(c.getModifiers(), ClassSubstitutions.getModifiers(c)); + assertDeepEquals(c.isInterface(), ClassSubstitutions.isInterface(c)); + assertDeepEquals(c.isArray(), ClassSubstitutions.isArray(c)); + assertDeepEquals(c.isPrimitive(), ClassSubstitutions.isPrimitive(c)); + assertDeepEquals(c.getSuperclass(), ClassSubstitutions.getSuperclass(c)); + assertDeepEquals(c.getComponentType(), ClassSubstitutions.getComponentType(c)); for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) { - assertEquals(c.isInstance(o), ClassSubstitutions.isInstance(c, o)); + assertDeepEquals(c.isInstance(o), ClassSubstitutions.isInstance(c, o)); } } } @@ -134,8 +134,8 @@ test("threadInterrupted"); Thread currentThread = Thread.currentThread(); - assertEquals(currentThread, ThreadSubstitutions.currentThread()); - assertEquals(currentThread.isInterrupted(), ThreadSubstitutions.isInterrupted(currentThread, false)); + assertDeepEquals(currentThread, ThreadSubstitutions.currentThread()); + assertDeepEquals(currentThread.isInterrupted(), ThreadSubstitutions.isInterrupted(currentThread, false)); } @SuppressWarnings("all") @@ -161,7 +161,7 @@ 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)); + assertDeepEquals(System.identityHashCode(o), SystemSubstitutions.identityHashCode(o)); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMonitorValueTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMonitorValueTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMonitorValueTest.java Tue May 13 18:31:18 2014 -0700 @@ -51,8 +51,8 @@ BytecodeFrame caller = frame.caller(); assertNotNull(caller); assertNull(caller.caller()); - assertEquals(2, frame.numLocks); - assertEquals(2, caller.numLocks); + assertDeepEquals(2, frame.numLocks); + assertDeepEquals(2, caller.numLocks); HotSpotMonitorValue lock1 = (HotSpotMonitorValue) frame.getLockValue(0); HotSpotMonitorValue lock2 = (HotSpotMonitorValue) frame.getLockValue(1); HotSpotMonitorValue lock3 = (HotSpotMonitorValue) caller.getLockValue(0); @@ -67,7 +67,7 @@ } } } - assertEquals(lock3.getOwner(), lock4.getOwner()); + assertDeepEquals(lock3.getOwner(), lock4.getOwner()); assertThat(lock1.getOwner(), not(lock2.getOwner())); return super.addMethod(method, compResult); } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java Tue May 13 18:31:18 2014 -0700 @@ -43,7 +43,7 @@ Object result; try { result = nmethod.executeVarargs(null, "b", "c"); - assertEquals(43, result); + assertDeepEquals(43, result); } catch (InvalidInstalledCodeException e) { Assert.fail("Code was invalidated"); } @@ -66,7 +66,7 @@ Object result; try { result = nmethod.executeVarargs(nmethod, null, null); - assertEquals(43, result); + assertDeepEquals(43, result); } catch (InvalidInstalledCodeException e) { Assert.fail("Code was invalidated"); } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Tue May 13 18:31:18 2014 -0700 @@ -1033,9 +1033,9 @@ @HotSpotVMField(name = "HSAILFrame::_pc_offset", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailFramePcOffset; @HotSpotVMField(name = "HSAILFrame::_num_s_regs", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailFrameNumSRegOffset; @HotSpotVMField(name = "HSAILFrame::_num_d_regs", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailFrameNumDRegOffset; - @HotSpotVMConstant(name = "sizeof(HSAILFrame)") @Stable public int hsailFrameHeaderSize; - @HotSpotVMConstant(name = "sizeof(Hsail::HSAILKernelDeoptimization)") @Stable public int hsailKernelDeoptimizationHeaderSize; - @HotSpotVMField(name = "Hsail::HSAILDeoptimizationInfo::_deopt_save_states[0]", type = "Hsail::HSAILKernelDeoptimization", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailSaveStatesOffset0; + @HotSpotVMType(name = "HSAILFrame", get = HotSpotVMType.Type.SIZE) @Stable public int hsailFrameHeaderSize; + @HotSpotVMType(name = "Hsail::HSAILKernelDeoptimization", get = HotSpotVMType.Type.SIZE) @Stable public int hsailKernelDeoptimizationHeaderSize; + @HotSpotVMType(name = "Hsail::HSAILDeoptimizationInfo", get = HotSpotVMType.Type.SIZE) @Stable public int hsailDeoptimizationInfoHeaderSize; /** * Mark word right shift to get identity hash code. diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConstant.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConstant.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConstant.java Tue May 13 18:31:18 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,10 +24,18 @@ import java.lang.annotation.*; +/** + * Refers to a C++ constant in the VM. + */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface HotSpotVMConstant { + /** + * Returns the name of the constant. + * + * @return name of constant + */ String name(); /** diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMField.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMField.java Tue May 13 18:31:18 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,21 +24,53 @@ import java.lang.annotation.*; +/** + * Refers to a C++ field in the VM. + */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface HotSpotVMField { + /** + * Types of information this annotation can return. + */ enum Type { + /** + * Returns the offset of this field within the type. Only valid for instance fields. + */ OFFSET, + + /** + * Returns the absolute address of this field. Only valid for static fields. + */ ADDRESS, + + /** + * Returns the value of this field. Only valid for static fields. + */ VALUE; } - String name(); + /** + * Specifies what type of information to return. + * + * @see Type + */ + Type get(); + /** + * Returns the type name containing this field. + * + * @return name of containing type + */ String type(); - Type get(); + /** + * Returns the name of this field. + * + * @return name of field + */ + String name(); /** * List of architectures where this constant is required. Names are derived from diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMFlag.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMFlag.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMFlag.java Tue May 13 18:31:18 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,10 +24,18 @@ import java.lang.annotation.*; +/** + * Refers to a C++ flag in the VM. + */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface HotSpotVMFlag { + /** + * Returns the name of this flag. + * + * @return name of flag. + */ String name(); /** diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMType.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMType.java Tue May 13 18:31:18 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,15 +24,34 @@ import java.lang.annotation.*; +/** + * Refers to a C++ type in the VM. + */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface HotSpotVMType { + /** + * Types of information this annotation can return. + */ enum Type { + /** + * Returns the size of the type (C++ {@code sizeof()}). + */ SIZE; } - String name(); + /** + * Specifies what type of information to return. + * + * @see Type + */ + Type get(); - Type get(); + /** + * Returns the name of the type. + * + * @return name of type + */ + String name(); } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java Tue May 13 18:31:18 2014 -0700 @@ -80,11 +80,11 @@ Double delta; @Override - protected void assertEquals(Object expected, Object actual) { + protected void assertDeepEquals(Object expected, Object actual) { if (delta != null) { Assert.assertEquals(((Number) expected).doubleValue(), ((Number) actual).doubleValue(), delta); } else { - super.assertEquals(expected, actual); + super.assertDeepEquals(expected, actual); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java Tue May 13 18:31:18 2014 -0700 @@ -109,6 +109,7 @@ if (graph.getGuardsStage().ordinal() < GuardsStage.AFTER_FSA.ordinal()) { ReentrantNodeIterator.apply(new FrameStateAssignmentClosure(), graph.start(), null); graph.setGuardsStage(GuardsStage.AFTER_FSA); + graph.getNodes(FrameState.class).filter(state -> state.usages().isEmpty()).forEach(GraphUtil::killWithUnusedFloatingInputs); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/ComputeInliningRelevance.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/ComputeInliningRelevance.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/ComputeInliningRelevance.java Tue May 13 18:31:18 2014 -0700 @@ -230,7 +230,7 @@ assert !Double.isNaN(invokeProbability); double relevance = (invokeProbability / getFastPathMinProbability()) * Math.min(1.0, getScopeRelevanceWithinParent()); - assert !Double.isNaN(relevance); + assert !Double.isNaN(relevance) : invoke + ": " + relevance + " / " + invokeProbability + " / " + getFastPathMinProbability() + " / " + getScopeRelevanceWithinParent(); return relevance; } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/DepthSearchUtil.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/DepthSearchUtil.java Tue May 13 18:31:18 2014 -0700 @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.phases.common.inlining; + +import com.oracle.graal.api.meta.Constant; +import com.oracle.graal.api.meta.ResolvedJavaMethod; +import com.oracle.graal.compiler.common.type.Stamp; +import com.oracle.graal.debug.Debug; +import com.oracle.graal.graph.NodeInputList; +import com.oracle.graal.nodes.*; +import com.oracle.graal.phases.common.CanonicalizerPhase; +import com.oracle.graal.phases.common.DeadCodeEliminationPhase; +import com.oracle.graal.phases.tiers.HighTierContext; + +import static com.oracle.graal.compiler.common.GraalOptions.OptCanonicalizer; + +/** + * The workings of {@link InliningPhase#run(StructuredGraph, HighTierContext)} include delving into + * a callsite to explore inlining opportunities. The utilities used for that are grouped in this + * class. + */ +public class DepthSearchUtil { + + private DepthSearchUtil() { + // no instances + } + + static InliningUtil.Inlineable getInlineableElement(final ResolvedJavaMethod method, Invoke invoke, HighTierContext context, CanonicalizerPhase canonicalizer) { + Class macroNodeClass = InliningUtil.getMacroNodeClass(context.getReplacements(), method); + if (macroNodeClass != null) { + return new InliningUtil.InlineableMacroNode(macroNodeClass); + } else { + return new InliningUtil.InlineableGraph(buildGraph(method, invoke, context, canonicalizer)); + } + } + + private static StructuredGraph buildGraph(final ResolvedJavaMethod method, final Invoke invoke, final HighTierContext context, CanonicalizerPhase canonicalizer) { + final StructuredGraph newGraph; + final boolean parseBytecodes; + + // TODO (chaeubl): copying the graph is only necessary if it is modified or if it contains + // any invokes + StructuredGraph intrinsicGraph = InliningUtil.getIntrinsicGraph(context.getReplacements(), method); + if (intrinsicGraph != null) { + newGraph = intrinsicGraph.copy(); + parseBytecodes = false; + } else { + StructuredGraph cachedGraph = getCachedGraph(method, context); + if (cachedGraph != null) { + newGraph = cachedGraph.copy(); + parseBytecodes = false; + } else { + newGraph = new StructuredGraph(method); + parseBytecodes = true; + } + } + + try (Debug.Scope s = Debug.scope("InlineGraph", newGraph)) { + if (parseBytecodes) { + parseBytecodes(newGraph, context, canonicalizer); + } + + boolean callerHasMoreInformationAboutArguments = false; + NodeInputList args = invoke.callTarget().arguments(); + for (ParameterNode param : newGraph.getNodes(ParameterNode.class).snapshot()) { + ValueNode arg = args.get(param.index()); + if (arg.isConstant()) { + Constant constant = arg.asConstant(); + newGraph.replaceFloating(param, ConstantNode.forConstant(constant, context.getMetaAccess(), newGraph)); + callerHasMoreInformationAboutArguments = true; + } else { + Stamp joinedStamp = param.stamp().join(arg.stamp()); + if (joinedStamp != null && !joinedStamp.equals(param.stamp())) { + param.setStamp(joinedStamp); + callerHasMoreInformationAboutArguments = true; + } + } + } + + if (!callerHasMoreInformationAboutArguments) { + // TODO (chaeubl): if args are not more concrete, inlining should be avoided + // in most cases or we could at least use the previous graph size + invoke + // probability to check the inlining + } + + if (OptCanonicalizer.getValue()) { + canonicalizer.apply(newGraph, context); + } + + return newGraph; + } catch (Throwable e) { + throw Debug.handle(e); + } + } + + private static StructuredGraph getCachedGraph(ResolvedJavaMethod method, HighTierContext context) { + if (context.getGraphCache() != null) { + StructuredGraph cachedGraph = context.getGraphCache().get(method); + if (cachedGraph != null) { + return cachedGraph; + } + } + return null; + } + + /** + * This method builds the IR nodes for newGraph and canonicalizes them. Provided + * profiling info is mature, the resulting graph is cached. + */ + private static StructuredGraph parseBytecodes(StructuredGraph newGraph, HighTierContext context, CanonicalizerPhase canonicalizer) { + final boolean hasMatureProfilingInfo = newGraph.method().getProfilingInfo().isMature(); + + if (context.getGraphBuilderSuite() != null) { + context.getGraphBuilderSuite().apply(newGraph, context); + } + assert newGraph.start().next() != null : "graph needs to be populated during PhasePosition.AFTER_PARSING"; + + new DeadCodeEliminationPhase().apply(newGraph); + + if (OptCanonicalizer.getValue()) { + canonicalizer.apply(newGraph, context); + } + + if (hasMatureProfilingInfo && context.getGraphCache() != null) { + context.getGraphCache().put(newGraph.method(), newGraph.copy()); + } + return newGraph; + } +} diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java Tue May 13 18:31:18 2014 -0700 @@ -31,7 +31,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.Graph.Mark; @@ -93,14 +92,75 @@ return inliningCount; } + /** + *

+ * The space of inlining decisions is explored depth-first with the help of a stack realized by + * {@link InliningData}. At any point in time, its topmost element consist of: + *

    + *
  • + * one or more {@link GraphInfo}s of inlining candidates, all of them corresponding to a single + * callsite (details below). For example, "exact inline" leads to a single candidate.
  • + *
  • + * the callsite (for the targets above) is tracked as a {@link MethodInvocation}. The difference + * between {@link MethodInvocation#totalGraphs()} and {@link MethodInvocation#processedGraphs()} + * indicates the topmost {@link GraphInfo}s that might be delved-into to explore inlining + * opportunities.
  • + *
+ *

+ * + *

+ * The bottom-most element in the stack consists of: + *

    + *
  • + * a single {@link GraphInfo} (the root one, for the method on which inlining was called)
  • + *
  • + * a single {@link MethodInvocation} (the {@link MethodInvocation#isRoot} one, ie the unknown + * caller of the root graph)
  • + *
+ * + *

+ * + *

+ * The stack grows and shrinks as choices are made among the alternatives below: + *

    + *
  1. + * not worth inlining: pop any remaining graphs not yet delved into, pop the current invocation. + *
  2. + *
  3. + * process next invoke: delve into one of the callsites hosted in the current candidate graph, + * determine whether any inlining should be performed in it
  4. + *
  5. + * try to inline: move past the current inlining candidate (remove it from the topmost element). + * If that was the last one then try to inline the callsite that is (still) in the topmost + * element of {@link InliningData}, and then remove such callsite.
  6. + *
+ *

+ * + *

+ * Some facts about the alternatives above: + *

    + *
  • + * the first step amounts to backtracking, the 2nd one to delving, and the 3rd one also involves + * bakctraking (however after may-be inlining).
  • + *
  • + * the choice of abandon-and-backtrack or delve-into is depends on + * {@link InliningPolicy#isWorthInlining} and {@link InliningPolicy#continueInlining}.
  • + *
  • + * the 3rd choice is picked when both of the previous one aren't picked
  • + *
  • + * as part of trying-to-inline, {@link InliningPolicy#isWorthInlining} again sees use, but + * that's another story.
  • + *
+ *

+ * + */ @Override protected void run(final StructuredGraph graph, final HighTierContext context) { - final InliningData data = new InliningData(graph, context.getAssumptions()); + final InliningData data = new InliningData(graph, context.getAssumptions(), maxMethodPerInlining, canonicalizer); ToDoubleFunction probabilities = new FixedNodeProbabilityCache(); while (data.hasUnprocessedGraphs()) { final MethodInvocation currentInvocation = data.currentInvocation(); - GraphInfo graphInfo = data.currentGraph(); if (!currentInvocation.isRoot() && !inliningPolicy.isWorthInlining(probabilities, context.getReplacements(), currentInvocation.callee(), data.inliningDepth(), currentInvocation.probability(), currentInvocation.relevance(), false)) { @@ -108,8 +168,8 @@ assert remainingGraphs > 0; data.popGraphs(remainingGraphs); data.popInvocation(); - } else if (graphInfo.hasRemainingInvokes() && inliningPolicy.continueInlining(graphInfo.graph())) { - processNextInvoke(data, graphInfo, context); + } else if (data.currentGraph().hasRemainingInvokes() && inliningPolicy.continueInlining(data.currentGraph().graph())) { + data.processNextInvoke(context); } else { data.popGraph(); if (!currentInvocation.isRoot()) { @@ -132,33 +192,6 @@ assert data.graphCount() == 0; } - /** - * Process the next invoke and enqueue all its graphs for processing. - */ - private void processNextInvoke(InliningData data, GraphInfo graphInfo, HighTierContext context) { - Invoke invoke = graphInfo.popInvoke(); - MethodInvocation callerInvocation = data.currentInvocation(); - Assumptions parentAssumptions = callerInvocation.assumptions(); - InlineInfo info = InliningUtil.getInlineInfo(data, invoke, maxMethodPerInlining, context.getReplacements(), parentAssumptions, context.getOptimisticOptimizations()); - - if (info != null) { - double invokeProbability = graphInfo.invokeProbability(invoke); - double invokeRelevance = graphInfo.invokeRelevance(invoke); - MethodInvocation calleeInvocation = data.pushInvocation(info, parentAssumptions, invokeProbability, invokeRelevance); - - for (int i = 0; i < info.numberOfMethods(); i++) { - Inlineable elem = getInlineableElement(info.methodAt(i), info.invoke(), context.replaceAssumptions(calleeInvocation.assumptions())); - info.setInlinableElement(i, elem); - if (elem instanceof InlineableGraph) { - data.pushGraph(((InlineableGraph) elem).getGraph(), invokeProbability * info.probabilityAt(i), invokeRelevance * info.relevanceAt(i)); - } else { - assert elem instanceof InlineableMacroNode; - data.pushDummyGraph(); - } - } - } - } - private void tryToInline(ToDoubleFunction probabilities, GraphInfo callerGraphInfo, MethodInvocation calleeInfo, MethodInvocation parentInvocation, int inliningDepth, HighTierContext context) { InlineInfo callee = calleeInfo.callee(); @@ -210,104 +243,6 @@ } } - private Inlineable getInlineableElement(final ResolvedJavaMethod method, Invoke invoke, HighTierContext context) { - Class macroNodeClass = InliningUtil.getMacroNodeClass(context.getReplacements(), method); - if (macroNodeClass != null) { - return new InlineableMacroNode(macroNodeClass); - } else { - return new InlineableGraph(buildGraph(method, invoke, context)); - } - } - - private StructuredGraph buildGraph(final ResolvedJavaMethod method, final Invoke invoke, final HighTierContext context) { - final StructuredGraph newGraph; - final boolean parseBytecodes; - - // TODO (chaeubl): copying the graph is only necessary if it is modified or if it contains - // any invokes - StructuredGraph intrinsicGraph = InliningUtil.getIntrinsicGraph(context.getReplacements(), method); - if (intrinsicGraph != null) { - newGraph = intrinsicGraph.copy(); - parseBytecodes = false; - } else { - StructuredGraph cachedGraph = getCachedGraph(method, context); - if (cachedGraph != null) { - newGraph = cachedGraph.copy(); - parseBytecodes = false; - } else { - newGraph = new StructuredGraph(method); - parseBytecodes = true; - } - } - - try (Scope s = Debug.scope("InlineGraph", newGraph)) { - if (parseBytecodes) { - parseBytecodes(newGraph, context); - } - - boolean callerHasMoreInformationAboutArguments = false; - NodeInputList args = invoke.callTarget().arguments(); - for (ParameterNode param : newGraph.getNodes(ParameterNode.class).snapshot()) { - ValueNode arg = args.get(param.index()); - if (arg.isConstant()) { - Constant constant = arg.asConstant(); - newGraph.replaceFloating(param, ConstantNode.forConstant(constant, context.getMetaAccess(), newGraph)); - callerHasMoreInformationAboutArguments = true; - } else { - Stamp joinedStamp = param.stamp().join(arg.stamp()); - if (joinedStamp != null && !joinedStamp.equals(param.stamp())) { - param.setStamp(joinedStamp); - callerHasMoreInformationAboutArguments = true; - } - } - } - - if (!callerHasMoreInformationAboutArguments) { - // TODO (chaeubl): if args are not more concrete, inlining should be avoided - // in most cases or we could at least use the previous graph size + invoke - // probability to check the inlining - } - - if (OptCanonicalizer.getValue()) { - canonicalizer.apply(newGraph, context); - } - - return newGraph; - } catch (Throwable e) { - throw Debug.handle(e); - } - } - - private static StructuredGraph getCachedGraph(ResolvedJavaMethod method, HighTierContext context) { - if (context.getGraphCache() != null) { - StructuredGraph cachedGraph = context.getGraphCache().get(method); - if (cachedGraph != null) { - return cachedGraph; - } - } - return null; - } - - private StructuredGraph parseBytecodes(StructuredGraph newGraph, HighTierContext context) { - boolean hasMatureProfilingInfo = newGraph.method().getProfilingInfo().isMature(); - - if (context.getGraphBuilderSuite() != null) { - context.getGraphBuilderSuite().apply(newGraph, context); - } - assert newGraph.start().next() != null : "graph needs to be populated during PhasePosition.AFTER_PARSING"; - - new DeadCodeEliminationPhase().apply(newGraph); - - if (OptCanonicalizer.getValue()) { - canonicalizer.apply(newGraph, context); - } - - if (hasMatureProfilingInfo && context.getGraphCache() != null) { - context.getGraphCache().put(newGraph.method(), newGraph.copy()); - } - return newGraph; - } - private abstract static class AbstractInliningPolicy implements InliningPolicy { protected final Map hints; @@ -490,18 +425,50 @@ */ private final ArrayDeque graphQueue; private final ArrayDeque invocationQueue; + private final int maxMethodPerInlining; + private final CanonicalizerPhase canonicalizer; private int maxGraphs; - public InliningData(StructuredGraph rootGraph, Assumptions rootAssumptions) { + public InliningData(StructuredGraph rootGraph, Assumptions rootAssumptions, int maxMethodPerInlining, CanonicalizerPhase canonicalizer) { this.graphQueue = new ArrayDeque<>(); this.invocationQueue = new ArrayDeque<>(); + this.maxMethodPerInlining = maxMethodPerInlining; + this.canonicalizer = canonicalizer; this.maxGraphs = 1; invocationQueue.push(new MethodInvocation(null, rootAssumptions, 1.0, 1.0)); pushGraph(rootGraph, 1.0, 1.0); } + /** + * Process the next invoke and enqueue all its graphs for processing. + */ + void processNextInvoke(HighTierContext context) { + GraphInfo graphInfo = currentGraph(); + Invoke invoke = graphInfo.popInvoke(); + MethodInvocation callerInvocation = currentInvocation(); + Assumptions parentAssumptions = callerInvocation.assumptions(); + InlineInfo info = InliningUtil.getInlineInfo(this, invoke, maxMethodPerInlining, context.getReplacements(), parentAssumptions, context.getOptimisticOptimizations()); + + if (info != null) { + double invokeProbability = graphInfo.invokeProbability(invoke); + double invokeRelevance = graphInfo.invokeRelevance(invoke); + MethodInvocation calleeInvocation = pushInvocation(info, parentAssumptions, invokeProbability, invokeRelevance); + + for (int i = 0; i < info.numberOfMethods(); i++) { + Inlineable elem = DepthSearchUtil.getInlineableElement(info.methodAt(i), info.invoke(), context.replaceAssumptions(calleeInvocation.assumptions()), canonicalizer); + info.setInlinableElement(i, elem); + if (elem instanceof InlineableGraph) { + pushGraph(((InlineableGraph) elem).getGraph(), invokeProbability * info.probabilityAt(i), invokeRelevance * info.relevanceAt(i)); + } else { + assert elem instanceof InlineableMacroNode; + pushDummyGraph(); + } + } + } + } + public int graphCount() { return graphQueue.size(); } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ArraysSubstitutionsTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ArraysSubstitutionsTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ArraysSubstitutionsTest.java Tue May 13 18:31:18 2014 -0700 @@ -79,9 +79,9 @@ Object arg1 = args1[i]; Object arg2 = args2[i]; // Verify that the original method and the substitution produce the same value - assertEquals(invokeSafe(testMethod, null, arg1, arg2), invokeSafe(realMethod, null, arg1, arg2)); + assertDeepEquals(invokeSafe(testMethod, null, arg1, arg2), invokeSafe(realMethod, null, arg1, arg2)); // Verify that the generated code and the original produce the same value - assertEquals(executeVarargsSafe(code, arg1, arg2), invokeSafe(realMethod, null, arg1, arg2)); + assertDeepEquals(executeVarargsSafe(code, arg1, arg2), invokeSafe(realMethod, null, arg1, arg2)); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewArrayTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewArrayTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewArrayTest.java Tue May 13 18:31:18 2014 -0700 @@ -32,10 +32,10 @@ public class NewArrayTest extends GraalCompilerTest { @Override - protected void assertEquals(Object expected, Object actual) { + protected void assertDeepEquals(Object expected, Object actual) { Assert.assertTrue(expected != null); Assert.assertTrue(actual != null); - super.assertEquals(expected.getClass(), actual.getClass()); + super.assertDeepEquals(expected.getClass(), actual.getClass()); if (expected instanceof int[]) { Assert.assertArrayEquals((int[]) expected, (int[]) actual); } else if (expected instanceof byte[]) { diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewInstanceTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewInstanceTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewInstanceTest.java Tue May 13 18:31:18 2014 -0700 @@ -34,10 +34,10 @@ public class NewInstanceTest extends GraalCompilerTest { @Override - protected void assertEquals(Object expected, Object actual) { + protected void assertDeepEquals(Object expected, Object actual) { Assert.assertTrue(expected != null); Assert.assertTrue(actual != null); - super.assertEquals(expected.getClass(), actual.getClass()); + super.assertDeepEquals(expected.getClass(), actual.getClass()); if (expected instanceof Object[]) { Assert.assertTrue(actual instanceof Object[]); @@ -45,12 +45,12 @@ Object[] aArr = (Object[]) actual; Assert.assertTrue(eArr.length == aArr.length); for (int i = 0; i < eArr.length; i++) { - assertEquals(eArr[i], aArr[i]); + assertDeepEquals(eArr[i], aArr[i]); } } else if (expected.getClass() != Object.class) { try { expected.getClass().getDeclaredMethod("equals", Object.class); - super.assertEquals(expected, actual); + super.assertDeepEquals(expected, actual); } catch (Exception e) { } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java Tue May 13 18:31:18 2014 -0700 @@ -44,12 +44,12 @@ test("math"); double value = 34567.891D; - assertEquals(Math.sqrt(value), MathSubstitutionsX86.sqrt(value)); - assertEquals(Math.log(value), MathSubstitutionsX86.log(value)); - assertEquals(Math.log10(value), MathSubstitutionsX86.log10(value)); - assertEquals(Math.sin(value), MathSubstitutionsX86.sin(value)); - assertEquals(Math.cos(value), MathSubstitutionsX86.cos(value)); - assertEquals(Math.tan(value), MathSubstitutionsX86.tan(value)); + assertDeepEquals(Math.sqrt(value), MathSubstitutionsX86.sqrt(value)); + assertDeepEquals(Math.log(value), MathSubstitutionsX86.log(value)); + assertDeepEquals(Math.log10(value), MathSubstitutionsX86.log10(value)); + assertDeepEquals(Math.sin(value), MathSubstitutionsX86.sin(value)); + assertDeepEquals(Math.cos(value), MathSubstitutionsX86.cos(value)); + assertDeepEquals(Math.tan(value), MathSubstitutionsX86.tan(value)); } @SuppressWarnings("all") @@ -98,9 +98,9 @@ assert optional || code != null; for (Object l : args) { // Verify that the original method and the substitution produce the same value - assertEquals(invokeSafe(testMethod, l), invokeSafe(realMethod, l)); + assertDeepEquals(invokeSafe(testMethod, l), invokeSafe(realMethod, l)); // Verify that the generated code and the original produce the same value - assertEquals(executeVarargsSafe(code, l), invokeSafe(realMethod, l)); + assertDeepEquals(executeVarargsSafe(code, l), invokeSafe(realMethod, l)); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StringSubstitutionsTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StringSubstitutionsTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StringSubstitutionsTest.java Tue May 13 18:31:18 2014 -0700 @@ -73,9 +73,9 @@ Object arg1 = args1[i]; Object arg2 = args2[i]; // Verify that the original method and the substitution produce the same value - assertEquals(invokeSafe(testMethod, null, arg1, arg2), invokeSafe(realMethod, arg1, arg2)); + assertDeepEquals(invokeSafe(testMethod, null, arg1, arg2), invokeSafe(realMethod, arg1, arg2)); // Verify that the generated code and the original produce the same value - assertEquals(executeVarargsSafe(code, arg1, arg2), invokeSafe(realMethod, arg1, arg2)); + assertDeepEquals(executeVarargsSafe(code, arg1, arg2), invokeSafe(realMethod, arg1, arg2)); } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsafeSubstitutionsTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsafeSubstitutionsTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsafeSubstitutionsTest.java Tue May 13 18:31:18 2014 -0700 @@ -69,14 +69,14 @@ { Object expected = invokeSafe(originalMethod, receiver, args1); Object actual = invokeSafe(testMethod, null, args2); - assertEquals(expected, actual); + assertDeepEquals(expected, actual); } // Verify that the generated code and the original produce the same value { Object expected = invokeSafe(originalMethod, receiver, args1); Object actual = executeVarargsSafe(code, args2); - assertEquals(expected, actual); + assertDeepEquals(expected, actual); } } @@ -201,18 +201,18 @@ AtomicInteger a1 = new AtomicInteger(42); AtomicInteger a2 = new AtomicInteger(42); - assertEquals(unsafe.compareAndSwapInt(a1, off(a1, "value"), 42, 53), compareAndSwapInt(unsafe, a2, off(a2, "value"), 42, 53)); - assertEquals(a1.get(), a2.get()); + assertDeepEquals(unsafe.compareAndSwapInt(a1, off(a1, "value"), 42, 53), compareAndSwapInt(unsafe, a2, off(a2, "value"), 42, 53)); + assertDeepEquals(a1.get(), a2.get()); AtomicLong l1 = new AtomicLong(42); AtomicLong l2 = new AtomicLong(42); - assertEquals(unsafe.compareAndSwapLong(l1, off(l1, "value"), 42, 53), compareAndSwapLong(unsafe, l2, off(l2, "value"), 42, 53)); - assertEquals(l1.get(), l2.get()); + assertDeepEquals(unsafe.compareAndSwapLong(l1, off(l1, "value"), 42, 53), compareAndSwapLong(unsafe, l2, off(l2, "value"), 42, 53)); + assertDeepEquals(l1.get(), l2.get()); AtomicReference o1 = new AtomicReference<>("42"); AtomicReference o2 = new AtomicReference<>("42"); - assertEquals(unsafe.compareAndSwapObject(o1, off(o1, "value"), "42", "53"), compareAndSwapObject(unsafe, o2, off(o2, "value"), "42", "53")); - assertEquals(o1.get(), o2.get()); + assertDeepEquals(unsafe.compareAndSwapObject(o1, off(o1, "value"), "42", "53"), compareAndSwapObject(unsafe, o2, off(o2, "value"), "42", "53")); + assertDeepEquals(o1.get(), o2.get()); Foo f1 = new Foo(); f1.test("z", "Boolean", Boolean.TRUE); diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTest.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTest.java Tue May 13 18:31:18 2014 -0700 @@ -22,15 +22,17 @@ */ package com.oracle.graal.test; +import java.io.*; import java.lang.reflect.*; import java.util.*; import org.junit.*; +import org.junit.internal.*; /** * Base class for Graal tests. *

- * This contains common utility methods that are used in multiple test projects. + * This contains common utility methods and classes that are used in tests. */ public class GraalTest { @@ -69,4 +71,118 @@ throw new RuntimeException("method not found: " + methodName + "" + Arrays.toString(parameterTypes)); } } + + /** + * Compares two given objects for {@linkplain Assert#assertEquals(Object, Object) equality}. + * Does a deep copy equality comparison if {@code expected} is an array. + */ + protected void assertDeepEquals(Object expected, Object actual) { + assertDeepEquals(null, expected, actual); + } + + /** + * Compares two given objects for {@linkplain Assert#assertEquals(Object, Object) equality}. + * Does a deep copy equality comparison if {@code expected} is an array. + * + * @param message the identifying message for the {@link AssertionError} + */ + protected void assertDeepEquals(String message, Object expected, Object actual) { + assertDeepEquals(message, expected, actual, equalFloatsOrDoublesDelta()); + } + + /** + * Compares two given values for equality, doing a recursive test if both values are arrays of + * the same type. + * + * @param message the identifying message for the {@link AssertionError} + * @param delta the maximum delta between two doubles or floats for which both numbers are still + * considered equal. + */ + protected void assertDeepEquals(String message, Object expected, Object actual, double delta) { + if (expected != null && actual != null) { + Class expectedClass = expected.getClass(); + Class actualClass = actual.getClass(); + if (expectedClass.isArray()) { + Assert.assertTrue(message, expected != null); + Assert.assertTrue(message, actual != null); + Assert.assertEquals(message, expectedClass, actual.getClass()); + if (expected instanceof int[]) { + Assert.assertArrayEquals(message, (int[]) expected, (int[]) actual); + } else if (expected instanceof byte[]) { + Assert.assertArrayEquals(message, (byte[]) expected, (byte[]) actual); + } else if (expected instanceof char[]) { + Assert.assertArrayEquals(message, (char[]) expected, (char[]) actual); + } else if (expected instanceof short[]) { + Assert.assertArrayEquals(message, (short[]) expected, (short[]) actual); + } else if (expected instanceof float[]) { + Assert.assertArrayEquals(message, (float[]) expected, (float[]) actual, (float) delta); + } else if (expected instanceof long[]) { + Assert.assertArrayEquals(message, (long[]) expected, (long[]) actual); + } else if (expected instanceof double[]) { + Assert.assertArrayEquals(message, (double[]) expected, (double[]) actual, delta); + } else if (expected instanceof boolean[]) { + new ExactComparisonCriteria().arrayEquals(message, expected, actual); + } else if (expected instanceof Object[]) { + new ComparisonCriteria() { + @Override + protected void assertElementsEqual(Object e, Object a) { + assertDeepEquals(message, e, a, delta); + } + }.arrayEquals(message, expected, actual); + } else { + Assert.fail((message == null ? "" : message) + "non-array value encountered: " + expected); + } + } else if (expectedClass.equals(double.class) && actualClass.equals(double.class)) { + Assert.assertEquals((double) expected, (double) actual, delta); + } else if (expectedClass.equals(float.class) && actualClass.equals(float.class)) { + Assert.assertEquals((float) expected, (float) actual, delta); + } + } else { + Assert.assertEquals(message, expected, actual); + } + } + + /** + * Gets the value used by {@link #assertDeepEquals(Object, Object)} and + * {@link #assertDeepEquals(String, Object, Object)} for the maximum delta between two doubles + * or floats for which both numbers are still considered equal. + */ + protected double equalFloatsOrDoublesDelta() { + return 0.0D; + } + + @SuppressWarnings("serial") + public static class MultiCauseAssertionError extends AssertionError { + + private Throwable[] causes; + + public MultiCauseAssertionError(String message, Throwable... causes) { + super(message); + this.causes = causes; + } + + @Override + public void printStackTrace(PrintStream out) { + super.printStackTrace(out); + int num = 0; + for (Throwable cause : causes) { + if (cause != null) { + out.print("cause " + (num++)); + cause.printStackTrace(out); + } + } + } + + @Override + public void printStackTrace(PrintWriter out) { + super.printStackTrace(out); + int num = 0; + for (Throwable cause : causes) { + if (cause != null) { + out.print("cause " + (num++) + ": "); + cause.printStackTrace(out); + } + } + } + } } diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalVerboseTextListener.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalVerboseTextListener.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalVerboseTextListener.java Tue May 13 18:31:18 2014 -0700 @@ -65,7 +65,8 @@ @Override public void testFailed(Failure failure) { - getWriter().print("FAILED"); + getWriter().println("FAILED"); + failure.getException().printStackTrace(getWriter()); } @Override diff -r 8de99b84c9cd -r dcaf3993ad17 graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/AssumptionPartialEvaluationTest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/AssumptionPartialEvaluationTest.java Tue May 13 18:29:55 2014 -0700 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/AssumptionPartialEvaluationTest.java Tue May 13 18:31:18 2014 -0700 @@ -46,7 +46,7 @@ InstalledCode installedCode = assertPartialEvalEquals("constant42", rootNode); Assert.assertTrue(installedCode.isValid()); try { - assertEquals(42, installedCode.executeVarargs(null, null, null)); + assertDeepEquals(42, installedCode.executeVarargs(null, null, null)); } catch (InvalidInstalledCodeException e) { Assert.fail("Code must not have been invalidated."); } diff -r 8de99b84c9cd -r dcaf3993ad17 mx/projects --- a/mx/projects Tue May 13 18:29:55 2014 -0700 +++ b/mx/projects Tue May 13 18:31:18 2014 -0700 @@ -652,7 +652,7 @@ # graal.compiler.hsail.test.infra - HSAIL compiler test infrastructure project@com.oracle.graal.compiler.hsail.test.infra@subDir=graal project@com.oracle.graal.compiler.hsail.test.infra@sourceDirs=src -project@com.oracle.graal.compiler.hsail.test.infra@dependencies=com.oracle.graal.hotspot.hsail,JUNIT,OKRA_WITH_SIM +project@com.oracle.graal.compiler.hsail.test.infra@dependencies=com.oracle.graal.test,com.oracle.graal.hotspot.hsail,OKRA_WITH_SIM project@com.oracle.graal.compiler.hsail.test.infra@checkstyle=com.oracle.graal.graph project@com.oracle.graal.compiler.hsail.test.infra@javaCompliance=1.8 diff -r 8de99b84c9cd -r dcaf3993ad17 src/gpu/hsail/vm/gpu_hsail.cpp --- a/src/gpu/hsail/vm/gpu_hsail.cpp Tue May 13 18:29:55 2014 -0700 +++ b/src/gpu/hsail/vm/gpu_hsail.cpp Tue May 13 18:31:18 2014 -0700 @@ -392,19 +392,16 @@ // Reset the kernel arguments _okra_clearargs(kernel); - // get how many bytes per deopt save area are required - int saveAreaCounts = OopSaver::getSaveAreaCounts(oop_map_array); - int numSRegs = saveAreaCounts & 0xff; - int numDRegs = (saveAreaCounts >> 8) & 0xff; - int numStackSlots = (saveAreaCounts >> 16); - int bytesPerSaveArea = numSRegs * 4 + (numDRegs + numStackSlots) * 8; - HSAILDeoptimizationInfo* e; if (UseHSAILDeoptimization) { - e = new (MAX_DEOPT_SLOTS, bytesPerSaveArea) HSAILDeoptimizationInfo(MAX_DEOPT_SLOTS, bytesPerSaveArea); - e->set_never_ran_array(NEW_C_HEAP_ARRAY(jboolean, dimX, mtInternal)); - memset(e->never_ran_array(), 0, dimX * sizeof(jboolean)); - e->set_donor_threads(donorThreads); + // get how many bytes per deopt save area are required + int saveAreaCounts = OopSaver::getSaveAreaCounts(oop_map_array); + int numSRegs = saveAreaCounts & 0xff; + int numDRegs = (saveAreaCounts >> 8) & 0xff; + int numStackSlots = (saveAreaCounts >> 16); + int bytesPerSaveArea = numSRegs * 4 + (numDRegs + numStackSlots) * 8; + + e = new (MAX_DEOPT_SLOTS, bytesPerSaveArea) HSAILDeoptimizationInfo(MAX_DEOPT_SLOTS, bytesPerSaveArea, dimX, donorThreads); } // This object sets up the kernel arguments @@ -455,7 +452,6 @@ } if (UseHSAILDeoptimization) { - kernelStats.incDeopts(); // check if any workitem requested a deopt int deoptcode = e->deopt_occurred(); if (deoptcode != 1) { @@ -470,6 +466,7 @@ guarantee(deoptcode == 1, msg); } } else { + kernelStats.incDeopts(); { TraceTime t3("handle deoptimizing workitems", TraceGPUInteraction); @@ -586,7 +583,6 @@ } // end of never-ran handling } - FREE_C_HEAP_ARRAY(jboolean, e->never_ran_array(), mtInternal); delete e; } kernelStats.finishDispatch(); diff -r 8de99b84c9cd -r dcaf3993ad17 src/gpu/hsail/vm/gpu_hsail.hpp --- a/src/gpu/hsail/vm/gpu_hsail.hpp Tue May 13 18:29:55 2014 -0700 +++ b/src/gpu/hsail/vm/gpu_hsail.hpp Tue May 13 18:31:18 2014 -0700 @@ -37,7 +37,7 @@ private: // TODO: separate workitemid and actionAndReason out // since they are there only once even if there are multiple frames - // for now, though we only ever have one hsail fram + // for now, though we only ever have one hsail frame jint _workitemid; jint _actionAndReason; // the first (innermost) "hsail frame" starts after the above fields @@ -56,51 +56,63 @@ // TODO: query the device to get this number #define MAX_DEOPT_SLOTS (8 * 40 * 64) - class HSAILDeoptimizationInfo : public ResourceObj { + class HSAILDeoptimizationInfo : public CHeapObj { friend class VMStructs; private: jint* _notice_safepoints; jint _deopt_occurred; jint _deopt_next_index; JavaThread** _donor_threads; - jboolean * _never_ran_array; jint _num_slots; - jint _bytesPerSaveArea; jint _deopt_span; + char _ignore; + // keep a pointer last so save area following it is word aligned + jboolean * _never_ran_array; public: HSAILKernelDeoptimization _deopt_save_states[1]; // number and size of these can vary per kernel - inline HSAILDeoptimizationInfo(int numSlots, int bytesPerSaveArea) { + static inline size_t hdr_size() { + return sizeof(HSAILDeoptimizationInfo); + } + + inline jbyte * save_area_start() { + return (jbyte*) (this) + hdr_size(); + } + + inline HSAILDeoptimizationInfo(int numSlots, int bytesPerSaveArea, int dimX, JavaThread** donorThreads) { _notice_safepoints = &Hsail::_notice_safepoints; _deopt_occurred = 0; _deopt_next_index = 0; _num_slots = numSlots; - _bytesPerSaveArea = bytesPerSaveArea; + _never_ran_array = NEW_C_HEAP_ARRAY(jboolean, dimX, mtInternal); + memset(_never_ran_array, 0, dimX * sizeof(jboolean)); + _donor_threads = donorThreads; _deopt_span = sizeof(HSAILKernelDeoptimization) + sizeof(HSAILFrame) + bytesPerSaveArea; if (TraceGPUInteraction) { tty->print_cr("HSAILDeoptimizationInfo allocated, %d slots of size %d, total size = 0x%lx bytes", _num_slots, _deopt_span, (_num_slots * _deopt_span + sizeof(HSAILDeoptimizationInfo))); } } + inline ~HSAILDeoptimizationInfo() { + FREE_C_HEAP_ARRAY(jboolean, _never_ran_array, mtInternal); + } + inline jint deopt_occurred() { return _deopt_occurred; } inline jint num_deopts() { return _deopt_next_index; } inline jboolean *never_ran_array() { return _never_ran_array; } - inline void set_never_ran_array(jboolean *p) { _never_ran_array = p; } - inline void set_donor_threads(JavaThread **threads) { _donor_threads = threads; } inline jint num_slots() {return _num_slots;} inline HSAILKernelDeoptimization * get_deopt_save_state(int slot) { // use _deopt_span to index into _deopt_states - char *p = (char *) _deopt_save_states; - p += _deopt_span * slot; - return (HSAILKernelDeoptimization *) p; + return (HSAILKernelDeoptimization *) (save_area_start() + _deopt_span * slot); } void * operator new (size_t hdrSize, int numSlots, int bytesPerSaveArea) { - size_t totalSizeBytes = hdrSize + numSlots * (sizeof(HSAILKernelDeoptimization) + bytesPerSaveArea); + assert(hdrSize <= hdr_size(), ""); + size_t totalSizeBytes = hdr_size() + numSlots * (sizeof(HSAILKernelDeoptimization) + sizeof(HSAILFrame) + bytesPerSaveArea); return NEW_C_HEAP_ARRAY(char, totalSizeBytes, mtInternal); } @@ -109,7 +121,6 @@ } }; - private: static JNINativeMethod HSAIL_methods[]; diff -r 8de99b84c9cd -r dcaf3993ad17 src/gpu/hsail/vm/vmStructs_hsail.hpp --- a/src/gpu/hsail/vm/vmStructs_hsail.hpp Tue May 13 18:29:55 2014 -0700 +++ b/src/gpu/hsail/vm/vmStructs_hsail.hpp Tue May 13 18:31:18 2014 -0700 @@ -46,7 +46,6 @@ nonstatic_field(Hsail::HSAILDeoptimizationInfo, _deopt_next_index, jint) \ nonstatic_field(Hsail::HSAILDeoptimizationInfo, _donor_threads, JavaThread**) \ nonstatic_field(Hsail::HSAILDeoptimizationInfo, _never_ran_array, jboolean *) \ - nonstatic_field(Hsail::HSAILDeoptimizationInfo, _deopt_save_states[0], Hsail::HSAILKernelDeoptimization) \ #define VM_TYPES_GPU_HSAIL(declare_type, declare_toplevel_type) \ declare_toplevel_type(HSAILFrame) \ @@ -54,8 +53,4 @@ declare_toplevel_type(Hsail::HSAILKernelDeoptimization) \ declare_toplevel_type(Hsail::HSAILDeoptimizationInfo) -#define VM_INT_CONSTANTS_GPU_HSAIL(declare_constant) \ - declare_constant(sizeof(HSAILFrame)) \ - declare_constant(sizeof(Hsail::HSAILKernelDeoptimization)) \ - #endif // GPU_HSAIL_VM_VMSTRUCTS_HSAIL_HPP diff -r 8de99b84c9cd -r dcaf3993ad17 src/share/vm/classfile/systemDictionary.hpp --- a/src/share/vm/classfile/systemDictionary.hpp Tue May 13 18:29:55 2014 -0700 +++ b/src/share/vm/classfile/systemDictionary.hpp Tue May 13 18:31:18 2014 -0700 @@ -203,7 +203,6 @@ do_klass(HotSpotCodeInfo_klass, com_oracle_graal_hotspot_meta_HotSpotCodeInfo, Opt) \ do_klass(HotSpotInstalledCode_klass, com_oracle_graal_hotspot_meta_HotSpotInstalledCode, Opt) \ do_klass(HotSpotNmethod_klass, com_oracle_graal_hotspot_meta_HotSpotNmethod, Opt) \ - do_klass(HotSpotJavaType_klass, com_oracle_graal_hotspot_meta_HotSpotJavaType, Opt) \ do_klass(HotSpotResolvedJavaMethod_klass, com_oracle_graal_hotspot_meta_HotSpotResolvedJavaMethod, Opt) \ do_klass(HotSpotResolvedObjectType_klass, com_oracle_graal_hotspot_meta_HotSpotResolvedObjectType, Opt) \ do_klass(HotSpotMonitorValue_klass, com_oracle_graal_hotspot_meta_HotSpotMonitorValue, Opt) \ diff -r 8de99b84c9cd -r dcaf3993ad17 src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Tue May 13 18:29:55 2014 -0700 +++ b/src/share/vm/classfile/vmSymbols.hpp Tue May 13 18:31:18 2014 -0700 @@ -312,7 +312,6 @@ template(com_oracle_graal_hotspot_meta_HotSpotCodeInfo, "com/oracle/graal/hotspot/meta/HotSpotCodeInfo") \ template(com_oracle_graal_hotspot_meta_HotSpotInstalledCode, "com/oracle/graal/hotspot/meta/HotSpotInstalledCode") \ template(com_oracle_graal_hotspot_meta_HotSpotNmethod, "com/oracle/graal/hotspot/meta/HotSpotNmethod") \ - template(com_oracle_graal_hotspot_meta_HotSpotJavaType, "com/oracle/graal/hotspot/meta/HotSpotJavaType") \ template(com_oracle_graal_hotspot_meta_HotSpotResolvedJavaMethod, "com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod") \ template(com_oracle_graal_hotspot_meta_HotSpotResolvedObjectType, "com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType") \ template(com_oracle_graal_hotspot_meta_HotSpotMonitorValue, "com/oracle/graal/hotspot/meta/HotSpotMonitorValue") \ @@ -323,12 +322,10 @@ template(com_oracle_graal_api_meta_Constant, "com/oracle/graal/api/meta/Constant") \ template(com_oracle_graal_api_meta_PrimitiveConstant, "com/oracle/graal/api/meta/PrimitiveConstant") \ template(com_oracle_graal_api_meta_NullConstant, "com/oracle/graal/api/meta/NullConstant") \ - template(com_oracle_graal_api_meta_ConstantPool, "com/oracle/graal/api/meta/ConstantPool") \ template(com_oracle_graal_api_meta_ExceptionHandler, "com/oracle/graal/api/meta/ExceptionHandler") \ template(com_oracle_graal_api_meta_JavaMethod, "com/oracle/graal/api/meta/JavaMethod") \ template(com_oracle_graal_api_meta_JavaType, "com/oracle/graal/api/meta/JavaType") \ template(com_oracle_graal_api_meta_Kind, "com/oracle/graal/api/meta/Kind") \ - template(com_oracle_graal_api_meta_ResolvedJavaField, "com/oracle/graal/api/meta/ResolvedJavaField") \ template(com_oracle_graal_api_meta_Value, "com/oracle/graal/api/meta/Value") \ /* graal.api.code */ \ template(com_oracle_graal_api_code_Assumptions, "com/oracle/graal/api/code/Assumptions") \ diff -r 8de99b84c9cd -r dcaf3993ad17 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Tue May 13 18:29:55 2014 -0700 +++ b/src/share/vm/graal/graalJavaAccess.hpp Tue May 13 18:31:18 2014 -0700 @@ -52,13 +52,8 @@ oop_field(HotSpotResolvedObjectType, javaClass, "Ljava/lang/Class;") \ end_class \ start_class(HotSpotResolvedJavaMethod) \ - oop_field(HotSpotResolvedJavaMethod, name, "Ljava/lang/String;") \ - oop_field(HotSpotResolvedJavaMethod, holder, "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedObjectType;") \ long_field(HotSpotResolvedJavaMethod, metaspaceMethod) \ end_class \ - start_class(HotSpotJavaType) \ - oop_field(HotSpotJavaType, name, "Ljava/lang/String;") \ - end_class \ start_class(InstalledCode) \ long_field(InstalledCode, address) \ long_field(InstalledCode, version) \ diff -r 8de99b84c9cd -r dcaf3993ad17 src/share/vm/runtime/mutexLocker.cpp --- a/src/share/vm/runtime/mutexLocker.cpp Tue May 13 18:29:55 2014 -0700 +++ b/src/share/vm/runtime/mutexLocker.cpp Tue May 13 18:31:18 2014 -0700 @@ -133,10 +133,6 @@ Mutex* JfrThreadGroups_lock = NULL; #endif -#ifdef GRAAL -Monitor* GraalInitialization_lock = NULL; -#endif - #define MAX_NUM_MUTEX 128 static Monitor * _mutex_array[MAX_NUM_MUTEX]; static int _num_mutex; @@ -284,10 +280,6 @@ def(JfrStream_lock , Mutex, nonleaf+2, true); def(JfrStacktrace_lock , Mutex, special, true ); #endif - -#ifdef GRAAL - def(GraalInitialization_lock , Monitor, nonleaf+5, false); -#endif } GCMutexLocker::GCMutexLocker(Monitor * mutex) { diff -r 8de99b84c9cd -r dcaf3993ad17 src/share/vm/runtime/mutexLocker.hpp --- a/src/share/vm/runtime/mutexLocker.hpp Tue May 13 18:29:55 2014 -0700 +++ b/src/share/vm/runtime/mutexLocker.hpp Tue May 13 18:31:18 2014 -0700 @@ -146,10 +146,6 @@ extern Mutex* JfrThreadGroups_lock; // protects JFR access to Thread Groups #endif -#ifdef GRAAL -extern Monitor* GraalInitialization_lock; // ensures exactly 1 thread initializes Graal -#endif - // A MutexLocker provides mutual exclusion with respect to a given mutex // for the scope which contains the locker. The lock is an OS lock, not // an object lock, and the two do not interoperate. Do not use Mutex-based diff -r 8de99b84c9cd -r dcaf3993ad17 src/share/vm/runtime/vmStructs.cpp --- a/src/share/vm/runtime/vmStructs.cpp Tue May 13 18:29:55 2014 -0700 +++ b/src/share/vm/runtime/vmStructs.cpp Tue May 13 18:31:18 2014 -0700 @@ -3124,7 +3124,6 @@ VM_INT_CONSTANTS_GRAAL(GENERATE_VM_INT_CONSTANT_ENTRY, GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY) - VM_INT_CONSTANTS_GPU_HSAIL(GENERATE_VM_INT_CONSTANT_ENTRY) #endif #if INCLUDE_ALL_GCS