@Specialization public DynamicObject assertNotCompiled() { final boolean[] compiled = new boolean[] {CompilerDirectives.inCompiledCode()}; sideEffect = compiled; if (compiled[0]) { CompilerDirectives.transferToInterpreterAndInvalidate(); throw new RaiseException( getContext() .getCoreLibrary() .internalError("Call to Truffle::Primitive.assert_not_compiled was compiled", this)); } return nil(); }
public final Object callRoot(Object[] originalArguments) { Object[] args = originalArguments; if (CompilerDirectives.inCompiledCode()) { Assumption argumentTypesAssumption = this.profiledArgumentTypesAssumption; if (argumentTypesAssumption != null && argumentTypesAssumption.isValid()) { args = unsafeCast( castArrayFixedLength(args, profiledArgumentTypes.length), Object[].class, true, true); args = castArguments(args); } } VirtualFrame frame = createFrame(getRootNode().getFrameDescriptor(), args); Object result = callProxy(frame); profileReturnType(result); return result; }
public final Object callDirect(Object... args) { compilationProfile.reportDirectCall(); profileArguments(args); try { Object result = doInvoke(args); Class<?> klass = profiledReturnType; if (klass != null && CompilerDirectives.inCompiledCode() && profiledReturnTypeAssumption.isValid()) { result = unsafeCast(result, klass, true, true); } return result; } catch (Throwable t) { t = exceptionProfile.profile(t); if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } else { CompilerDirectives.transferToInterpreter(); throw new RuntimeException(t); } } }