public final class CEntryPointActions extends Object
CEntryPoint
.
These methods are an alternative to automatically entering and leaving a context that is passed
as a parameter, and they also enable creating an isolate or attaching a method on demand. The
methods of this class must be called from the prologue
or
epilogue
code of the entry point, or, if the entry point
method is annotated with Uninterruptible
, from that method itself.CEntryPointSetup
Modifier and Type | Method and Description |
---|---|
static void |
bailoutInPrologue()
In the prologue, stop execution and return to the entry point method's caller.
|
static void |
bailoutInPrologue(boolean value)
In the prologue, stop execution and return to the entry point method's caller with the given
return value.
|
static void |
bailoutInPrologue(double value)
In the prologue, stop execution and return to the entry point method's caller with the given
return value.
|
static void |
bailoutInPrologue(long value)
In the prologue, stop execution and return to the entry point method's caller with the given
return value.
|
static void |
bailoutInPrologue(org.graalvm.word.WordBase value)
In the prologue, stop execution and return to the entry point method's caller with the given
return value.
|
static int |
enter(org.graalvm.nativeimage.IsolateThread thread)
Enters an existing context for the current thread (for example, one created with
CEntryPointActions.enterAttachThread(org.graalvm.nativeimage.Isolate, boolean) ). |
static int |
enterAttachThread(org.graalvm.nativeimage.Isolate isolate,
boolean ensureJavaThread)
Creates a context for the current thread in the specified existing isolate, then enters that
context.
|
static int |
enterCreateIsolate(CEntryPointCreateIsolateParameters params)
Creates a new isolate, then attaches the current thread to
the created isolate, creating a context for the thread in the isolate, and then enters that
context before returning.
|
static int |
enterIsolate(org.graalvm.nativeimage.Isolate isolate)
Enters an existing context for the current thread that has already been created in the given
isolate.
|
static void |
failFatally(int code,
org.graalvm.nativeimage.c.type.CCharPointer message)
Fail in a fatal manner, such as by terminating the executing process.
|
static boolean |
isCurrentThreadAttachedTo(org.graalvm.nativeimage.Isolate isolate) |
static int |
leave()
Leaves the current thread's current context.
|
static int |
leaveDetachThread()
Leaves the current thread's current context, then discards that context.
|
static int |
leaveTearDownIsolate()
Leaves the current thread's current context, then waits for all attached threads in the
context's isolate to detach and discards that isolate entirely.
|
public static int enterCreateIsolate(CEntryPointCreateIsolateParameters params)
params
- initialization parameters.public static int enterAttachThread(org.graalvm.nativeimage.Isolate isolate, boolean ensureJavaThread)
isolate
- an existing isolate.ensureJavaThread
- when set to true, the method ensures that the
Thread
object for the newly attached thread is created. If the
parameter is set to false, a later call to one of the
JavaThreads.ensureJavaThread()
methods early after the prologue must be used
to do the initialization manually.public static int enter(org.graalvm.nativeimage.IsolateThread thread)
CEntryPointActions.enterAttachThread(org.graalvm.nativeimage.Isolate, boolean)
).thread
- existing context for the current thread.public static int enterIsolate(org.graalvm.nativeimage.Isolate isolate)
isolate
- isolate in which a context for the current thread exists.public static void bailoutInPrologue(org.graalvm.word.WordBase value)
WordBase
type.public static void bailoutInPrologue(long value)
long
, int
, short
, char
, or byte
.public static void bailoutInPrologue(double value)
double
, or can also be
float
, in which case a cast is applied.public static void bailoutInPrologue(boolean value)
boolean
.public static void bailoutInPrologue()
void
.public static int leave()
public static int leaveDetachThread()
public static int leaveTearDownIsolate()
public static void failFatally(int code, org.graalvm.nativeimage.c.type.CCharPointer message)
code
- An integer representing the cause (should be non-zero by convention).message
- A message describing the cause (may be omitted by passing
null
).public static boolean isCurrentThreadAttachedTo(org.graalvm.nativeimage.Isolate isolate)