private static TruffleRuntime initRuntime() { if (TruffleOptions.ForceInterpreter) { /* * Force Truffle to run in interpreter mode even if we have a specialized implementation * of TruffleRuntime available. */ return new DefaultTruffleRuntime(); } try { return AccessController.doPrivileged(new PrivilegedAction<TruffleRuntime>() { public TruffleRuntime run() { return createRuntime(); } }); } catch (UnsatisfiedLinkError e) { return new DefaultTruffleRuntime(); } } }
@Override public Assumption createAssumption() { return createAssumption(null); }
void popFrame() { DefaultFrameInstance callerFrame = getThreadLocalStackTrace().callerFrame; if (callerFrame != null) { setThreadLocalStackTrace(new DefaultFrameInstance(callerFrame.frame, callerFrame.target, null, callerFrame.callerFrame)); } else { setThreadLocalStackTrace(null); } }
private void initialize() { synchronized (this) { if (!this.initialized) { getRuntime().getTvmci().onFirstExecution(this); this.initialized = true; } } } }
Object callDirectOrIndirect(final Node callNode, Object... args) { if (!this.initialized) { initialize(); } final DefaultVirtualFrame frame = new DefaultVirtualFrame(getRootNode().getFrameDescriptor(), args); getRuntime().pushFrame(frame, this, callNode); try { return getRootNode().execute(frame); } catch (Throwable t) { getRuntime().getTvmci().onThrowable(callNode, this, t, frame); throw t; } finally { getRuntime().popFrame(); } }
Object callDirectOrIndirect(final Node callNode, Object... args) { if (!this.initialized) { initialize(); } final DefaultVirtualFrame frame = new DefaultVirtualFrame(getRootNode().getFrameDescriptor(), args); getRuntime().pushFrame(frame, this, callNode); try { return getRootNode().execute(frame); } catch (Throwable t) { getRuntime().getTvmci().onThrowable(callNode, this, t, frame); throw t; } finally { getRuntime().popFrame(); } }
@Override public Object call(final VirtualFrame frame, final CallTarget target, Object[] arguments) { DefaultTruffleRuntime truffleRuntime = (DefaultTruffleRuntime) Truffle.getRuntime(); final CallTarget currentCallTarget = truffleRuntime.getCurrentFrame().getCallTarget(); FrameInstance frameInstance = new FrameInstance() { public Frame getFrame(FrameAccess access, boolean slowPath) { return frame; } public boolean isVirtualFrame() { return false; } public Node getCallNode() { return DefaultIndirectCallNode.this; } public CallTarget getCallTarget() { return currentCallTarget; } }; truffleRuntime.pushFrame(frameInstance); try { return target.call(arguments); } finally { truffleRuntime.popFrame(); } } }
@Override public FrameInstance getCallerFrame() { DefaultFrameInstance currentFrame = getThreadLocalStackTrace(); if (currentFrame != null) { return currentFrame.callerFrame; } else { return null; } }
@Override public MaterializedFrame createMaterializedFrame(Object[] arguments) { return createMaterializedFrame(arguments, new FrameDescriptor()); }
private void initialize() { synchronized (this) { if (!this.initialized) { ((DefaultTruffleRuntime) Truffle.getRuntime()).getTvmci().onFirstExecution(this); this.initialized = true; } } } }
@Override public Object call(Object... args) { if (!this.initialized) { initialize(); } final DefaultVirtualFrame frame = new DefaultVirtualFrame(getRootNode().getFrameDescriptor(), args); getRuntime().pushFrame(frame, this); try { return getRootNode().execute(frame); } catch (Throwable t) { getRuntime().getTvmci().onThrowable(null, this, t, frame); throw t; } finally { getRuntime().popFrame(); } }
@Override public Object call(Object... args) { if (!this.initialized) { initialize(); } final DefaultVirtualFrame frame = new DefaultVirtualFrame(getRootNode().getFrameDescriptor(), args); getRuntime().pushFrame(frame, this); try { return getRootNode().execute(frame); } catch (Throwable t) { getRuntime().getTvmci().onThrowable(null, this, t, frame); throw t; } finally { getRuntime().popFrame(); } }
@Override public Object call(final VirtualFrame frame, Object[] arguments) { final CallTarget currentCallTarget = defaultTruffleRuntime().getCurrentFrame().getCallTarget(); FrameInstance frameInstance = new FrameInstance() { public Frame getFrame(FrameAccess access, boolean slowPath) { return frame; } public boolean isVirtualFrame() { return false; } public Node getCallNode() { return DefaultDirectCallNode.this; } public CallTarget getCallTarget() { return currentCallTarget; } }; defaultTruffleRuntime().pushFrame(frameInstance); try { return getCurrentCallTarget().call(arguments); } finally { defaultTruffleRuntime().popFrame(); } }
@Override public FrameInstance getCallerFrame() { DefaultFrameInstance currentFrame = getThreadLocalStackTrace(); if (currentFrame != null) { return currentFrame.callerFrame; } else { return null; } }
@Override public MaterializedFrame createMaterializedFrame(Object[] arguments) { return createMaterializedFrame(arguments, new FrameDescriptor()); }
@SuppressWarnings("deprecation") @Override public RootCallTarget createCallTarget(RootNode rootNode) { DefaultCallTarget target = new DefaultCallTarget(rootNode); rootNode.setCallTarget(target); getTvmci().onLoad(target); return target; }
void popFrame() { DefaultFrameInstance callerFrame = getThreadLocalStackTrace().callerFrame; if (callerFrame != null) { setThreadLocalStackTrace(new DefaultFrameInstance(callerFrame.frame, callerFrame.target, null, callerFrame.callerFrame)); } else { setThreadLocalStackTrace(null); } }
@Override public FrameInstance getCurrentFrame() { return getThreadLocalStackTrace(); }
return access.getRuntime(); return new DefaultTruffleRuntime();
@Override public Assumption createAssumption() { return createAssumption(null); }