Skip to main content

Module async_ops

Module async_ops 

Source
Expand description

FFI Trampolines for Async Operations

These extern “C” functions are called from JIT-compiled code to interact with the async execution system (event queue, alerts, etc.)

Design principles:

  • Platform-agnostic: works on Tokio and bare metal
  • No Tokio-specific async in these functions
  • All async coordination through event queue abstraction

Structs§

EventQueueOpaque
Opaque type for event queue scheduling. This allows JIT to schedule events without knowing the full EventQueue type.

Constants§

SUSPENSION_ASYNC_WAIT
Suspension state for async-wait (JoinAwait returns this to signal the JIT execution loop should hand control back to the interpreter).
SUSPENSION_RUNNING
Suspension state constants
SUSPENSION_SUSPENDED
SUSPENSION_YIELDED

Statics§

ASYNC_SCOPE_ENTER_FN
Async scope enter trampoline: fn()
ASYNC_SCOPE_EXIT_FN
Async scope exit trampoline: fn()
CANCEL_TASK_FN
Cancel trampoline: fn(future_bits: u64)
SCHEDULE_EVENT_FN
ModuleBinding function pointer for event scheduling. Set by HybridKernel when simulation starts.
SPAWN_TASK_FN
Spawn trampoline: fn(callable_bits: u64) -> u64 (returns Future bits)

Functions§

__shape_emit_alert
Emit an alert to the alert pipeline
__shape_emit_event
Push an event to the event queue
__shape_get_suspension_state
Get the current suspension state
__shape_poll_event
Poll the event queue for the next event
__shape_resume
Resume execution after suspension
__shape_schedule_event
Schedule a future event for simulation.
__shape_set_yield_threshold
Set the yield threshold for cooperative scheduling
__shape_should_yield
Check if JIT code should yield for cooperative scheduling
__shape_suspend
Suspend execution waiting for a specific event type
__shape_yield
Mark the context as yielded
jit_async_scope_enter
Enter an async scope (structured concurrency boundary).
jit_async_scope_exit
Exit an async scope (structured concurrency boundary).
jit_cancel_task
Cancel a running task by its future ID.
jit_join_await
Await a task group, suspending JIT execution.
jit_join_init
Initialize a join group from task futures.
jit_spawn_task
Spawn a new async task.
register_async_task_fns
Register all async task trampolines.
register_schedule_event_fn
Register the schedule function for JIT calls.
unregister_async_task_fns
Clear all async task trampoline registrations.
unregister_schedule_event_fn
Clear the schedule function registration.