Search in sources :

Example 1 with StackTraceBuilder

use of com.oracle.svm.core.jdk.StackTraceBuilder in project graal by oracle.

the class VMThreadCounterOperation method getStackTrace.

@Substitute
@NeverInline("Immediate caller must show up in stack trace and so needs its own stack frame")
private StackTraceElement[] getStackTrace() {
    if (JavaThreads.fromTarget(this) == Thread.currentThread()) {
        /* We can walk our own stack without a VMOperation. */
        StackTraceBuilder stackTraceBuilder = new StackTraceBuilder();
        JavaStackWalker.walkCurrentThread(KnownIntrinsics.readCallerStackPointer(), KnownIntrinsics.readReturnAddress(), stackTraceBuilder);
        return stackTraceBuilder.getTrace();
    } else {
        return JavaThreads.getStackTrace(JavaThreads.fromTarget(this));
    }
}
Also used : StackTraceBuilder(com.oracle.svm.core.jdk.StackTraceBuilder) NeverInline(com.oracle.svm.core.annotate.NeverInline) Substitute(com.oracle.svm.core.annotate.Substitute)

Aggregations

NeverInline (com.oracle.svm.core.annotate.NeverInline)1 Substitute (com.oracle.svm.core.annotate.Substitute)1 StackTraceBuilder (com.oracle.svm.core.jdk.StackTraceBuilder)1