use of org.graalvm.nativeimage.IsolateThread in project graal by oracle.
the class PosixCEntryPointSnippets method enterIsolateMT.
@Uninterruptible(reason = "Thread state not set up yet")
@SubstrateForeignCallTarget
private static int enterIsolateMT(Isolate isolate) {
int sanityError = PosixIsolates.checkSanity(isolate);
if (sanityError != Errors.NO_ERROR) {
return sanityError;
}
if (UseHeapBaseRegister.getValue()) {
setHeapBase(PosixIsolates.getHeapBase(isolate));
}
if (!PosixVMThreads.isInitialized()) {
return Errors.UNINITIALIZED_ISOLATE;
}
IsolateThread thread = PosixVMThreads.VMThreadTL.get();
if (VMThreads.isNullThread(thread)) {
return Errors.UNATTACHED_THREAD;
}
writeCurrentVMThread(thread);
return Errors.NO_ERROR;
}
use of org.graalvm.nativeimage.IsolateThread in project graal by oracle.
the class PosixCEntryPointSnippets method detachThreadSnippet.
@Snippet
public static int detachThreadSnippet() {
int result = Errors.NO_ERROR;
if (MultiThreaded.getValue()) {
IsolateThread thread = CEntryPointContext.getCurrentIsolateThread();
result = runtimeCall(DETACH_THREAD_MT, thread);
}
if (UseHeapBaseRegister.getValue()) {
writeCurrentVMHeapBase(WordFactory.nullPointer());
}
return result;
}
use of org.graalvm.nativeimage.IsolateThread in project graal by oracle.
the class SubstrateUtil method dumpVMThreads.
@NeverInline("catch implicit exceptions")
private static void dumpVMThreads(Log log) {
log.string("VMThreads info:").newline();
log.indent(true);
for (IsolateThread vmThread = VMThreads.firstThread(); vmThread != VMThreads.nullThread(); vmThread = VMThreads.nextThread(vmThread)) {
log.string("VMThread ").zhex(vmThread.rawValue()).spaces(2).string(VMThreads.StatusSupport.getStatusString(vmThread)).newline();
}
log.indent(false);
}
use of org.graalvm.nativeimage.IsolateThread in project graal by oracle.
the class SubstrateUtil method printDiagnostics.
/**
* Prints extensive diagnostic information to the given Log.
*/
@RestrictHeapAccess(access = RestrictHeapAccess.Access.NO_ALLOCATION, reason = "Must not allocate during printing diagnostics.")
public static void printDiagnostics(Log log, Pointer sp, CodePointer ip) {
if (diagnosticsInProgress) {
log.string("Error: printDiagnostics already in progress.").newline();
BreakpointNode.breakpoint();
return;
}
diagnosticsInProgress = true;
log.newline();
try {
dumpJavaFrameAnchors(log);
} catch (Exception e) {
dumpException(log, "dumpJavaFrameAnchors", e);
}
try {
dumpDeoptStubPointer(log);
} catch (Exception e) {
dumpException(log, "dumpDeoptStubPointer", e);
}
try {
dumpTopFrame(log, sp, ip);
} catch (Exception e) {
dumpException(log, "dumpTopFrame", e);
}
try {
dumpVMThreads(log);
} catch (Exception e) {
dumpException(log, "dumpVMThreads", e);
}
IsolateThread currentThread = CEntryPointContext.getCurrentIsolateThread();
try {
dumpVMThreadState(log, currentThread);
} catch (Exception e) {
dumpException(log, "dumpVMThreadState", e);
}
try {
dumpRecentVMOperations(log);
} catch (Exception e) {
dumpException(log, "dumpRecentVMOperations", e);
}
dumpRuntimeCompilation(log);
try {
dumpCounters(log);
} catch (Exception e) {
dumpException(log, "dumpCounters", e);
}
try {
dumpStacktraceRaw(log, sp);
} catch (Exception e) {
dumpException(log, "dumpStacktraceRaw", e);
}
try {
dumpStacktraceStage0(log, sp, ip);
} catch (Exception e) {
dumpException(log, "dumpStacktraceStage0", e);
}
try {
dumpStacktraceStage1(log, sp, ip);
} catch (Exception e) {
dumpException(log, "dumpStacktraceStage1", e);
}
try {
dumpStacktrace(log, sp, ip);
} catch (Exception e) {
dumpException(log, "dumpStacktrace", e);
}
if (VMOperationControl.isFrozen()) {
for (IsolateThread vmThread = VMThreads.firstThread(); vmThread != VMThreads.nullThread(); vmThread = VMThreads.nextThread(vmThread)) {
if (vmThread == CEntryPointContext.getCurrentIsolateThread()) {
continue;
}
try {
dumpStacktrace(log, vmThread);
} catch (Exception e) {
dumpException(log, "dumpStacktrace", e);
}
}
}
diagnosticsInProgress = false;
}
use of org.graalvm.nativeimage.IsolateThread in project graal by oracle.
the class CEntryPointNativeFunctions method getCurrentThread.
@Uninterruptible(reason = UNINTERRUPTIBLE_REASON)
@CEntryPoint(name = "current_thread", documentation = { "Given an isolate to which the current thread is attached, returns the address of", "the thread's associated isolate thread structure. If the current thread is not", "attached to the passed isolate or if another error occurs, returns NULL." })
@CEntryPointOptions(prologue = NoPrologue.class, epilogue = NoEpilogue.class, nameTransformation = NameTransformation.class)
public static IsolateThread getCurrentThread(Isolate isolate) {
int result = CEntryPointActions.enterIsolate(isolate);
if (result != 0) {
return WordFactory.nullPointer();
}
IsolateThread thread = CEntryPointContext.getCurrentIsolateThread();
if (CEntryPointActions.leave() != 0) {
thread = WordFactory.nullPointer();
}
return thread;
}
Aggregations