use of com.oracle.svm.core.snippets.SubstrateForeignCallTarget 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 com.oracle.svm.core.snippets.SubstrateForeignCallTarget in project graal by oracle.
the class ThreadLocalAllocation method slowPathNewArray.
/**
* Slow path of array allocation snippet.
*/
@SubstrateForeignCallTarget
private static Object slowPathNewArray(DynamicHub hub, int length) {
/*
* Length check allocates an exception and so must be hoisted away from RestrictHeapAccess
* code
*/
if (length < 0) {
throw new NegativeArraySizeException();
}
/* Allocation might cause a collection. */
final UnsignedWord gcEpoch = HeapImpl.getHeapImpl().getGCImpl().possibleCollectionPrologue();
/* Allocate the requested array. */
final Object result = slowPathNewArrayWithoutAllocating(hub, length);
/* Allow the collector to do stuff now that allocation, etc., is allowed. */
HeapImpl.getHeapImpl().getGCImpl().possibleCollectionEpilogue(gcEpoch);
return result;
}
use of com.oracle.svm.core.snippets.SubstrateForeignCallTarget in project graal by oracle.
the class ThreadLocalAllocation method slowPathNewInstance.
/**
* Slow path of instance allocation snippet.
*/
@SubstrateForeignCallTarget
private static Object slowPathNewInstance(DynamicHub hub) {
/* Allocation might cause a collection. */
final UnsignedWord gcEpoch = HeapImpl.getHeapImpl().getGCImpl().possibleCollectionPrologue();
/* Allocate the requested instance. */
final Object result = slowPathNewInstanceWithoutAllocating(hub);
/* Allow the collector to do stuff now that allocation, etc., is allowed. */
HeapImpl.getHeapImpl().getGCImpl().possibleCollectionEpilogue(gcEpoch);
return result;
}
use of com.oracle.svm.core.snippets.SubstrateForeignCallTarget in project graal by oracle.
the class PinnedAllocatorImpl method slowPathNewArray.
/* Slow path of the pinned new array allocation snippet. */
@SubstrateForeignCallTarget
private static Object slowPathNewArray(PinnedAllocatorImpl pinnedAllocator, DynamicHub hub, int length) {
/*
* Length check allocates an exception and so must be hoisted away from RestrictHeapAccess
* code
*/
if (length < 0) {
throw new NegativeArraySizeException();
}
log().string("[PinnedAllocatorImpl.slowPathNewArray: ").object(pinnedAllocator).string(" hub: ").string(hub.getName()).string(" length: ").signed(length).newline();
pinnedAllocator.ensureOpen();
ThreadLocalAllocation.Descriptor tlab = ThreadLocalAllocation.pinnedTLAB.getAddress();
Object result = ThreadLocalAllocation.allocateNewArray(hub, length, tlab, true);
/* Register the new chunks that the slow path allocation might have created as pinned. */
pinnedAllocator.pushPinnedChunks(tlab);
log().string(" ]").newline();
return result;
}
use of com.oracle.svm.core.snippets.SubstrateForeignCallTarget in project graal by oracle.
the class PinnedAllocatorImpl method slowPathNewInstance.
/* Slow path of the pinned new instance allocation snippet. */
@SubstrateForeignCallTarget
private static Object slowPathNewInstance(PinnedAllocatorImpl pinnedAllocator, DynamicHub hub) {
log().string("[PinnedAllocatorImpl.slowPathNewInstance: ").object(pinnedAllocator).string(" hub: ").string(hub.getName()).newline();
pinnedAllocator.ensureOpen();
ThreadLocalAllocation.Descriptor tlab = ThreadLocalAllocation.pinnedTLAB.getAddress();
Object result = ThreadLocalAllocation.allocateNewInstance(hub, tlab, true);
/* Register the new chunks that the slow path allocation might have created as pinned. */
pinnedAllocator.pushPinnedChunks(tlab);
log().string(" ]").newline();
return result;
}
Aggregations