Class GuestThreads
java.lang.Object
thc.runtime.GuestThreads
A carrier can suspend one guest in foreign code and enter a distinct bound callback.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThis is execution permission, not the observable Haskell masking state.static final classstatic final classstatic final classStable per-context/carrier cell, including between nested guest entries.static final classCarrier cells can be initialized before the Env-owned guest-thread service is patched.static interface -
Constructor Summary
ConstructorsConstructorDescriptionGuestThreads(com.oracle.truffle.api.TruffleLanguage.Env env, ThreadLocal<MaskingState> maskingState) GuestThreads(com.oracle.truffle.api.TruffleLanguage.Env env, ThreadLocal<MaskingState> maskingState, String hosting) GuestThreads(com.oracle.truffle.api.TruffleLanguage.Env env, ThreadLocal<MaskingState> maskingState, String hosting, GuestThreads.PollStates pollStates) GuestThreads(ThreadLocal<MaskingState> maskingState, CpuAffinity cpuAffinity, GuestThreads.Wake wake) GuestThreads(ThreadLocal<MaskingState> maskingState, GuestThreads.Wake wake) -
Method Summary
Modifier and TypeMethodDescriptionlongstatic GuestThreadExtentblocking(GuestThreadStatus status) No guest entry means no Haskell thread to mark (also used by cell protocol tests).longvoidstatic voidcheckpointCurrent(com.oracle.truffle.api.nodes.Node node) voidclose()voidstatic GuestThreadscurrent(com.oracle.truffle.api.nodes.Node node) longmyThreadId# observes an existing guest entry; it never creates a new lifetime.longlongenterCurrent(MaskingState inheritedMask) longenterCurrent(MaskingState inheritedMask, boolean forked) longenterCurrent(MaskingState inheritedMask, boolean forked, boolean externalAsync) longenterCurrent(MaskingState inheritedMask, boolean forked, boolean externalAsync, Long capability) Only an exact safe declaration admits callbacks.enterForeign(ForeignSafety safety) Final retirement grants no callback authority and cannot begin a new guest operation.booleanfinish(AsyncRequest request, AsyncRequestState state) booleanfinish(AsyncRequest request, AsyncRequestState state, Throwable cause) <T> TbooleanAn uncaught callback cannot carry its opaque foreign caller as a guest continuation.booleanInspect, never claim, a request while an interruptible open owns foreign execution.booleanbooleanisLoom()label(GuestThreadId identity) voidlabel(GuestThreadId identity, Object bytes) voidvoidleaveCurrent(GuestThreadStatus outcome) Called by the target in the same finally block that ends its guest action.voidleaveForeign(GuestThreads.DeliveryPermission previous) liveJavaId(GuestThreadId identity) Snapshot only: eventual dispatch checks the same identity atomically with enqueue.booleannewThread(com.oracle.truffle.api.TruffleLanguage.Env env, Runnable task, Long capability, com.oracle.truffle.api.nodes.Node node) static booleanordinaryPollEnabled(com.oracle.truffle.api.nodes.Node node) Only ordinary polls speculate.booleanpause(AsyncRequest request) Remove an uncommitted outbound throwTo while its sender handles an async exception.poll(com.oracle.truffle.api.nodes.Node node) poll(com.oracle.truffle.api.nodes.Node node, boolean interruptible) static AsyncRequestpollCurrent(com.oracle.truffle.api.nodes.Node node, boolean interruptible) Java-callable poll for bytecode roots; it never delivers from a wake action.static AsyncRequestpollCurrentWithoutYield(com.oracle.truffle.api.nodes.Node node, boolean interruptible) Used under commit/owner locks; scheduling yield happens before acquiring them.static AsyncRequestpollMandatoryCurrent(com.oracle.truffle.api.nodes.Node node, boolean interruptible) Self throwTo is synchronous even while the single-origin assumption is valid.longvoidrequireIdentity(Object value) A retained completed identity remains valid; a same-number fabricated object does not.voidresume(AsyncRequest request) Resume the same logical request after the sender's caught continuation resumes.The sender waits on this token; safepoint observation is not delivery.send(GuestThreadId identity, Object payload) voidsetAllocationCounter(long value) voidsetAllocationCounter(long value, GuestThreadId identity) voidsetCapabilityCount(long count) booleansetCurrentExternalAsync(boolean enabled) Scope host-call admission without changing queued requests or the guest lifetime.Object[]snapshot()Independent snapshot including retained completed identities under the registry lock.voidstartThread(Thread thread) status(GuestThreadId identity) void
-
Constructor Details
-
GuestThreads
-
GuestThreads
public GuestThreads(ThreadLocal<MaskingState> maskingState, CpuAffinity cpuAffinity, GuestThreads.Wake wake) -
GuestThreads
public GuestThreads(com.oracle.truffle.api.TruffleLanguage.Env env, ThreadLocal<MaskingState> maskingState) -
GuestThreads
public GuestThreads(com.oracle.truffle.api.TruffleLanguage.Env env, ThreadLocal<MaskingState> maskingState, String hosting) -
GuestThreads
public GuestThreads(com.oracle.truffle.api.TruffleLanguage.Env env, ThreadLocal<MaskingState> maskingState, String hosting, GuestThreads.PollStates pollStates)
-
-
Method Details
-
getCpuAffinity
-
isLoom
-
needsHosting
-
hostEntry
-
admissionOrigin
-
checkEntryAllowed
-
newThread
-
startThread
-
stopHostedThreads
-
pollState
-
capabilityCount
-
setCapabilityCount
-
registerMainThread
-
mainThreadRegistration
-
enterForeign
Only an exact safe declaration admits callbacks. -
enterForeign
-
enterForeignForDisposal
Final retirement grants no callback authority and cannot begin a new guest operation. -
leaveForeign
-
inForeignCallback
An uncaught callback cannot carry its opaque foreign caller as a guest continuation. -
enterCurrent
-
enterCurrent
-
enterCurrent
-
enterCurrent
-
enterCurrent
public long enterCurrent(MaskingState inheritedMask, boolean forked, boolean externalAsync, Long capability) -
registerCurrent
-
setCurrentExternalAsync
Scope host-call admission without changing queued requests or the guest lifetime. -
currentId
myThreadId# observes an existing guest entry; it never creates a new lifetime. -
currentIdentity
-
allocationCounter
-
setAllocationCounter
-
requireIdentity
A retained completed identity remains valid; a same-number fabricated object does not. -
setAllocationCounter
-
snapshot
-
isCurrentBound
-
status
-
label
-
label
-
liveJavaId
Snapshot only: eventual dispatch checks the same identity atomically with enqueue. -
send
-
send
The sender waits on this token; safepoint observation is not delivery. -
poll
-
poll
-
interruptibleForeignPending
Inspect, never claim, a request while an interruptible open owns foreign execution. -
leaveCurrent
-
leaveCurrent
Called by the target in the same finally block that ends its guest action. -
completeCurrent
-
close
-
finish
-
finish
-
pause
Remove an uncommitted outbound throwTo while its sender handles an async exception. -
resume
Resume the same logical request after the sender's caught continuation resumes. -
current
-
blocking
No guest entry means no Haskell thread to mark (also used by cell protocol tests). -
pollCurrent
public static AsyncRequest pollCurrent(com.oracle.truffle.api.nodes.Node node, boolean interruptible) Java-callable poll for bytecode roots; it never delivers from a wake action. -
ordinaryPollEnabled
Only ordinary polls speculate. Calls and their capture handlers never do. -
pollMandatoryCurrent
public static AsyncRequest pollMandatoryCurrent(com.oracle.truffle.api.nodes.Node node, boolean interruptible) Self throwTo is synchronous even while the single-origin assumption is valid. -
checkpointCurrent
-
pollCurrentWithoutYield
public static AsyncRequest pollCurrentWithoutYield(com.oracle.truffle.api.nodes.Node node, boolean interruptible) Used under commit/owner locks; scheduling yield happens before acquiring them.
-