src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/UnwindExceptionToCallerStub.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/UnwindExceptionToCallerStub.java	Mon Mar 20 17:39:10 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/UnwindExceptionToCallerStub.java	Mon Mar 20 17:39:10 2017

*** 20,29 **** --- 20,30 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package org.graalvm.compiler.hotspot.stubs; + import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG; import static org.graalvm.compiler.hotspot.nodes.JumpToExceptionHandlerInCallerNode.jumpToExceptionHandlerInCaller; import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord; import static org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub.checkExceptionNotNull; import static org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub.checkNoExceptionInThread; import static org.graalvm.compiler.hotspot.stubs.StubUtil.cAssertionsEnabled;
*** 34,50 **** --- 35,53 ---- import org.graalvm.compiler.api.replacements.Fold; import org.graalvm.compiler.api.replacements.Fold.InjectedParameter; import org.graalvm.compiler.api.replacements.Snippet; import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter; import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor; + import org.graalvm.compiler.debug.Assertions; import org.graalvm.compiler.graph.Node.ConstantNodeParameter; import org.graalvm.compiler.graph.Node.NodeIntrinsic; import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage; import org.graalvm.compiler.hotspot.meta.HotSpotProviders; import org.graalvm.compiler.hotspot.nodes.StubForeignCallNode; import org.graalvm.compiler.nodes.UnwindNode; + import org.graalvm.compiler.options.OptionValues; import org.graalvm.compiler.word.Pointer; import org.graalvm.compiler.word.Word; import jdk.vm.ci.code.Register;
*** 52,63 **** --- 55,66 ---- * Stub called by an {@link UnwindNode}. This stub executes in the frame of the method throwing an * exception and completes by jumping to the exception handler in the calling frame. */ public class UnwindExceptionToCallerStub extends SnippetStub { ! public UnwindExceptionToCallerStub(OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) { ! super("unwindExceptionToCaller", options, providers, linkage); } /** * The current frame is unwound by this stub. Therefore, it does not need to save any registers * as HotSpot uses a caller save convention.
*** 67,123 **** --- 70,124 ---- return false; } @Override protected Object getConstantParameterValue(int index, String name) { assert index == 2; + if (index == 2) { return providers.getRegisters().getThreadRegister(); } + assert index == 3; + return options; + } @Snippet ! private static void unwindExceptionToCaller(Object exception, Word returnAddress, @ConstantParameter Register threadRegister, @ConstantParameter OptionValues options) { Pointer exceptionOop = Word.objectToTrackedPointer(exception); ! if (logging(options)) { printf("unwinding exception %p (", exceptionOop.rawValue()); decipher(exceptionOop.rawValue()); printf(") at %p (", returnAddress.rawValue()); decipher(returnAddress.rawValue()); printf(")\n"); } Word thread = registerAsWord(threadRegister); ! checkNoExceptionInThread(thread, assertionsEnabled(null)); ! checkExceptionNotNull(assertionsEnabled(null), exception); ! checkNoExceptionInThread(thread, assertionsEnabled(INJECTED_VMCONFIG)); ! checkExceptionNotNull(assertionsEnabled(INJECTED_VMCONFIG), exception); Word handlerInCallerPc = exceptionHandlerForReturnAddress(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, thread, returnAddress); ! if (logging(options)) { printf("handler for exception %p at return address %p is at %p (", exceptionOop.rawValue(), returnAddress.rawValue(), handlerInCallerPc.rawValue()); decipher(handlerInCallerPc.rawValue()); printf(")\n"); } jumpToExceptionHandlerInCaller(handlerInCallerPc, exception, returnAddress); } @Fold ! static boolean logging(OptionValues options) { ! return StubOptions.TraceUnwindStub.getValue(options); } /** ! * Determines if either Java assertions are enabled for {@link UnwindExceptionToCallerStub} or - * if this is a HotSpot build where the ASSERT mechanism is enabled. * <p> * This first check relies on the per-class assertion status which is why this method must be in * this class. ! * Determines if either Java assertions are enabled for Graal or if this is a HotSpot build ! * where the ASSERT mechanism is enabled. */ @Fold @SuppressWarnings("all") static boolean assertionsEnabled(@InjectedParameter GraalHotSpotVMConfig config) { ! boolean enabled = false; assert enabled = true; return enabled || cAssertionsEnabled(config); ! return Assertions.ENABLED || cAssertionsEnabled(config); } public static final ForeignCallDescriptor EXCEPTION_HANDLER_FOR_RETURN_ADDRESS = newDescriptor(UnwindExceptionToCallerStub.class, "exceptionHandlerForReturnAddress", Word.class, Word.class, Word.class);

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/UnwindExceptionToCallerStub.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File