Module wasm

Module wasm 

Source
Expand description

Zero-table assembler from Dc-WASM (Dc 1927 "Begin WASM program"..Dc 1928 "End WASM program" and wasm_routine) to standard binary WebAssembly (.wasm).

Re-exports§

pub use super::wasm_quota::CTB_CAPABILITY_YIELD_EXPORT;
pub use super::wasm_quota::CTB_EXHAUSTED_EXPORT;
pub use super::wasm_quota::CTB_HOST_CAPABILITY_IMPORT_NAME;
pub use super::wasm_quota::CTB_HOST_IMPORT_MODULE;
pub use super::wasm_quota::CTB_HOST_SUSPEND_IMPORT_NAME;
pub use super::wasm_quota::CTB_INTERRUPTED_OP_EXPORT;
pub use super::wasm_quota::CTB_MAX_MEM_PAGES_EXPORT;
pub use super::wasm_quota::CTB_MAX_TABLE_ELEMS_EXPORT;
pub use super::wasm_quota::CTB_OP_ORDINAL_EXPORT;
pub use super::wasm_quota::CTB_PHYS_MAX_MEM_PAGES_EXPORT;
pub use super::wasm_quota::CTB_PHYS_MAX_TABLE_ELEMS_EXPORT;
pub use super::wasm_quota::CTB_QUOTA_CONSUMED_EXPORT;
pub use super::wasm_quota::CTB_QUOTA_REMAINING_EXPORT;
pub use super::wasm_quota::CTB_REQUIRED_COST_EXPORT;
pub use super::wasm_quota::CTB_RESUME_TARGET_OP_EXPORT;
pub use super::wasm_quota::CTB_TOTAL_MEM_PAGES_EXPORT;
pub use super::wasm_quota::CTB_TOTAL_TABLE_ELEMS_EXPORT;
pub use super::wasm_quota::CTB_WASM_START_EXPORT;
pub use super::wasm_quota::InstrumentedWasmModule;
pub use super::wasm_quota::SharedWasmTaskQuota;
pub use super::wasm_quota::SharedWasmTaskQuotaState;
pub use super::wasm_quota::instrument_wasm_module_bytes;

Structs§

DcRoutineProfileEntry
Aggregated call statistics and return tokens recorded for a Dc routine invocation when opt-in profiling (set_dc_routine_profiling_enabled) is active.
DcWasmResourceLimits
Resource budgets enforced on a DcWasmSession for portable compute quota, linear memory growth, table element capacity, single-step output slice length, cumulative session output bytes, capability request/response payloads, and trace retention.
DcWasmSession
Pure-compute WebAssembly execution state machine (step() -> StatusCode) backed by either tinywasm (with portable bytecode compute-quota instrumentation) or a bit-for-bit equivalent Guix-style compiled safe-Rust substitute.
DcWasmWatchdogLimits
Emergency host watchdog bounds that protect the host process from runaway execution or supervisor faults, distinct from the System supervisor’s logical resource policy.
WasmStartSectionTrap
Non-resource WebAssembly trap raised while executing the hoisted module start function.

Enums§

DcWasmExecutionBackend
Execution backend selection for instantiating a DcWasmSession.
WasmResourceInterruption
External resource interruption raised when a DcWasmSession exceeds a compute or memory/output budget.
WasmStepOutcome
Outcome of a single DcWasmSession::step invocation, pairing the WasmStepStatus with the DcMstring decoded from the WASM instance’s output slice in linear memory.
WasmStepStatus
Status code returned by a pure-compute WebAssembly step() quantum.

Constants§

DC_WASM_MAILBOX_HEADER_LEN
Total byte length (32) of the standard linear-memory mailbox header at 0..32.
DC_WASM_MAILBOX_INPUT_LEN
Linear-memory byte offset (4..8) holding the u32 little-endian input slice byte length.
DC_WASM_MAILBOX_INPUT_PTR
Linear-memory byte offset (0..4) holding the u32 little-endian input slice pointer.
DC_WASM_MAILBOX_MOST_RECENT_NODE_ID
Linear-memory byte offset (16..32) holding the u128 little-endian Dc 641 "Global graph system block most recent node ID at time of document creation".
DC_WASM_MAILBOX_OUTPUT_LEN
Linear-memory byte offset (12..16) holding the u32 little-endian output slice byte length.
DC_WASM_MAILBOX_OUTPUT_PTR
Linear-memory byte offset (8..12) holding the u32 little-endian output slice pointer.
DC_WASM_MIN_IO_BUFFER_OFFSET
Minimum default linear-memory byte offset (256) where the host places input/output slices, leaving 0..32 for the mailbox header and 32..256 for scratch state or small data segments.
DEFAULT_MAX_PURE_CONVERSION_STEPS
Default maximum number of step() quanta allowed in a one-shot pure conversion.
DEFAULT_MAX_WASM_CAPABILITY_PAYLOAD_BYTES
Default maximum byte length permitted for a single capability request or response payload (1 MiB).
DEFAULT_MAX_WASM_INSTRUCTIONS_PER_STEP
Default maximum number of portable WASM compute quota units permitted in a DcWasmSession.
DEFAULT_MAX_WASM_MEMORY_PAGES
Default maximum number of 64 KiB linear memory pages permitted for a DcWasmSession (16 MiB).
DEFAULT_MAX_WASM_SESSION_OUTPUT_BYTES
Default maximum cumulative output bytes permitted across a DcWasmSession (16 MiB).
DEFAULT_MAX_WASM_STEP_OUTPUT_BYTES
Default maximum byte length permitted for a single step’s output mailbox slice (4 MiB).
DEFAULT_MAX_WASM_TABLE_ELEMENTS
Default maximum number of table elements permitted across a DcWasmSession store.
DEFAULT_MAX_WASM_TRACE_BYTES
Default maximum cumulative byte length permitted for a retained execution trace buffer (16 MiB).
WASM_RESOURCE_ACCOUNTING_VERSION
Version identifier for the portable WebAssembly resource-accounting rule set.
WASM_STEP_STATUS_COMPLETE
step() return status code 0: execution or conversion completed.
WASM_STEP_STATUS_REQUEST_CAPABILITY
step() return status code 2: capability requested; provide response and call step() again.
WASM_STEP_STATUS_YIELD_FRAME
step() return status code 1: streaming frame yielded; call step() again to continue.

Functions§

assemble_wasm_instructions
Assembles a raw sequence of Dc-WASM instructions ([wasm_instr]*) into WebAssembly instruction bytes (without a module header or trailing function 0x0B).
compile_graph_substitute_snapshot_wasm_bytes
Lowers and assembles the uninstrumented canonical .wasm bytes for a discovered ctb_formats_dcdata::seed_graph::GraphWasmSubstituteSnapshot reconstructed at snapshot.pin_node_id from an ordered LedgerNode slice.
compile_graph_substitute_snapshot_wasm_bytes_with_cache
Like compile_graph_substitute_snapshot_wasm_bytes, reusing reconstructed SeedGraphIndex + DatasetRuleResolver snapshots across calls that share pin_node_id.
compile_system_subject_wasm_bytes
Lowers and assembles the uninstrumented canonical .wasm bytes for a System-graph substitute target identified by its ctb_storage_minimal::shorthand::DcShorthand.
compile_system_substitute_target_wasm_bytes
Lowers and assembles the uninstrumented canonical .wasm bytes for a discovered ctb_formats_dcdata::seed_graph::SystemWasmSubstituteTarget.
dcmstring_to_wasm
Converts a Dc-WASM document (Dc 1927 "Begin WASM program"..Dc 1928 "End WASM program" or a standalone wasm_routine) into a standard binary .wasm module using the default system graph syntax resolver.
dcmstring_to_wasm_with_resolver
Converts a Dc-WASM document (Dc 1927 "Begin WASM program"..Dc 1928 "End WASM program" or a standalone wasm_routine) into a standard binary .wasm module using the supplied SyntaxRuleResolver.
dcstring_to_wasm
Converts a DcStr containing a Dc-WASM program or wasm_routine into a standard binary .wasm module using the default system graph syntax resolver.
dcstring_to_wasm_with_resolver
Converts a DcStr containing a Dc-WASM program or wasm_routine into a standard binary .wasm module using the supplied SyntaxRuleResolver.
expand_graph_wasm_shorthands_to_dcmstring
Expands a slice of ctb_storage_minimal::shorthand::DcShorthand graph WASM tokens (resolving nested helper shorthands and standalone Routine entities) into an executable DcMstring Dc-WASM document.
is_dc_routine_profiling_enabled
Returns true when opt-in Dc routine invocation profiling is enabled.
record_dc_routine_invocation_profile
Records a single Dc routine invocation into the opt-in profiler table.
run_active_converter_step_on_dc_slice_with_quota
Executes a single ctb_formats_dcdata::seed_graph::ActiveConverterStep from sg (either a Stage 0 .WASM converter or a Stage 1 StageL Token-Dc converter compiled via the active StageL-to-WASM converter) on input_tokens under shared_quota.
run_dc_wasm_pure_conversion
Runs a pure-compute Dc-WASM conversion (Dc 1927 "Begin WASM program"..Dc 1928 "End WASM program" or wasm_routine) over input using the default syntax resolver.
run_dc_wasm_pure_conversion_with_resolver
Runs a pure-compute Dc-WASM conversion (Dc 1927 "Begin WASM program"..Dc 1928 "End WASM program" or wasm_routine) over input using the supplied SyntaxRuleResolver.
run_dc_wasm_pure_conversion_with_resolver_and_quota
Runs a pure-compute Dc-WASM conversion (Dc 1927 "Begin WASM program"..Dc 1928 "End WASM program" or wasm_routine) over input using resolver and an optional SharedWasmTaskQuota.
run_graph_converter_chain_on_dc_slice_with_quota
Executes an ordered multi-step chain of ctb_formats_dcdata::seed_graph::ActiveConverterSteps sequentially on input_tokens under a shared SharedWasmTaskQuota.
run_graph_stager_dc_2608_with_quota
Executes the System-graph StageR 3 implementation of Dc 2608 (Convert Dc string to WASM) via DcWasmSession with Option B capability support (Dc 1939 / Dc 1940), charging runtime execution to shared_quota.
run_graph_stager_dcs_routine_with_quota
Executes a System-graph StageR 3 (dcs -> dcs) routine (routine_dc, such as Dc 2608 "Convert Dc string to WASM" or f19 "Semantic Dcs to text") via DcWasmSession with Option B capability support (Dc 1939 / Dc 1940), charging runtime execution to shared_quota.
run_graph_wasm_tokens_on_dc_slice
Runs a pure-compute Dc-WASM conversion from a slice of ctb_storage_minimal::shorthand::DcShorthand tokens (such as a .WASM definition stored in the system graph) over input_tokens.
run_graph_wasm_tokens_on_dc_slice_with_quota
Runs a pure-compute Dc-WASM conversion from a slice of ctb_storage_minimal::shorthand::DcShorthand tokens over input_tokens using an optional SharedWasmTaskQuota.
run_wasm_bytes_pure_conversion_with_quota
Runs a pure-compute WebAssembly conversion from pre-assembled .wasm bytes over input using an optional SharedWasmTaskQuota.
set_dc_routine_profiling_enabled
Enables or disables opt-in Dc routine invocation profiling for harvesting frequent and expensive pure routine calls.
take_dc_routine_profile_snapshot
Drains and returns all recorded DcRoutineProfileEntry items sorted by descending cumulative execution time (total_duration_ns).