abla/unsafe/memory/raw

Generated from source.

Import with import "abla/unsafe/memory/raw".

Source: abla/unsafe/memory/raw/entry.ab

nativeStackAllocate (extern)

trusted noescape extern:"intrinsic" fun nativeStackAllocate(capacity: int): int

Allocates temporary native storage directly in the calling function's stack frame with at least 16-byte alignment. The returned address is invalid after that function returns and must never be stored in a longer-lived value. This is an intrinsic instead of an Abla wrapper so LLVM cannot end an inlined callee frame before the caller has finished using the allocation.

nativeStaticAllocate (extern)

noescape extern:"intrinsic" fun nativeStaticAllocate(capacity: int): int

Reserves one zero-initialized native region for each call site. The address is stable for the process lifetime. Embedded code normally calls this from a module initializer to obtain C-style static storage without a heap wrapper. Capacity must be a compile-time integer when using the LLVM backend.

nativeStaticBytes (extern)

noescape extern:"intrinsic" fun nativeStaticBytes(contents: string): int

Emits the exact bytes of a compile-time string as private immutable native storage. Unlike nativeStaticAllocate, this does not reserve writable RAM or generate module-initializer stores. Binary string escapes preserve every byte value, including embedded zeroes.

nativeStaticMutableBytes (extern)

noescape extern:"intrinsic" fun nativeStaticMutableBytes(
    contents: string
): int

Emits exact writable bytes as one private native object. This is the byte representation of compile-time initialized native state whose size or field layout is not a 32-bit word array.

nativeStaticU32s (extern)

noescape extern:"intrinsic" fun nativeStaticU32s(values: array<int>): int

Emits immutable 32-bit words as one private native object. Every element must be a compile-time integer expression; addresses of Abla functions, static byte regions, and linker symbols remain real object relocations instead of becoming module-initializer stores. This is intentionally a target-neutral data primitive rather than an ELF- or MCU-specific API.

nativeStaticMutableU32s (extern)

noescape extern:"intrinsic" fun nativeStaticMutableU32s(
    values: array<int>
): int

Emits writable 32-bit words as one private native object. Initial values follow the same compile-time and relocation rules as nativeStaticU32s, but the resulting storage remains in writable data for state that changes after startup. LLVM sees both the initializer and every Abla access in one unit.

nativeInternalSectionBytes (extern)

noescape extern:"intrinsic" fun nativeInternalSectionBytes(
    contents: string,
    linkName: string,
    section: string,
    alignment: int
): int

Emits immutable compile-time bytes into an exact object section. The data remains internal to the whole LLVM unit and is retained for linker-script protocols such as executable metadata which have no ordinary code reader.

nativeInternalSectionU32s (extern)

noescape extern:"intrinsic" fun nativeInternalSectionU32s(
    values: array<int>,
    linkName: string,
    section: string
): int

Emits immutable relocation-capable 32-bit words into an exact object section. The object stays internal and is retained while its owning Abla module is reachable, allowing linker-script registries to contain direct Abla function and data addresses without a foreign object or runtime stores. U32 objects are naturally aligned to four bytes.

nativeLinkerSymbolAddress (extern)

noescape extern:"intrinsic" fun nativeLinkerSymbolAddress(
    linkName: string
): int

Returns the address assigned to an object-format symbol by the final linker. This is intended for linker-script boundaries and platform ABI data, not for Abla functions or globals whose address is already available directly.

nativeLinkedStaticAllocate (extern)

noescape extern:"intrinsic" fun nativeLinkedStaticAllocate(
    capacity: int,
    linkName: string
): int

Reserves zero-initialized native storage with an exact object-format symbol. This is the data counterpart to a linked function name and is useful while freestanding modules still interoperate with independently compiled code.

nativeInternalLinkedStaticAllocate (extern)

noescape extern:"intrinsic" fun nativeInternalLinkedStaticAllocate(
    capacity: int,
    linkName: string
): int

Reserves zero-initialized storage with an exact symbol that is local to the generated object. Architecture-owned module assembly can name it directly, while ordinary external objects cannot treat it as a public data ABI.

nativeLinkedThreadLocalAllocate (extern)

noescape extern:"intrinsic" fun nativeLinkedThreadLocalAllocate(
    capacity: int,
    linkName: string
): int

As above, but each native thread receives an independent region. LLVM emits a real thread_local global, so target TLS relocations keep their ABI meaning.

nativeSectionLinkedThreadLocalAllocate (extern)

noescape extern:"intrinsic" fun nativeSectionLinkedThreadLocalAllocate(
    capacity: int,
    linkName: string,
    section: string,
    alignment: int
): int

Thread-local storage with explicit object symbol and section placement. This is general ELF/Mach-O linker plumbing for runtimes whose TLS ABI uses named input sections. Alignment is explicit because ABI layouts may require adjacent TLS words rather than the compiler's default native alignment.

nativeInternalSectionThreadLocalAllocate (extern)

noescape extern:"intrinsic" fun nativeInternalSectionThreadLocalAllocate(
    capacity: int,
    linkName: string,
    section: string,
    alignment: int
): int

The internal variant is retained in llvm.used while its owning Abla source is reachable, but does not publish a data symbol outside the LLVM unit.

nativeThreadLocalBytes (extern)

@__abla_trusted_only("error")
noescape extern:"intrinsic" fun nativeThreadLocalBytes(contents: string): int

Creates writable native thread-local storage initialized from the exact bytes in contents. The object has internal linkage, so unused TLS state can be removed with the Abla code which owns it.

ablaUnsafeLoadI64 (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeLoadI64(address: i64*): int

Reads 8 bytes at address as a signed integer. The caller must supply a readable range of that size.

ablaUnsafeStoreI64 (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeStoreI64(
    address: i64*,
    value: int
): void

Stores the low 64 bits of value at address in native byte order. The caller must supply a writable 8-byte range.

ablaUnsafeLoadPointer (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeLoadPointer(address: i64*): i64*

Returns the pointer stored at address, which must point to readable storage for a native pointer.

ablaUnsafeStorePointer (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeStorePointer(
    address: i64*,
    value: i64*
): void

Stores value at address, which must point to writable storage for a native pointer.

ablaUnsafeNullPointer (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeNullPointer(): i64*

Returns a null native pointer.

ablaUnsafePointerIsNull (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafePointerIsNull(value: i64*): bool

Returns true if value is a null native pointer without dereferencing it.

ablaUnsafeCallMain (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeCallMain(address: int): int

Returns the result of calling the native C main at address with argc zero and argv null, which requires a valid entry address.

ablaUnsafeStringAddress (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeStringAddress(value: string): int

Borrows the exact byte storage of a string without adding a terminator or copying it. Trusted callers must keep the string alive and pass an explicit bounded length to the native operation that consumes this address.

ablaUnsafePointerAddress (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafePointerAddress(value: i64*): int

Returns the integer representation of pointer value without dereferencing it or extending the lifetime of its storage.

ablaUnsafePointerOffset (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafePointerOffset(
    value: i64*,
    offset: int
): i64*

Returns value advanced by offset bytes without checking bounds or dereferencing it.

ablaUnsafeLoadU8 (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeLoadU8(address: i64*): int

Reads one byte at address as a zero-extended integer. The caller must supply a readable range of that size.

ablaUnsafeLoadU16 (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeLoadU16(address: i64*): int

Reads 2 bytes at address as a zero-extended integer. The caller must supply a readable range of that size.

ablaUnsafeLoadU32 (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeLoadU32(address: i64*): int

Reads 4 bytes at address as a zero-extended integer. The caller must supply a readable range of that size.

ablaUnsafeStoreU8 (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeStoreU8(address: i64*, value: int): void

Stores the low 8 bits of value at address in native byte order. The caller must supply a writable 1-byte range.

ablaUnsafeStoreU16 (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeStoreU16(
    address: i64*,
    value: int
): void

Stores the low 16 bits of value at address in native byte order. The caller must supply a writable 2-byte range.

ablaUnsafeStoreU32 (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeStoreU32(
    address: i64*,
    value: int
): void

Stores the low 32 bits of value at address in native byte order. The caller must supply a writable 4-byte range.

ablaUnsafeSetMemory (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeSetMemory(
    address: i64*,
    value: int,
    size: int
): void

Fills size bytes at address with the low byte of value. The caller must provide a writable range of that size.

ablaUnsafeCopyMemory (extern)

trusted noescape extern:"intrinsic" fun ablaUnsafeCopyMemory(
    destinationAddress: int,
    sourceAddress: int,
    size: int
): void

Copies size bytes; the two ranges may overlap (it is llvm.memmove: the copy is as if made through a buffer, whichever way they overlap). A freestanding program links the C library's memmove for it where the size is not a small constant.

nativeNullPointer (fun)

trusted fun nativeNullPointer(): i64*

Returns a null native pointer.

pointerIsNull (fun)

trusted fun pointerIsNull(value: i64*): bool

Returns true if value is a null pointer.

callNativeMain (fun)

@__abla_trusted_only("error")
trusted fun callNativeMain(address: int): int

Calls the native C main at a valid address with no arguments and returns its exit status.

nativeStringAddress (fun)

@__abla_trusted_only("error")
trusted fun nativeStringAddress(value: string): int

Returns the borrowed byte address of value, which must remain live for the duration of each use.

nativePointerAddress (fun)

@__abla_trusted_only("error")
trusted fun nativePointerAddress(value: i64*): int

Returns pointer value represented as an integer. This does not grant ownership over the storage.

nativePointerFromAddress (fun)

@__abla_trusted_only("error")
trusted fun nativePointerFromAddress(address: int): i64*

Interprets address as a native pointer without checking whether it points to valid storage.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.