Expand description
Portable, runtime-independent WebAssembly compute-quota instrumentation and shared task-level resource accounting.
Instruments standard .wasm module binaries so that compute-quota deductions
(deduct-before-effect), linear-memory and table logical vs. physical growth
checks, and interruption ordinals execute identically on any compliant
WebAssembly runtime (tinywasm, V8/Node WebAssembly, Wasmtime, etc.)
without requiring a forked WASM engine.
Structs§
- Instrumented
Wasm Module - Metadata and instrumented
.wasmbytes produced byinstrument_wasm_module_bytes. - Shared
Wasm Task Quota - Shared task-level compute and output quota tracker used to ensure that repeated or nested helper invocations within a single document evaluation task deduct from one shared allowance rather than silently replenishing quotas.
- Shared
Wasm Task Quota State - Mutable state inside a
SharedWasmTaskQuota.
Constants§
- CTB_
CAPABILITY_ YIELD_ EXPORT - Optional guest
() -> ()stub export rewritten at runtime to invokeCTB_HOST_CAPABILITY_IMPORT_NAMEso standard modules remain zero-import.wasm. - CTB_
EXHAUSTED_ EXPORT - Exported
i32global indicating interruption status:0 = none,1 = ComputeQuotaExhausted,2 = MemoryLimitExceeded,3 = TableLimitExceeded. - CTB_
HOST_ CAPABILITY_ IMPORT_ NAME - Internal host import function name used by
DcWasmSessionto suspend a live intra-step continuation for a mid-step host capability request. - CTB_
HOST_ IMPORT_ MODULE - Internal host import module name used by
DcWasmSessionto suspend and resume live intra-step continuations on compute-quota exhaustion and mid-step host capability requests. - CTB_
HOST_ SUSPEND_ IMPORT_ NAME - Internal host import function name used by
DcWasmSessionto suspend and resume live intra-step continuations on compute-quota exhaustion. - CTB_
INTERRUPTED_ OP_ EXPORT - Exported
i64global recording the 1-based ordinal of the interrupted operation (or requested total pages/elements on physical growth exhaustion). - CTB_
MAX_ MEM_ PAGES_ EXPORT - Exported
i64global holding the logical maximum 64 KiB pages (max_memory_pages). - CTB_
MAX_ TABLE_ ELEMS_ EXPORT - Exported
i64global holding the logical maximum table elements (max_table_elements). - CTB_
OP_ ORDINAL_ EXPORT - Exported
i64global tracking the 1-based ordinal of metered operations executed. - CTB_
PHYS_ MAX_ MEM_ PAGES_ EXPORT - Exported
i64global holding the physical host allocation cap in 64 KiB pages. - CTB_
PHYS_ MAX_ TABLE_ ELEMS_ EXPORT - Exported
i64global holding the physical host allocation cap in table elements. - CTB_
QUOTA_ CONSUMED_ EXPORT - Exported
i64global holding the compute quota units consumed in the current run. - CTB_
QUOTA_ REMAINING_ EXPORT - Exported
i64global holding the remaining portable compute quota units. - CTB_
REQUIRED_ COST_ EXPORT - Exported
i64global recording the compute cost required by the interrupted operation. - CTB_
RESUME_ TARGET_ OP_ EXPORT - Exported
i64global specifying the 1-based operation ordinal at which portable single-threaded continuation replay begins charging quota (0= charge from op 1). - CTB_
TOTAL_ MEM_ PAGES_ EXPORT - Exported
i64global tracking total allocated 64 KiB pages across all module memories. - CTB_
TOTAL_ TABLE_ ELEMS_ EXPORT - Exported
i64global tracking total allocated elements across all module tables. - CTB_
WASM_ START_ EXPORT - Exported function name used when a module’s
Startsection (section 8) is hoisted for explicit metered execution. - V2_
MAX_ STRAIGHT_ LINE_ OPS - Maximum straight-line non-loop/non-bulk/non-grow WASM operations permitted in V2 structural-checkpoint metering before inserting a stride checkpoint.
Functions§
- instrument_
wasm_ module_ bytes - Validates and instruments a standard WebAssembly module binary with portable
deduct-before-effectcompute-quota accounting and logical/physical memory and table growth guards.