use of com.oracle.truffle.espresso.nodes.EspressoRootNode in project graal by oracle.
the class InterpreterToVM method fillInStackTrace.
/**
* Preemptively added method to benefit from truffle lazy stack traces when they will be
* reworked.
*/
@SuppressWarnings("unused")
public static StaticObject fillInStackTrace(@JavaType(Throwable.class) StaticObject throwable, Meta meta) {
// Inlined calls to help StackOverflows.
VM.StackTrace frames = (VM.StackTrace) meta.HIDDEN_FRAMES.getHiddenObject(throwable);
if (frames != null) {
return throwable;
}
EspressoException e = EspressoException.wrap(throwable, meta);
List<TruffleStackTraceElement> trace = TruffleStackTrace.getStackTrace(e);
if (trace == null) {
meta.HIDDEN_FRAMES.setHiddenObject(throwable, VM.StackTrace.EMPTY_STACK_TRACE);
meta.java_lang_Throwable_backtrace.setObject(throwable, throwable);
return throwable;
}
int bci = -1;
Method m = null;
frames = new VM.StackTrace();
FrameCounter c = new FrameCounter();
for (TruffleStackTraceElement element : trace) {
Node location = element.getLocation();
while (location != null) {
if (location instanceof QuickNode) {
bci = ((QuickNode) location).getBci(element.getFrame());
break;
}
location = location.getParent();
}
RootCallTarget target = element.getTarget();
if (target != null) {
RootNode rootNode = target.getRootNode();
if (rootNode instanceof EspressoRootNode) {
m = ((EspressoRootNode) rootNode).getMethod();
if (c.checkFillIn(m) || c.checkThrowableInit(m)) {
bci = UNKNOWN_BCI;
continue;
}
if (m.isNative()) {
bci = NATIVE_BCI;
}
frames.add(new VM.StackElement(m, bci));
bci = UNKNOWN_BCI;
}
}
}
meta.HIDDEN_FRAMES.setHiddenObject(throwable, frames);
meta.java_lang_Throwable_backtrace.setObject(throwable, throwable);
return throwable;
}
use of com.oracle.truffle.espresso.nodes.EspressoRootNode in project graal by oracle.
the class VM method getEspressoRootFromFrame.
@TruffleBoundary
public static EspressoRootNode getEspressoRootFromFrame(FrameInstance frameInstance, EspressoContext context) {
EspressoRootNode root = getRawEspressoRootFromFrame(frameInstance);
if (root == null) {
return null;
}
Method method = root.getMethod();
if (method.getContext() != context) {
return null;
}
return root;
}
use of com.oracle.truffle.espresso.nodes.EspressoRootNode in project graal by oracle.
the class Method method forceSplit.
public Method forceSplit() {
Method result = new Method(this, getCodeAttribute());
BytecodeNode bytecodeNode = new BytecodeNode(result.getMethodVersion());
EspressoRootNode root = EspressoRootNode.create(bytecodeNode.getFrameDescriptor(), bytecodeNode);
result.getMethodVersion().callTarget = root.getCallTarget();
return result;
}
use of com.oracle.truffle.espresso.nodes.EspressoRootNode in project graal by oracle.
the class JDWPContextImpl method getOwnedMonitors.
@Override
public MonitorStackInfo[] getOwnedMonitors(CallFrame[] callFrames) {
List<MonitorStackInfo> result = new ArrayList<>();
int stackDepth = 0;
for (CallFrame callFrame : callFrames) {
RootNode rootNode = callFrame.getRootNode();
if (rootNode instanceof EspressoRootNode) {
EspressoRootNode espressoRootNode = (EspressoRootNode) rootNode;
if (espressoRootNode.usesMonitors()) {
StaticObject[] monitors = espressoRootNode.getMonitorsOnFrame(callFrame.getFrame());
for (StaticObject monitor : monitors) {
if (monitor != null) {
result.add(new MonitorStackInfo(monitor, stackDepth));
}
}
}
}
stackDepth++;
}
return result.toArray(new MonitorStackInfo[result.size()]);
}
Aggregations