Skip to main content

Crate nub_arch_x86_abi

Crate nub_arch_x86_abi 

Source
Expand description

Wire format for the host ↔ guest “run this PVM program” RPC.

Personality-agnostic: the host pre-publishes each state object it wants the guest to see via the FN_ID_NUB_PUT_CAP RPC — the payload is opaque bytes whose encoding the guest personality defines (JAVM: an rkyv-archived javm_cap::Cap landing in javm-guest-x86’s heap-resident directory) — then ships a fixed-size InvokePacket referencing the published root object by hash on every call. The invoke packet is #[repr(C)] bytes (no codec); the response is rkyv-archived (InvocationResult).

Structs§

ArchivedInvocationResult
An archived InvocationResult
InvocationResult
Invocation result. Both backends produce this shape on completion; rkyv-archived on the wire from the cached path’s response.
InvocationResultResolver
The resolver for an archived InvocationResult
InvokePacket
Fixed-layout invocation packet. Sent as raw #[repr(C)] bytes via the existing rkyv Request envelope (its payload field). The guest reads the bytes directly with core::ptr::read_unaligned.
ParallelInvokeSlot
One host<->guest invoke slot. Slots are addressed by lane index at parallel_slot_base + lane * PARALLEL_INVOKE_SLOT_BYTES.

Constants§

FN_ID_NUB_EVICT_JIT_ALL
fn_id for the bench-only “evict the entire JIT compile cache” RPC. Empty payload; empty response. Used by javm-bench to force each criterion iteration to pay the recompile cost (otherwise the JIT cache turns the loop into pure warm-cache execute, which isn’t what we want to measure for PolkaVM-shaped workloads).
FN_ID_NUB_HEAP_STATS
fn_id for the nub_heap_stats diagnostic. Payload is empty; response is 32 bytes packing four LE u64s (allocated_bytes, allocation_count, fragment_count, available_bytes).
FN_ID_NUB_INVOKE_CACHED
fn_id for the cache-based RPC. Payload is a InvokePacket (host-side #[repr(C)] bytes, no rkyv); the guest dereferences cache VAs by root_hash lookup, runs the JIT, and replies with rkyv-archived InvocationResult.
FN_ID_NUB_INVOKE_WORKER
fn_id for a long-lived per-vCPU invoke worker. Payload is a little-endian u32 lane index. The function does not use the legacy rkyv response ring; it polls that lane’s ParallelInvokeSlot in scratch memory, runs invokes with run_top_on_lane, and writes results back into the same slot.
FN_ID_NUB_PUT_CAP
fn_id for the “publish a state object” RPC.
MAX_EXECUTION_LANES
Maximum fixed execution lanes the guest runtime can address. The production default vCPU pool is capped lower, but host configuration must not exceed this ABI-visible lane table size.
PARALLEL_INVOKE_SLOT_BYTES
PARALLEL_INVOKE_STATUS_DONE
PARALLEL_INVOKE_STATUS_EMPTY
PARALLEL_INVOKE_STATUS_EVICT_JIT_READY
PARALLEL_INVOKE_STATUS_READY
PARALLEL_INVOKE_STATUS_RUNNING
PARALLEL_INVOKE_STATUS_STARTING
PARALLEL_INVOKE_STATUS_STOP
SCRATCHPAD_HEAD_LEN
Bytes of the running Instance’s scratchpad (slot[0]) region surfaced at the top-level HALT — a fixed-size head of the returned DataCap’s effective content. The guest writes its result into the scratchpad-mapped memory region during the run (CoW into the cap); at top HALT the engine reads the region’s effective bytes back out here, so the host observes the full, uncompressed result without a separate data-flow event.

Type Aliases§

CapHash
32-byte content hash of a published state object (the legacy name from when the only personality was the JAVM cap system — matches nub_kernel::ObjHash and, byte-wise, javm_cap::CapHash; kept as a local alias so this crate stays dependency-free).