# HG changeset patch # User Doug Simon # Date 1376048888 -7200 # Node ID 3209552fdb4e00ccacef3ac1b299ec5f71fcec01 # Parent b5e95841d36632edf966c82fa7ac943fb9c3c8d7 disabled check for thread local holding the exception PC being cleared in PRODUCT builds (clearing only happens in DEBUG builds) diff -r b5e95841d366 -r 3209552fdb4e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java Fri Aug 09 11:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java Fri Aug 09 13:48:08 2013 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.stubs; -import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.hotspot.nodes.PatchReturnAddressNode.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.hotspot.stubs.StubUtil.*; @@ -99,9 +98,13 @@ if (currentException != null) { fatal("exception object in thread must be null, not %p", Word.fromObject(currentException).rawValue()); } - Word currentExceptionPc = readExceptionPc(thread()); - if (currentExceptionPc.notEqual(Word.zero())) { - fatal("exception PC in thread must be zero, not %p", currentExceptionPc.rawValue()); + if (cAssertionsEnabled()) { + // This thread-local is only cleared in DEBUG builds of the VM + // (see OptoRuntime::generate_exception_blob) + Word currentExceptionPc = readExceptionPc(thread()); + if (currentExceptionPc.notEqual(Word.zero())) { + fatal("exception PC in thread must be zero, not %p", currentExceptionPc.rawValue()); + } } } } @@ -117,12 +120,19 @@ return Boolean.getBoolean("graal.logExceptionHandlerStub"); } + /** + * Determines if either Java assertions are enabled for {@link ExceptionHandlerStub} or if this + * is a HotSpot build where the ASSERT mechanism is enabled. + *

+ * This first check relies on the per-class assertion status which is why this method must be in + * this class. + */ @Fold @SuppressWarnings("all") private static boolean assertionsEnabled() { boolean enabled = false; assert enabled = true; - return enabled || graalRuntime().getConfig().cAssertions; + return enabled || cAssertionsEnabled(); } public static final ForeignCallDescriptor EXCEPTION_HANDLER_FOR_PC = descriptorFor(ExceptionHandlerStub.class, "exceptionHandlerForPc"); diff -r b5e95841d366 -r 3209552fdb4e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java Fri Aug 09 11:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java Fri Aug 09 13:48:08 2013 +0200 @@ -24,6 +24,7 @@ import static com.oracle.graal.api.code.DeoptimizationAction.*; import static com.oracle.graal.api.meta.DeoptimizationReason.*; +import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.hotspot.nodes.CStringNode.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.word.Word.*; @@ -80,6 +81,14 @@ } } + /** + * Determines if this is a HotSpot build where the ASSERT mechanism is enabled. + */ + @Fold + public static boolean cAssertionsEnabled() { + return graalRuntime().getConfig().cAssertions; + } + @NodeIntrinsic(StubForeignCallNode.class) private static native void vmMessageC(@ConstantNodeParameter ForeignCallDescriptor stubPrintfC, boolean vmError, Word format, long v1, long v2, long v3); diff -r b5e95841d366 -r 3209552fdb4e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java Fri Aug 09 11:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java Fri Aug 09 13:48:08 2013 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.stubs; -import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.hotspot.nodes.JumpToExceptionHandlerInCallerNode.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import static com.oracle.graal.hotspot.stubs.ExceptionHandlerStub.*; @@ -89,12 +88,19 @@ return Boolean.getBoolean("graal.logUnwindExceptionToCallerStub"); } + /** + * Determines if either Java assertions are enabled for {@link UnwindExceptionToCallerStub} or + * if this is a HotSpot build where the ASSERT mechanism is enabled. + *

+ * This first check relies on the per-class assertion status which is why this method must be in + * this class. + */ @Fold @SuppressWarnings("all") private static boolean assertionsEnabled() { boolean enabled = false; assert enabled = true; - return enabled || graalRuntime().getConfig().cAssertions; + return enabled || cAssertionsEnabled(); } public static final ForeignCallDescriptor EXCEPTION_HANDLER_FOR_RETURN_ADDRESS = descriptorFor(UnwindExceptionToCallerStub.class, "exceptionHandlerForReturnAddress");