use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class CEntryPointNativeFunctions method tearDownIsolate.
@Uninterruptible(reason = UNINTERRUPTIBLE_REASON)
@CEntryPoint(name = "tear_down_isolate", documentation = { "Tears down the passed isolate, waiting for any attached threads to detach from", "it, then discards the isolate's objects, threads, and any other state or context", "that is associated with it.", "Returns 0 on success, or a non-zero value on failure." })
@CEntryPointOptions(prologue = NoPrologue.class, epilogue = NoEpilogue.class, nameTransformation = NameTransformation.class)
public static int tearDownIsolate(Isolate isolate) {
int result = CEntryPointActions.enterAttachThread(isolate);
if (result != 0) {
CEntryPointActions.leave();
return result;
}
result = CEntryPointActions.leaveTearDownIsolate();
return result;
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class CEntryPointNativeFunctions method attachThread.
@Uninterruptible(reason = UNINTERRUPTIBLE_REASON)
@CEntryPoint(name = "attach_thread", documentation = { "Attaches the current thread to the passed isolate.", "On failure, returns a non-zero value. On success, writes the address of the", "created isolate thread structure to the passed pointer and returns 0.", "If the thread has already been attached, the call succeeds and also provides", "the thread's isolate thread structure." })
@CEntryPointOptions(prologue = NoPrologue.class, epilogue = NoEpilogue.class, nameTransformation = NameTransformation.class)
public static int attachThread(Isolate isolate, IsolateThreadPointer thread) {
int result = CEntryPointActions.enterAttachThread(isolate);
if (result == 0) {
thread.write(CEntryPointContext.getCurrentIsolateThread());
result = CEntryPointActions.leave();
}
return result;
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class CEntryPointNativeFunctions method getCurrentIsolate.
@Uninterruptible(reason = UNINTERRUPTIBLE_REASON)
@CEntryPoint(name = "current_isolate", documentation = { "Given an isolate thread structure for the current thread, determines to which", "isolate it belongs and returns the address of its isolate structure. If an", "error occurs, returns NULL instead." })
@CEntryPointOptions(prologue = NoPrologue.class, epilogue = NoEpilogue.class, nameTransformation = NameTransformation.class)
public static Isolate getCurrentIsolate(IsolateThread thread) {
int result = CEntryPointActions.enter(thread);
if (result != 0) {
return WordFactory.nullPointer();
}
Isolate isolate = CEntryPointContext.getCurrentIsolate();
if (CEntryPointActions.leave() != 0) {
isolate = WordFactory.nullPointer();
}
return isolate;
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class PthreadThreadLocal method initialize.
@Uninterruptible(reason = "Called from uninterruptible code. Too early for safepoints.")
public void initialize() {
CIntPointer keyPtr = StackValue.get(SizeOf.get(CIntPointer.class));
PthreadVMLockSupport.checkResult(Pthread.pthread_key_create(keyPtr, WordFactory.nullPointer()), "pthread_key_create");
key = keyPtr.read();
}
use of com.oracle.svm.core.annotate.Uninterruptible in project graal by oracle.
the class DarwinSubstitutions method nanoTime.
@Substitute
@Uninterruptible(reason = "Does basic math after a few simple system calls")
private static long nanoTime() {
final Util_java_lang_System utilJavaLangSystem = ImageSingletons.lookup(Util_java_lang_System.class);
if (utilJavaLangSystem.fastTime) {
return mach_absolute_time();
}
if (!utilJavaLangSystem.timeBaseValid) {
MachTimebaseInfo timeBaseInfo = StackValue.get(SizeOf.get(MachTimebaseInfo.class));
if (mach_timebase_info(timeBaseInfo) == 0) {
if (timeBaseInfo.getdenom() == 1 && timeBaseInfo.getnumer() == 1) {
utilJavaLangSystem.fastTime = true;
return mach_absolute_time();
}
utilJavaLangSystem.factor = (double) timeBaseInfo.getnumer() / (double) timeBaseInfo.getdenom();
}
utilJavaLangSystem.timeBaseValid = true;
}
if (utilJavaLangSystem.factor != 0) {
return (long) (mach_absolute_time() * utilJavaLangSystem.factor);
}
/* High precision time is not available, fall back to low precision. */
timeval timeval = StackValue.get(SizeOf.get(timeval.class));
timezone timezone = WordFactory.nullPointer();
gettimeofday(timeval, timezone);
return timeval.tv_sec() * 1_000_000_000L + timeval.tv_usec() * 1_000L;
}
Aggregations