abla/runtime/platform/wasm
Generated from source.
Source module; follow its importing module's re-export links.
Source: abla/runtime/platform/wasm.ab
ablaRuntimeWasmHeapBase (extern)
trusted noescape extern:"intrinsic" fun ablaRuntimeWasmHeapBase(): int
Returns the initial byte address of the guest heap.
ablaRuntimeWasmMemorySize (extern)
trusted noescape extern:"intrinsic" fun ablaRuntimeWasmMemorySize(): int
Returns the current WebAssembly linear memory size in 64 KiB pages.
ablaRuntimeWasmMemoryGrow (extern)
trusted noescape extern:"intrinsic" fun ablaRuntimeWasmMemoryGrow(
pages: int
): int
Grows linear memory by the requested pages and returns the previous page count or -1 if growth fails.
__ablaRuntimePlatformMutexBytes (fun)
@inline
trusted fun __ablaRuntimePlatformMutexBytes(): int
A Wasm guest is single-threaded: there is no thread to race the heap, so the mutex hooks only validate their argument and threads cannot be created. Single-threaded guests keep the host's slot size so runtime layouts match.
__ablaRuntimePlatformMutexInitialize (fun)
trusted fun __ablaRuntimePlatformMutexInitialize(address: int): void
Validates the guest mutex address and traps if it is zero.
__ablaRuntimePlatformMutexLock (fun)
trusted fun __ablaRuntimePlatformMutexLock(address: int): void
Validates the guest lock address and traps if it is zero.
__ablaRuntimePlatformMutexLockBlocking (fun)
trusted fun __ablaRuntimePlatformMutexLockBlocking(address: int): void
Validates the guest blocking-lock address and traps if it is zero.
__ablaRuntimePlatformMutexUnlock (fun)
trusted fun __ablaRuntimePlatformMutexUnlock(address: int): void
Validates the guest unlock address and traps if it is zero.
__ablaRuntimePlatformMutexDestroy (fun)
trusted fun __ablaRuntimePlatformMutexDestroy(address: int): void
Validates the guest mutex address for destruction and traps if it is zero.
__ablaRuntimePlatformThreadCreate (fun)
trusted fun __ablaRuntimePlatformThreadCreate(
handle: int,
entry: int,
argument: int
): bool
Returns false because the guest cannot start threads and traps if any argument address is zero.
__ablaRuntimePlatformThreadJoin (fun)
trusted fun __ablaRuntimePlatformThreadJoin(handle: int): bool
Returns false because the guest has no joinable threads and traps for a zero handle.
__ablaRuntimePlatformThreadsEnable (fun)
trusted fun __ablaRuntimePlatformThreadsEnable(): void
Leaves the guest in its single-threaded execution mode.
__ablaRuntimePlatformMemoryDebugHold (fun)
trusted fun __ablaRuntimePlatformMemoryDebugHold(mode: int): int
Returns zero because the guest has no host collector lock to hold.
__ablaRuntimePlatformNativeEnter (fun)
trusted fun __ablaRuntimePlatformNativeEnter(): void
Keeps the single guest thread registered when it enters a native boundary.
__ablaRuntimePlatformNativeLeave (fun)
trusted fun __ablaRuntimePlatformNativeLeave(): void
Leaves guest thread registration unchanged after a native boundary.
__ablaRuntimePlatformNativeLeaveIfIn (fun)
trusted fun __ablaRuntimePlatformNativeLeaveIfIn(): bool
Returns false because the guest tracks no native thread boundaries.
__ablaRuntimePlatformThreadRegister (fun)
trusted fun __ablaRuntimePlatformThreadRegister(): void
Keeps the single guest thread as the only registered thread.
__ablaRuntimePlatformThreadUnregister (fun)
trusted fun __ablaRuntimePlatformThreadUnregister(): void
Leaves the guest's sole thread registration unchanged.
__ablaRuntimePlatformThreadSignalStackEnter (fun)
trusted fun __ablaRuntimePlatformThreadSignalStackEnter(): int
No thread starts, so none needs its own signal stack.
__ablaRuntimePlatformThreadSignalStackLeave (fun)
trusted fun __ablaRuntimePlatformThreadSignalStackLeave(stack: int): void
Leaves guest state unchanged because the guest has no per-thread signal stack.
__ablaRuntimePlatformMemoryRelease (fun)
trusted fun __ablaRuntimePlatformMemoryRelease(): void
The guest's memory does not shrink.
__ablaRuntimePlatformUnalignedWords (fun)
@inline
trusted fun __ablaRuntimePlatformUnalignedWords(): bool
No thread ever runs beside the guest's one. Wasm reads words aligned or byte by byte.
__ablaRuntimePlatformThreadsEnabled (fun)
@inline
trusted fun __ablaRuntimePlatformThreadsEnabled(): bool
Returns false because the guest runs on one thread.
__ablaRuntimePlatformConditionBytes (fun)
@inline
trusted fun __ablaRuntimePlatformConditionBytes(): int
What the runtime's transactions (self/entry.ab) need from the platform. One thread: a transaction runs directly and is never abandoned.
__ablaRuntimePlatformConditionInitialize (fun)
trusted fun __ablaRuntimePlatformConditionInitialize(address: int): void
Accepts the condition slot without allocating a host condition variable.
__ablaRuntimePlatformConditionWait (fun)
trusted fun __ablaRuntimePlatformConditionWait(condition: int, mutex: int): void
Traps because the single-threaded guest cannot wait on a condition.
__ablaRuntimePlatformConditionBroadcast (fun)
trusted fun __ablaRuntimePlatformConditionBroadcast(condition: int): void
Completes immediately because the guest has no other threads to wake.
__ablaRuntimePlatformRawAllocate (fun)
trusted fun __ablaRuntimePlatformRawAllocate(size: int): int
Allocates and clears a raw guest buffer, returning its linear-memory address.
__ablaRuntimePlatformRawFree (fun)
trusted fun __ablaRuntimePlatformRawFree(address: int): void
Returns a nonzero raw buffer to the guest allocator.
__ablaRuntimePlatformOnlyThread (fun)
@inline
trusted fun __ablaRuntimePlatformOnlyThread(): bool
Returns true for the single-threaded guest.
__ablaRuntimeWasmStmDescriptor (var)
var __ablaRuntimeWasmStmDescriptor: int
Holds the current transaction descriptor address for the guest.
__ablaRuntimePlatformStmDescriptor (fun)
@inline
trusted fun __ablaRuntimePlatformStmDescriptor(): int
Returns the current guest transaction descriptor address or zero if unset.
__ablaRuntimePlatformStmSetDescriptor (fun)
trusted fun __ablaRuntimePlatformStmSetDescriptor(descriptor: int): void
Stores the current guest transaction descriptor address.
__ablaRuntimePlatformGlobalLock (fun)
@inline
trusted fun __ablaRuntimePlatformGlobalLock(): int
Returns the guest's zero lock token without waiting.
__ablaRuntimePlatformGlobalUnlock (fun)
@inline
trusted fun __ablaRuntimePlatformGlobalUnlock(lock: int): void
Accepts the guest lock token with no synchronization required.
__ablaRuntimePlatformRootBytes (fun)
@inline
trusted fun __ablaRuntimePlatformRootBytes(): int
wasm32 root frames hold 4-byte value addresses (__ablaRuntimeRootsPush).
__ablaRuntimePlatformRootStore (fun)
@inline
trusted fun __ablaRuntimePlatformRootStore(roots: int, index: int, value: int): void
Writes a 32-bit value address into an indexed slot in a guest root list.
__ablaRuntimePlatformRootsSet (fun)
@inline
trusted fun __ablaRuntimePlatformRootsSet(frame: int, roots: int, count: int): void
Replaces a root frame's root list address and entry count.
__ablaRuntimePlatformAttempt (fun)
trusted fun __ablaRuntimePlatformAttempt(closure: int, output: int, slot: int): bool
Runs a transaction closure directly and returns false to indicate that it completed.
__ablaRuntimePlatformAbandon (fun)
trusted fun __ablaRuntimePlatformAbandon(slot: int): never
Traps if a direct guest transaction attempts to abandon execution.
__ablaRuntimePlatformUnwindSave (fun)
trusted fun __ablaRuntimePlatformUnwindSave(at: int): void
Leaves the save area unused when transactions run without guest exceptions.
__ablaRuntimePlatformUnwindRestore (fun)
trusted fun __ablaRuntimePlatformUnwindRestore(at: int): void
Leaves the guest's root frame and region unchanged in direct transaction mode.
abla_stm_invoke (extern)
trusted noescape extern:"c" fun abla_stm_invoke(
closure: i64*,
output: i64*,
slot: i64*
): int
Generated with the module (bootstrapLlvmDefineStmInvoke): one attempt of a transaction's body under a catch_all, 1 when it was abandoned; and the throw that abandons it.
abla_stm_throw (extern)
trusted noescape extern:"c" fun abla_stm_throw(): void
Raises the generated WebAssembly exception that abandons a transaction attempt.
__ablaRuntimePlatformUnwindingAttempt (fun)
trusted fun __ablaRuntimePlatformUnwindingAttempt(closure: int, output: int, slot: int): bool
Runs the closure under a WebAssembly exception handler and returns true if it abandons the attempt.
__ablaRuntimePlatformUnwindingAbandon (fun)
trusted fun __ablaRuntimePlatformUnwindingAbandon(slot: int): never
Leaves the innermost attempt (the one slot belongs to: a nested one is left before its outer one), from any depth of its body.
__ablaRuntimePlatformUnwindingSave (fun)
trusted fun __ablaRuntimePlatformUnwindingSave(at: int): void
The root frames and region, saved before an attempt and restored when it is abandoned: what its body pushed is left with its stack (whose pointer the catch restores).
__ablaRuntimePlatformUnwindingRestore (fun)
trusted fun __ablaRuntimePlatformUnwindingRestore(at: int): void
Restores the guest root-frame chain and active region from a saved attempt.
__ablaRuntimeWasmHeapCursor (var)
var __ablaRuntimeWasmHeapCursor: int
--- linear-memory block allocator ----------------------------------------- The guest's malloc/free. Every block carries a 16-byte header whose first word is either a size-class index (< 64) or, for large blocks, the payload capacity in bytes (>= 1 MiB), so payloads stay 16-byte aligned. Small requests use segregated free lists: 16-byte steps up to 256 bytes, then four classes per doubling (320, 384, 448, 512, 640, ...) up to 1 MiB, so a block is at most a quarter bigger than its request (with powers of two, a 300 KiB array took 512 KiB). Larger requests are 64 KiB-granular blocks kept on a first-fit list that splits oversized hits. Fresh blocks come from a bump cursor that grows linear memory; freed blocks are only ever reused, because Wasm memory cannot shrink. Before a small request would grow memory while much is parked on the class lists, those blocks are sorted by address and physically adjacent runs merge into spans any class can carve from (a burst of one size, freed, then serves the others instead of memory growing).
__ablaRuntimeWasmHeapLimit (var)
var __ablaRuntimeWasmHeapLimit: int
Holds the byte boundary currently available in linear memory.
__ablaRuntimeWasmFreeLists (var)
var __ablaRuntimeWasmFreeLists: int
Holds the base address of the guest allocator's small-block free lists.
__ablaRuntimeWasmLargeFree (var)
var __ablaRuntimeWasmLargeFree: int
Holds the head of the free list for large guest blocks.
__ablaRuntimeWasmParked (var)
var __ablaRuntimeWasmParked: int
Bytes (with headers) parked on the free lists (small and large), and the parked level at which the next reclaim runs.
__ablaRuntimeWasmReclaimAt (var)
var __ablaRuntimeWasmReclaimAt: int
Holds the number of parked bytes at which the next reclaim is attempted.
__ablaRuntimeWasmReclaimStep (var)
var __ablaRuntimeWasmReclaimStep: int
How much more must be parked after a reclaim before the next. A memory limit lowers both (runtimeMemorySetLimit): a microcontroller's whole heap may be smaller than these defaults, and would run out with its memory parked.
__ablaRuntimeWasmReclaims (var)
var __ablaRuntimeWasmReclaims: int
Counts reclamation passes over guest free blocks.
__ablaRuntimeWasmReclaimsByBitmap (var)
var __ablaRuntimeWasmReclaimsByBitmap: int
Counts the reclaims that ordered the parked blocks with the bitmap (__ablaRuntimeWasmReclaimBitmap) rather than a sort.
__ablaRuntimeWasmReclaimMerged (var)
var __ablaRuntimeWasmReclaimMerged: int
Counts the merged blocks found while reclaiming guest free space.
__ablaRuntimeWasmSpanCursor (var)
var __ablaRuntimeWasmSpanCursor: int
The span being carved [cursor, end) and the list of further spans, each starting with [next span, end].
__ablaRuntimeWasmSpanEnd (var)
var __ablaRuntimeWasmSpanEnd: int
Holds the exclusive end of the free span currently supplying blocks.
__ablaRuntimeWasmSpans (var)
var __ablaRuntimeWasmSpans: int
Holds the head of the list of free spans available to carve.
__ablaRuntimeWasmSpanMinimum (val)
val __ablaRuntimeWasmSpanMinimum: int
Sets the minimum size of a reclaimed span used for block allocation.
__ablaRuntimeWasmClassCount (val)
val __ablaRuntimeWasmClassCount: int
Gives the number of small-block size classes.
__ablaRuntimeWasmLargeMinimum (val)
val __ablaRuntimeWasmLargeMinimum: int
Sets the smallest payload handled by the large-block allocator.
__ablaRuntimeWasmLargeGranule (val)
val __ablaRuntimeWasmLargeGranule: int
Gives the byte alignment increment for large-block capacities.
__ablaRuntimeWasmMemoryMaximum (val)
val __ablaRuntimeWasmMemoryMaximum: int
Sets the highest representable byte boundary for wasm32 linear memory.
__ablaRuntimeWasmBump (fun)
trusted fun __ablaRuntimeWasmBump(bytes: int): int
Reserves bytes at the heap cursor, growing linear memory as needed and trapping if the request cannot fit.
__ablaRuntimeWasmClassBytes (fun)
@inline
trusted fun __ablaRuntimeWasmClassBytes(sizeClass: int): int
Returns the payload capacity represented by the supplied small-block size class.
__ablaRuntimeWasmBlockBytes (fun)
@inline
trusted fun __ablaRuntimeWasmBlockBytes(kind: int): int
A block's payload bytes from its header word (a size class or a large capacity).
__ablaRuntimeWasmClassOf (fun)
trusted fun __ablaRuntimeWasmClassOf(size: int): int
Returns the small-block size class that can fit the requested byte size.
__ablaRuntimeWasmShatter (fun)
trusted fun __ablaRuntimeWasmShatter(begin: int, end: int): void
Park [begin, end) on the class lists as the largest blocks that fit.
__ablaRuntimeWasmSpanCarve (fun)
trusted fun __ablaRuntimeWasmSpanCarve(bytes: int): int
A block of bytes from the reclaimed spans (0 when they are used up).
__ablaRuntimeWasmSortBuckets (var)
var __ablaRuntimeWasmSortBuckets: int
The reclaim's address buckets: [head, tail] list pairs, bumped once and reused.
__ablaRuntimeWasmSortBucketCount (val)
val __ablaRuntimeWasmSortBucketCount: int
Gives the number of radix buckets used to sort guest block addresses.
__ablaRuntimeWasmSortByAddress (fun)
trusted fun __ablaRuntimeWasmSortByAddress(list: int): int
Sort a list of free payloads (linked through their first word) by address (when __ablaRuntimeWasmReclaimBitmap gives no bitmap): dealt into buckets that each cover a narrow slice of the heap, each bucket merge-sorted, the buckets joined in order. One merge sort over the whole list chased every block across the heap once per pass; a bucket's blocks sit close together, so its passes stay in cache.
__ablaRuntimeWasmReclaimBitmap (fun)
trusted fun __ablaRuntimeWasmReclaimBitmap(): int
The bitmap a reclaim can order the parked blocks with, in the collector's scratch block (idle between collections, kept from the last one): one bit per 16-byte granule of the heap, cleared. 0 when the scratch is missing, in use or too small: the reclaim then sorts.
__ablaRuntimeWasmReclaimRun (fun)
trusted fun __ablaRuntimeWasmReclaimRun(runBegin: int, runEnd: int): void
Settle one run [runBegin, runEnd) of physically adjacent parked blocks: a large block or more becomes one large free block, a span or more a span, and a shorter run goes back on its class lists block by block, in address order.
__ablaRuntimeWasmSortFree (fun)
trusted fun __ablaRuntimeWasmSortFree(list: int): int
Sort a list of free payloads (linked through their first word) by address.
__ablaRuntimeWasmReclaim (fun)
trusted fun __ablaRuntimeWasmReclaim(): void
Merge physically adjacent parked blocks (small and large): runs of a large block or more become one large free block, runs of a span or more spans, and shorter runs go back on their class lists.
__ablaRuntimeWasmMalloc (fun)
trusted fun __ablaRuntimeWasmMalloc(requested: int): int
Returns an aligned reusable guest block address or traps if the request cannot fit.
__ablaRuntimeWasmMallocFree (fun)
trusted fun __ablaRuntimeWasmMallocFree(address: int): void
Returns a guest block to the appropriate free list and updates parked bytes.
__ablaRuntimeWasmAllocationHead (var)
var __ablaRuntimeWasmAllocationHead: int
--- tracked heap + precise collector ---------------------------------------- A port of the hosted runtime's collector (platform/host.ab) onto the block allocator above. Tracked allocations form an intrusive list behind a 32-byte header [previous, next, size, layout-or-region]; the collector marks from compiler-published root frames using each allocation's layout, then frees everything unmarked. Collection only happens at explicit or pressure-triggered safe points inside functions the compiler rooted.
__ablaRuntimeWasmAllocationTail (var)
var __ablaRuntimeWasmAllocationTail: int
Holds the last header in the tracked-allocation list.
__ablaRuntimeWasmAllocationCount (var)
var __ablaRuntimeWasmAllocationCount: int
Counts currently tracked guest allocations.
__ablaRuntimeWasmLiveBytes (var)
var __ablaRuntimeWasmLiveBytes: int
Counts current tracked guest payload bytes.
__ablaRuntimeWasmLivePeak (var)
var __ablaRuntimeWasmLivePeak: int
Records the largest tracked guest payload byte count so far.
__ablaRuntimeWasmCollections (var)
var __ablaRuntimeWasmCollections: int
Counts completed garbage collections.
__ablaRuntimeWasmLimit (var)
var __ablaRuntimeWasmLimit: int
Holds the current upper byte limit on tracked guest memory.
__ablaRuntimeWasmRegionCache (var)
var __ablaRuntimeWasmRegionCache: int
Holds the head of the free list of reusable allocation-region descriptors.
__ablaRuntimeWasmRegionCacheCount (var)
var __ablaRuntimeWasmRegionCacheCount: int
Counts cached allocation-region descriptors.
__ablaRuntimeWasmRegionPageCache (var)
var __ablaRuntimeWasmRegionPageCache: int
Holds the head of the free list of reusable allocation-region pages.
__ablaRuntimeWasmRegionPageCacheCount (var)
var __ablaRuntimeWasmRegionPageCacheCount: int
Counts cached allocation-region pages.
__ablaRuntimeWasmCollectionEnabled (var)
var __ablaRuntimeWasmCollectionEnabled: bool
Controls whether allocation pressure can trigger a collection.
__ablaRuntimeWasmCollectionThreshold (var)
var __ablaRuntimeWasmCollectionThreshold: int
Holds the live-byte threshold for the next pressure-triggered collection.
__ablaRuntimeWasmCollectionGrowth (var)
var __ablaRuntimeWasmCollectionGrowth: int
Least growth of the tracked heap past what a collection kept before the next.
__ablaRuntimeWasmCollectionIndex (var)
var __ablaRuntimeWasmCollectionIndex: int
Holds the base of the temporary collection hash table keyed by payload address.
__ablaRuntimeWasmCollectionCount (var)
var __ablaRuntimeWasmCollectionCount: int
Holds the number of allocation ranges indexed for the current collection.
__ablaRuntimeWasmCollectionIndexCapacity (var)
var __ablaRuntimeWasmCollectionIndexCapacity: int
Holds the current capacity of the collection hash table.
__ablaRuntimeWasmCollectionMinimum (var)
var __ablaRuntimeWasmCollectionMinimum: int
Holds the lower byte bound of allocations considered during marking.
__ablaRuntimeWasmCollectionMaximum (var)
var __ablaRuntimeWasmCollectionMaximum: int
Holds the upper byte bound of allocations considered during marking.
__ablaRuntimeWasmCollectionWorklist (var)
var __ablaRuntimeWasmCollectionWorklist: int
Holds the address of the mark worklist.
__ablaRuntimeWasmCollectionWorklistCount (var)
var __ablaRuntimeWasmCollectionWorklistCount: int
Counts allocation headers awaiting tracing on the mark worklist.
__ablaRuntimeWasmCollectionRanges (var)
var __ablaRuntimeWasmCollectionRanges: int
Holds the address of the temporary sorted allocation-range table.
__ablaRuntimeWasmCollectionScratch (var)
var __ablaRuntimeWasmCollectionScratch: int
Holds the temporary buffer used by the guest collector.
__ablaRuntimeWasmCollectionScratchBytes (var)
var __ablaRuntimeWasmCollectionScratchBytes: int
Holds the size of the guest collector's temporary buffer in bytes.
__ablaRuntimeWasmRootFrame (var)
var __ablaRuntimeWasmRootFrame: int
Head of the compiler's root-frame chain and the active region. The guest has one thread, so these are plain globals rather than thread-local cells.
__ablaRuntimeWasmRegion (var)
var __ablaRuntimeWasmRegion: int
Holds the active guest allocation-region descriptor or zero outside one.
__ablaRuntimeWasmRegionCachedDescriptors (val)
val __ablaRuntimeWasmRegionCachedDescriptors: int
Caps the number of freed region descriptors kept in the cache.
__ablaRuntimeWasmRegionPageBytes (val)
val __ablaRuntimeWasmRegionPageBytes: int
Sets the standard allocation-region page size in bytes.
__ablaRuntimeWasmRegionCachedPages (val)
val __ablaRuntimeWasmRegionCachedPages: int
A few pages stay cached for the next region; more go back to the allocator (a burst's pages would otherwise stay pinned, as linear memory never shrinks).
__ablaRuntimeWasmUnlink (fun)
trusted fun __ablaRuntimeWasmUnlink(header: int): void
Removes a header from the tracked-allocation list and updates its accounting.
__ablaRuntimeWasmScratchAt (fun)
@inline
trusted fun __ablaRuntimeWasmScratchAt(base: int, index: int): int
Collector scratch entries are wasm32 addresses, 4 bytes each.
__ablaRuntimeWasmScratchPut (fun)
@inline
trusted fun __ablaRuntimeWasmScratchPut(base: int, index: int, value: int): void
Writes a 32-bit value into an indexed collection scratch slot.
__ablaRuntimeWasmCollectionIndexSlot (fun)
@inline
trusted fun __ablaRuntimeWasmCollectionIndexSlot(payload: int): int
Returns the hashed slot for a tracked payload in the collection index.
__ablaRuntimeWasmCollectionIndexInsert (fun)
@inline
trusted fun __ablaRuntimeWasmCollectionIndexInsert(header: int): void
Indexes the given allocation header by its payload address.
__ablaRuntimeWasmCollectionRangesSort (fun)
trusted fun __ablaRuntimeWasmCollectionRangesSort(count: int): void
Tracked headers are 16-byte aligned 32-bit addresses. Stable radix passes order the remaining 28 bits for interior-pointer lookup. Until marking starts, the empty worklist doubles as the scatter buffer. Sorts the range index by header address, borrowing the unfilled hash table for its histogram.
__ablaRuntimeWasmCollectionContaining (fun)
@inline
trusted fun __ablaRuntimeWasmCollectionContaining(candidate: int): int
Returns the header of an allocation containing the address or zero when none matches.
__ablaRuntimeWasmRegionPageAcquire (fun)
trusted fun __ablaRuntimeWasmRegionPageAcquire(minimum: int): int
Region pages carry a 32-byte control header: next, capacity, used, and reserved. Region objects are bump-allocated after it and reclaimed together when their region ends.
__ablaRuntimeWasmRegionPagesRelease (fun)
trusted fun __ablaRuntimeWasmRegionPagesRelease(pageAddress: int): void
Returns a chain of region pages to the cache or guest allocator.
__ablaRuntimeWasmRegionAllocate (fun)
trusted fun __ablaRuntimeWasmRegionAllocate(size: int): int
Returns an address in the active region, acquiring a new page if needed.
__ablaRuntimeWasmTrackedAllocate (fun)
trusted fun __ablaRuntimeWasmTrackedAllocate(size: int, layout: int): int
Allocates and records a guest payload with its layout and returns its address.
__ablaRuntimePlatformAllocateLayout (fun)
trusted fun __ablaRuntimePlatformAllocateLayout(
requested: int,
layout: int
): int
Returns a guest allocation tagged with its layout, trapping when allocation exceeds its bounds.
__ablaRuntimePlatformAllocate (fun)
@inline
trusted fun __ablaRuntimePlatformAllocate(requested: int): int
Returns a guest allocation with the default boxed layout.
__ablaRuntimePlatformFree (fun)
trusted fun __ablaRuntimePlatformFree(address: int): void
Releases a tracked guest allocation and removes it from allocation accounting.
__ablaRuntimePlatformMemoryCheckpoint (fun)
trusted fun __ablaRuntimePlatformMemoryCheckpoint(): int
A marker allocation (layout 12) the collector keeps; see the host runtime.
__ablaRuntimePlatformMemoryReset (fun)
trusted fun __ablaRuntimePlatformMemoryReset(checkpoint: int): void
Releases tracked allocations made after the checkpoint.
__ablaRuntimePlatformMemoryLiveBytes (fun)
trusted fun __ablaRuntimePlatformMemoryLiveBytes(): int
Returns the current tracked payload bytes in the guest heap.
__ablaRuntimePlatformMemoryHeapStat (fun)
trusted fun __ablaRuntimePlatformMemoryHeapStat(which: int): int
Allocator numbers for diagnostics: 0 linear memory bytes, 1 bytes the bump cursor has handed out, 2 bytes parked on the small free lists, 3 bytes parked on the large free list (both with headers), 4 tracked live bytes, 5 collections run, 6 the most tracked bytes ever live at once, 7 reclaims run, 8 bytes they merged into spans and large blocks, 9 bytes parked, 10 region pages cached.
__ablaRuntimeWasmCensus (var)
var __ablaRuntimeWasmCensus: int
The heap census (see the host runtime), outside the tracked heap.
__ablaRuntimePlatformMemoryCensusTake (fun)
trusted fun __ablaRuntimePlatformMemoryCensusTake(): void
Rebuilds the guest memory census from currently tracked allocations.
__ablaRuntimePlatformMemoryCensusWord (fun)
trusted fun __ablaRuntimePlatformMemoryCensusWord(index: int): int
Returns the indexed word of the latest census, zero before a census, or traps for an invalid index.
__ablaRuntimePlatformMemoryLimit (fun)
trusted fun __ablaRuntimePlatformMemoryLimit(): int
Returns the current tracked-memory limit in bytes.
__ablaRuntimePlatformMemorySetLimit (fun)
trusted fun __ablaRuntimePlatformMemorySetLimit(limit: int): void
Sets the guest memory limit, enabling automatic collection and trapping if the limit is outside the usable range.
__ablaRuntimePlatformMemorySetFreeBlockLimit (fun)
trusted fun __ablaRuntimePlatformMemorySetFreeBlockLimit(bytes: int): void
Collect under allocation pressure once the tracked heap has grown bytes (or half again, if more) past what the last collection kept. (This allocator keeps no lists of freed blocks.)
__ablaRuntimePlatformMemorySetCollectionGrowth (fun)
trusted fun __ablaRuntimePlatformMemorySetCollectionGrowth(bytes: int): void
Sets the growth budget and enables collection, trapping for a nonpositive budget.
__ablaRuntimePlatformMemorySetStress (fun)
trusted fun __ablaRuntimePlatformMemorySetStress(on: bool): void
Manual collection (the default here): allocation pressure does not collect until a later memorySetLimit or memorySetCollectionGrowth.
__ablaRuntimePlatformMemorySetStressStride (fun)
trusted fun __ablaRuntimePlatformMemorySetStressStride(stride: int): void
Accepts a stress stride; the guest has no stress mode.
__ablaRuntimePlatformMemorySetTrace (fun)
trusted fun __ablaRuntimePlatformMemorySetTrace(on: bool): void
Accepts the tracing setting without enabling host-style tracing in the guest.
__ablaRuntimePlatformMemorySetManualCollection (fun)
trusted fun __ablaRuntimePlatformMemorySetManualCollection(): void
Disables pressure-triggered collection until it is explicitly enabled again.
__ablaRuntimePlatformMemorySetBackgroundFree (fun)
trusted fun __ablaRuntimePlatformMemorySetBackgroundFree(enabled: bool): void
Background freeing is the host runtime's: a wasm module has one thread, and frees as it sweeps.
__ablaRuntimePlatformMemorySetGcWorkers (fun)
trusted fun __ablaRuntimePlatformMemorySetGcWorkers(count: int): void
Keeps sweeping on the guest thread regardless of the supplied worker count.
__ablaRuntimePlatformMemorySetLayout (fun)
trusted fun __ablaRuntimePlatformMemorySetLayout(
address: int,
layout: int
): void
Updates a tracked allocation's layout and traps for an invalid address or layout number.
__ablaRuntimeWasmMarkPointer (fun)
trusted fun __ablaRuntimeWasmMarkPointer(candidate: int): bool
Marks a tracked allocation reachable from the candidate address and returns whether a new mark was added.
__ablaRuntimeWasmMarkValue (fun)
@inline
trusted fun __ablaRuntimeWasmMarkValue(value: int): void
Traces pointer references in the boxed value at the given address.
__ablaRuntimeWasmLoadAddress (fun)
@inline
trusted fun __ablaRuntimeWasmLoadAddress(address: int): int
wasm32 lowers the compiler's AblaRootFrame { ptr, ptr, i64 } to 32-bit pointer fields at offsets 0 and 4 with the count at 8, and the roots array to 4-byte pointers; the hosted layout uses 8-byte fields throughout.
__ablaRuntimeWasmMarkRootValues (fun)
trusted fun __ablaRuntimeWasmMarkRootValues(): void
Marks tracked allocations reachable from the current guest root frames.
__ablaRuntimeWasmTraceMarkedAllocations (fun)
trusted fun __ablaRuntimeWasmTraceMarkedAllocations(): void
Drains the worklist and marks allocations reached by fields of already marked payloads.
__ablaRuntimePlatformMemoryCollect (fun)
trusted fun __ablaRuntimePlatformMemoryCollect(): int
Marks guest roots, sweeps unreachable allocations and returns the reclaimed tracked byte count.
__ablaRuntimeRootsPush (fun)
trusted fun __ablaRuntimeRootsPush(
frame: int,
roots: int,
count: int
): int
Links the frame and its roots for guest collection and returns zero.
__ablaRuntimeRootsPop (fun)
trusted fun __ablaRuntimeRootsPop(frame: int): int
Unlinks the frame and returns zero, trapping if it was never on the guest root chain.
__ablaRuntimeMemoryPressureLoop (fun)
trusted fun __ablaRuntimeMemoryPressureLoop(): int
A loop's back edge: the same check (the host's counts passes under ABLA_GC_STRESS=1).
__ablaRuntimeMemoryPressure (fun)
trusted fun __ablaRuntimeMemoryPressure(): int
Collects at a safe point if guest allocation pressure exceeds the threshold and returns zero.
__ablaRuntimePlatformRegionBegin (fun)
trusted fun __ablaRuntimePlatformRegionBegin(): int
Enters a new guest allocation region and returns its descriptor address.
__ablaRuntimePlatformRegionEnd (fun)
trusted fun __ablaRuntimePlatformRegionEnd(regionAddress: int): void
Releases the region's pages and restores the enclosing region.
__ablaRuntimePlatformRegionActive (fun)
trusted fun __ablaRuntimePlatformRegionActive(): bool
Returns whether the guest is currently inside an allocation region.
__ablaRuntimePlatformPromoteAllocation (fun)
trusted fun __ablaRuntimePlatformPromoteAllocation(address: int): int
Return an equivalent allocation owned by the parent region (or the tracked heap when the parent is the root).
__ablaRuntimeWasmPanicWrite (fun)
@noinline
trusted fun __ablaRuntimeWasmPanicWrite(data: int, length: int): void
A panic ends the program with a trap. A module that already imports the host's write also says why on standard error ("panic: <message>\n", three writes, none of which allocates: a panic can be the memory limit). Every other module must keep its import set, so the builds decide after optimization whether this function keeps its calls: they erase them when nothing else reaches the host's write (bootstrapLlvmErasePanicWrite, and toolchain.ab for a release module's link).
__ablaRuntimePlatformPanic (fun)
trusted fun __ablaRuntimePlatformPanic(data: int, length: int): int
Writes the guest's panic message bytes and traps.
__ablaRuntimeFloatRemainder (fun)
trusted fun __ablaRuntimeFloatRemainder(x: f64, y: f64): f64
A float % (f64 and f32) on WebAssembly, which has no remainder instruction and no C library to import fmod from: the backend calls this there instead. Exactly C's fmod: x - n·y for the integer n that x / y truncates to, with x's sign (a zero result too), every step exact. A NaN operand, an infinite x or a zero y give NaN; an infinite y gives x. An f32 remainder is this one of the operands widened, which is exact in f32 again.
__ablaHostWrite (extern)
@wasmImport(["abla_host", "write"])
trusted noescape extern:"c" fun __ablaHostWrite(descriptor: i32, data: i32, length: i32): i32
The browser host ABI. A WebAssembly module for a bare wasm32 target has no kernel and no C library: the backend calls __ablaRuntimeWasmSyscall for each raw Linux system call (ablaLinuxSyscall, under abla/io, abla/process/exit, abla/process/time, abla/random…), which keeps the calls the standard library makes on these four imports from module "abla_host" and fails the others with ENOSYS. A module imports only those its program reaches. write(fd: i32, data: i32, length: i32) -> i32 bytes written, or -errno exit(code: i32) ends the program; never returns clock_ns(clock: i32) -> i64 0: wall clock (ns since 1970), 1: monotonic random(data: i32, length: i32) -> i32 random bytes written, or -errno
__ablaHostExit (extern)
@wasmImport(["abla_host", "exit"])
trusted noescape extern:"c" fun __ablaHostExit(code: i32): void
Passes the guest's exit code to the host to terminate execution.
__ablaHostClockNs (extern)
@wasmImport(["abla_host", "clock_ns"])
trusted noescape extern:"c" fun __ablaHostClockNs(clock: i32): i64
Returns host wall or monotonic time in nanoseconds according to the clock selector.
__ablaHostRandom (extern)
@wasmImport(["abla_host", "random"])
trusted noescape extern:"c" fun __ablaHostRandom(data: i32, length: i32): i32
Fills guest memory with host randomness and returns the byte count or a negative host error.
__ablaRuntimeWasmSyscall (fun)
trusted fun __ablaRuntimeWasmSyscall(
number: int,
a0: int,
a1: int,
a2: int,
a3: int,
a4: int,
a5: int
): int
Routes supported Linux-style calls to the guest host APIs or returns an unsupported-operation error.
__ablaRuntimePlatformMemoryFreeze (fun)
trusted fun __ablaRuntimePlatformMemoryFreeze(value: any): any
Frozen groups are a host feature (docs/design/frozen-heap.md): nothing is frozen here.
__ablaRuntimePlatformAllocateOwned (fun)
trusted fun __ablaRuntimePlatformAllocateOwned(requested: int, layout: int, owner: int): int
A block that lives as long as owner: in the owner's region when it was allocated in the active one, else outside every region (a global's rope flattened first inside a request's region would otherwise keep a copy the region frees).
Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.