Class LibGraalScope
java.lang.Object
com.oracle.truffle.runtime.hotspot.libgraal.LibGraalScope
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDenotes the detach action to perform when closing aLibGraalScope. -
Constructor Summary
ConstructorsConstructorDescriptionShortcut for callingLibGraalScope(DetachAction)with an argument ofLibGraalScope.DetachAction.DETACH_RUNTIME.LibGraalScope(LibGraalScope.DetachAction detachAction) Enters a scope for making calls into libgraal. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static LibGraalScopecurrent()Gets the current scope.Gets the isolate associated with this scope.static longGets the isolate thread associated with the current thread.longGets the address of the isolate thread associated with this scope.toString()
-
Constructor Details
-
LibGraalScope
public LibGraalScope()Shortcut for callingLibGraalScope(DetachAction)with an argument ofLibGraalScope.DetachAction.DETACH_RUNTIME. -
LibGraalScope
Enters a scope for making calls into libgraal. If there is no existing libgraal scope for the current thread, the current thread is attached to libgraal. When the outer most scope is closed, the current thread is detached from libgraal. This must be used in a try-with-resources statement. This cannot be called from within libgraal.- Throws:
IllegalStateException- if libgraal is unavailable orLibGraal.inLibGraal()returns true
-
-
Method Details
-
current
Gets the current scope.- Throws:
IllegalStateException- if the current thread is not in an opened scope
-
getIsolateThread
public static long getIsolateThread()Gets the isolate thread associated with the current thread. The current thread must be in an opened scope.- Returns:
- a value that can be used for the IsolateThreadContext argument of a
nativemethodlinkedto a CEntryPoint function in libgraal - Throws:
IllegalStateException- if the current thread is not attached to libgraal
-
toString
-
getIsolate
Gets the isolate associated with this scope. -
getIsolateThreadAddress
public long getIsolateThreadAddress()Gets the address of the isolate thread associated with this scope. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-