@Override public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) { com.oracle.svm.core.graal.nodes.UnreachableNode node = new com.oracle.svm.core.graal.nodes.UnreachableNode(); b.addPush(JavaKind.Object, node); return true; } @Override
@Override public void simplify(SimplifierTool tool) { tool.deleteBranch(next()); replaceAtPredecessor(graph().add(new DeadEndNode())); safeDelete(); }
private static void zeroCheck(int val) { if (val == 0) { DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.ArithmeticException); throw UnreachableNode.unreachable(); } }
private static void zeroCheck(long val) { if (val == 0) { DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.ArithmeticException); throw UnreachableNode.unreachable(); } }
@Override public StructuredGraph buildGraph(DebugContext debug, ResolvedJavaMethod method, HostedProviders providers, Purpose purpose) { HostedGraphKit kit = new JNIGraphKit(debug, providers, method); kit.append(new UnreachableNode()); kit.append(new DeadEndNode()); assert kit.getGraph().verify(); return kit.getGraph(); }
private static void nullCheck(Object obj) { if (obj == null) { DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.NullCheckException); throw UnreachableNode.unreachable(); } }
@Snippet protected static void deoptSnippet(long actionAndReason, SpeculationReason speculation) { runtimeCall(DeoptimizationRuntime.DEOPTIMIZE, actionAndReason, speculation); throw UnreachableNode.unreachable(); }
@Snippet protected static void unwindSnippet(Throwable exception) { Pointer callerSP = readCallerStackPointer(); CodePointer callerIP = readReturnAddress(); runtimeCall(UNWIND_EXCEPTION, exception, callerSP, callerIP); throw unreachable(); }
@Snippet protected static Object assertTypeStateSnippet(Object object, @ConstantParameter boolean nonNull, @VarargsParameter DynamicHub[] expectedHubs, byte[] message) { /* * Discard the stamp information on the input object so that the checks below do not get * optimized away by the canonicalizer. */ Object objectWithoutStamp = discardStamp(object); if (checkTypeState(objectWithoutStamp, nonNull, expectedHubs)) { /* * We passed the check. Return the input object with the original stamp attached again. */ return piCastToSnippetReplaceeStamp(objectWithoutStamp); } runtimeCall(SnippetRuntime.REPORT_TYPE_ASSERTION_ERROR, message, objectWithoutStamp); throw unreachable(); }
@Snippet protected static Object assertStampSnippet(Object object, @ConstantParameter boolean alwaysNull, @ConstantParameter boolean nonNull, @ConstantParameter boolean exactType, DynamicHub expectedHub, byte[] message) { /* * Discard the stamp information on the input object so that the checks below do not get * optimized away by the canonicalizer. */ Object objectWithoutStamp = discardStamp(object); if (checkStamp(object, alwaysNull, nonNull, exactType, expectedHub)) { /* * We passed the check. Return the input object with the original stamp attached again. */ return piCastToSnippetReplaceeStamp(objectWithoutStamp); } runtimeCall(SnippetRuntime.REPORT_TYPE_ASSERTION_ERROR, message, objectWithoutStamp); throw unreachable(); }
/** * The snippet for the lowering of {@link StackOverflowCheckNode}, i.e., the fast-path stack * overflow check. * * Note that this code runs when the stack frame has already been set up completely, i.e., the * stack pointer has already been changed to the new value for the frame. */ @Snippet private static void stackOverflowCheckSnippet(@ConstantParameter boolean mustNotAllocate) { UnsignedWord stackBoundary = StackOverflowCheckImpl.stackBoundaryTL.get(); if (KnownIntrinsics.readStackPointer().belowOrEqual(stackBoundary)) { /* * This check is constant folded during snippet lowering, to avoid setting up a boolean * argument. This keeps the code (which is included in nearly every method) as compact * as possible. */ if (mustNotAllocate) { callSlowPath(THROW_CACHED_STACK_OVERFLOW_ERROR); } else { callSlowPath(THROW_NEW_STACK_OVERFLOW_ERROR); } /* No control flow merge is necessary, the slow path never returns. */ throw UnreachableNode.unreachable(); } }
throw UnreachableNode.unreachable();