l0_runtime.h

l0_runtime.h

Source: compiler/shared/runtime/l0_runtime.h Language: C

L0 Runtime Library (K0 - Kernel Layer)

Header-only C99 runtime providing:

  • Memory allocation and deallocation

  • Whole-file I/O operations

  • Basic printing to stdout/stderr

  • Panic mechanism for defined runtime aborts

  • UB-free integer operations

  • String type and operations

  • Optional type support

  • Random number generation

  • Wall/monotonic time snapshots and local-time metadata

  • Support for L0 new and drop semantics

  • Environment variable access

  • Reading from stdin

  • Errno access

Design principles:

  • All UB and platform quirks are confined to this file

  • L0 programs use l0_int (int32_t); this layer handles size_t conversion

  • Portable C99 code, no compiler-specific extensions

Imports / Includes

  • stdio.h
  • stdlib.h
  • stdint.h
  • stddef.h
  • string.h
  • stdarg.h
  • errno.h
  • time.h
  • sys/types.h
  • sys/stat.h
  • unistd.h
  • sys/wait.h
  • dea_siphash.h

Symbols

Macro DEA_RUNTIME_FCLOSE

1
DEA_RUNTIME_FCLOSE

Macro DEA_RUNTIME_FILE_INFO_STAT

1
DEA_RUNTIME_FILE_INFO_STAT

Macro DEA_RUNTIME_REMOVE

1
DEA_RUNTIME_REMOVE

Macro _RT_ALIGNOF

1
_RT_ALIGNOF

Macro L0_UNREACHABLE

1
L0_UNREACHABLE

Macro _RT_TRACE_ARC

1
_RT_TRACE_ARC

Macro _RT_TRACE_ARC_LOC

1
_RT_TRACE_ARC_LOC

Macro _RT_TRACE_MEM

1
_RT_TRACE_MEM

Macro _RT_TRACE_MEM_LOC

1
_RT_TRACE_MEM_LOC

Macro L0_STRING_K_STATIC

1
L0_STRING_K_STATIC

Macro L0_STRING_K_HEAP

1
L0_STRING_K_HEAP

Macro L0_STRING_CONST

1
L0_STRING_CONST

String literal construction macro.

Macro L0_OPT_BOOL_DEFINED

1
L0_OPT_BOOL_DEFINED

Macro L0_OPT_BYTE_DEFINED

1
L0_OPT_BYTE_DEFINED

Macro L0_OPT_INT_DEFINED

1
L0_OPT_INT_DEFINED

Macro L0_OPT_STRING_DEFINED

1
L0_OPT_STRING_DEFINED

Macro L0_DEFINED_l0_sys_rt_RtTimeParts

1
L0_DEFINED_l0_sys_rt_RtTimeParts

Macro L0_DEFINED_l0_sys_rt_RtFileInfo

1
L0_DEFINED_l0_sys_rt_RtFileInfo

Macro _RT_ALLOC_INIT_CAP

1
_RT_ALLOC_INIT_CAP

Macro _RT_ALLOC_LIVE

1
_RT_ALLOC_LIVE

Macro _RT_ALLOC_QUARANTINED

1
_RT_ALLOC_QUARANTINED

Macro _RT_ALLOC_POOLED

1
_RT_ALLOC_POOLED

Macro _RT_MEM_RAW

1
_RT_MEM_RAW

Macro _RT_MEM_NEW

1
_RT_MEM_NEW

Macro _RT_MEM_ARC

1
_RT_MEM_ARC

Macro _RT_MEM_STATIC

1
_RT_MEM_STATIC

Macro _RT_MEM_FOREIGN

1
_RT_MEM_FOREIGN

Macro _RT_ACCESS_READ

1
_RT_ACCESS_READ

Macro _RT_ACCESS_WRITE

1
_RT_ACCESS_WRITE

Macro _RT_ACCESS_UNTRACKED_OK

1
_RT_ACCESS_UNTRACKED_OK

Macro _RT_QUARANTINE_MAX_BYTES

1
_RT_QUARANTINE_MAX_BYTES

Macro _RT_QUARANTINE_MAX_COUNT

1
_RT_QUARANTINE_MAX_COUNT

Macro _RT_REC_POOL_CHUNK

1
_RT_REC_POOL_CHUNK

Macro _RT_ALLOC_TOMBSTONE

1
_RT_ALLOC_TOMBSTONE

Macro _rt_rec_cold

1
_rt_rec_cold

Macro _L0_TAG_OPT

1
_L0_TAG_OPT

Macro _L0_TAG_PTR

1
_L0_TAG_PTR

Macro _L0_TAG_ENUM

1
_L0_TAG_ENUM

Macro _L0_TAG_STRUCT

1
_L0_TAG_STRUCT

Type Alias l0_bool

1
typedef uint8_t l0_bool

Type Alias l0_tiny

1
typedef int8_t l0_tiny

future use

Type Alias l0_short

1
typedef int16_t l0_short

Type Alias l0_int

1
typedef int32_t l0_int

Type Alias l0_long

1
typedef int64_t l0_long

Type Alias l0_byte

1
typedef uint8_t l0_byte

Type Alias l0_ushort

1
typedef uint16_t l0_ushort

Type Alias l0_uint

1
typedef uint32_t l0_uint

Type Alias l0_ulong

1
typedef uint64_t l0_ulong

Type Alias l0_float

1
typedef float l0_float

Type Alias l0_double

1
typedef double l0_double

Type Alias _rt_alloc_record

1
typedef struct _rt_alloc_record _rt_alloc_record

Type Alias _rt_alloc_record_cold

1
typedef struct _rt_alloc_record_cold _rt_alloc_record_cold

Type Alias _rt_ptr_site

1
typedef struct _rt_ptr_site _rt_ptr_site

Type Alias :-1]

1
typedef char _rt_alloc_record_size_check[(sizeof(_rt_alloc_record)==64) ? 1 :-1][(sizeof(_rt_alloc_record)==64) ? 1 :-1]

Type Alias _rt_siphash_key_t[16]

1
typedef uint8_t _rt_siphash_key_t[16][16]

Type Alias _rt_siphash_tag8_t[8]

1
typedef uint8_t _rt_siphash_tag8_t[8][8]

Variable _RT_MEM_SENTINEL

1
const l0_int _RT_MEM_SENTINEL

Sentinel value for memory checks.

Variable L0_STRING_EMPTY

1
l0_string L0_STRING_EMPTY

Static empty string instance.

Variable L0_OPT_STRING_NULL

1
l0_opt_string L0_OPT_STRING_NULL

Static instance for null optional string.

Variable L0_OPT_STRING_EMPTY

1
l0_opt_string L0_OPT_STRING_EMPTY

Static instance for empty optional string.

Variable _rt_argc

1
int _rt_argc

Variable _rt_argv

1
char** _rt_argv

Variable _rt_alloc_table

1
_rt_alloc_record** _rt_alloc_table

Variable _rt_alloc_table_cap

1
size_t _rt_alloc_table_cap

Variable _rt_alloc_table_cnt

1
size_t _rt_alloc_table_cnt

Variable _rt_alloc_table_tombstones

1
size_t _rt_alloc_table_tombstones

Variable _rt_alloc_next_generation

1
uint64_t _rt_alloc_next_generation

Variable _rt_alloc_tree_root

1
_rt_alloc_record* _rt_alloc_tree_root

Variable _rt_rec_free_list

1
_rt_alloc_record* _rt_rec_free_list

Variable _rt_cold_chunks

1
_rt_alloc_record_cold** _rt_cold_chunks

Variable _rt_rec_pool_chunks

1
size_t _rt_rec_pool_chunks

Variable _rt_quarantine_head

1
_rt_alloc_record* _rt_quarantine_head

Variable _rt_quarantine_tail

1
_rt_alloc_record* _rt_quarantine_tail

Variable _rt_quarantine_bytes

1
size_t _rt_quarantine_bytes

Variable _rt_quarantine_count

1
size_t _rt_quarantine_count

Variable _l0_sh_tag_bool

1
const _rt_siphash_tag8_t _l0_sh_tag_bool

Variable _l0_sh_tag_byte

1
const _rt_siphash_tag8_t _l0_sh_tag_byte

Variable _l0_sh_tag_int

1
const _rt_siphash_tag8_t _l0_sh_tag_int

Variable _l0_sh_tag_string

1
const _rt_siphash_tag8_t _l0_sh_tag_string

Variable _l0_sh_tag_data

1
const _rt_siphash_tag8_t _l0_sh_tag_data

Variable _rt_sh_key

1
_rt_siphash_key_t _rt_sh_key

Default (debug) SipHash key for L0 runtime.

In production, it will be randomized at runtime to prevent hash-flooding attacks.

Function _rt_init_args

1
void _rt_init_args(int argc, char **argv)

Initialize command-line arguments.

Parameters:

  • argc: Number of arguments.
  • argv: Argument vector.

Function _rt_panic

1
static void _rt_panic(const char *message)

Abort the program with a message.

Parameters:

  • message: The panic message.

Function _rt_panic_fmt

1
static void _rt_panic_fmt(const char *fmt,...)

Abort the program with a formatted message.

Parameters:

  • fmt: Format string.

Function _rt_idiv

1
static l0_int _rt_idiv(l0_int a, l0_int b)

Safe integer division.

Parameters:

  • a: Dividend.
  • b: Divisor.

Returns: Quotient.

Function _rt_imod

1
static l0_int _rt_imod(l0_int a, l0_int b)

Safe integer modulo.

Parameters:

  • a: Dividend.
  • b: Divisor.

Returns: Remainder.

Function _rt_iadd

1
static l0_int _rt_iadd(l0_int a, l0_int b)

Safe integer addition with overflow check.

Parameters:

  • a: First operand.
  • b: Second operand.

Returns: Sum.

Function _rt_isub

1
static l0_int _rt_isub(l0_int a, l0_int b)

Safe integer subtraction with overflow check.

Parameters:

  • a: First operand.
  • b: Second operand.

Returns: Difference.

Function _rt_imul

1
static l0_int _rt_imul(l0_int a, l0_int b)

Safe integer multiplication with overflow check.

Parameters:

  • a: First operand.
  • b: Second operand.

Returns: Product.

Function _rt_narrow_l0_byte

1
l0_byte _rt_narrow_l0_byte(l0_int value)

Narrow l0_int to l0_byte with range check.

Parameters:

  • value: Integer value.

Returns: Byte value.

Function _unwrap_ptr

1
static void * _unwrap_ptr(void *opt, const char *type_name)

Unwrap a pointer, panicking if NULL.

Parameters:

  • opt: Pointer to unwrap.
  • type_name: Name of the type for error reporting.

Returns: Unwrapped pointer.

Function _unwrap_opt

1
static void * _unwrap_opt(void *opt_ptr, const char *type_name)

Unwrap an optional type structure, panicking if it has no value.

Parameters:

  • opt_ptr: Pointer to the optional structure.
  • type_name: Name of the type for error reporting.

Returns: Pointer to the optional structure.

Function _rt_track_alloc_record

1
static void _rt_track_alloc_record(void *ptr, size_t size, size_t align, uint32_t type_id, const char *loc_file, int loc_line)

Function _rt_promote_new_alloc

1
static void _rt_promote_new_alloc(void *ptr)

Function _rt_release_tracked_alloc

1
static void _rt_release_tracked_alloc(void *ptr, const char *loc_file, int loc_line, const char *op_name)

Function _rt_realloc_tracked_alloc

1
static void * _rt_realloc_tracked_alloc(void *ptr, size_t new_size, const char *loc_file, int loc_line)

Function _rt_check_ptr_site_slow

1
static void * _rt_check_ptr_site_slow(_rt_ptr_site *site, void *ptr, l0_int required_size, l0_int required_align, int access_mode, const char *loc_file, int loc_line)

Function _rt_check_index_ptr_site_slow

1
static void * _rt_check_index_ptr_site_slow(_rt_ptr_site *site, void *base_ptr, l0_int index, l0_int element_size, l0_int required_align, int access_mode, const char *loc_file, int loc_line)

Function _rt_drop_begin_impl

1
static void * _rt_drop_begin_impl(void *ptr, l0_int required_size, l0_int required_align, const char *loc_file, int loc_line)

Function _rt_drop_finish_impl

1
static void _rt_drop_finish_impl(void *ptr, const char *loc_file, int loc_line)

Function _rt_validate_derived_ptr

1
static void * _rt_validate_derived_ptr(void *derived, void *parent_base, l0_int size, l0_int align, const char *loc_file, int loc_line)

Function _rt_track_arc_bytes

1
static void _rt_track_arc_bytes(void *ptr, size_t size)

Lazily register ARC-managed string storage as a read-only tracked record.

Idempotent: repeated exposure of the same live block is a no-op, so rt_string_bytes_ptr may call this on every invocation.

Function _rt_untrack_arc_alloc

1
static void _rt_untrack_arc_alloc(void *ptr)

Function _rt_track_static_bytes

1
static void _rt_track_static_bytes(const void *ptr, size_t size)

Function _rt_check_ptr_site

1
static void * _rt_check_ptr_site(_rt_ptr_site *site, void *ptr, l0_int required_size, l0_int required_align, int access_mode, const char *loc_file, int loc_line)

Validate one pointer access through a call-site cache.

Parameters:

  • site: Per-call-site cache slot owned by the generated access site.
  • ptr: Pointer about to be dereferenced.
  • required_size: Size in bytes of the access.
  • required_align: Required alignment, or 0 for no alignment check.
  • access_mode: _RT_ACCESS_READ or _RT_ACCESS_WRITE.
  • loc_file: Source file of the access site.
  • loc_line: Source line of the access site.

Returns: ptr when the access is valid; panics otherwise.

Function _rt_check_index_ptr_site

1
static void * _rt_check_index_ptr_site(_rt_ptr_site *site, void *base_ptr, l0_int index, l0_int element_size, l0_int required_align, int access_mode, const char *loc_file, int loc_line)

Validate and derive one indexed pointer access through a call-site cache.

The checked path validates the base pointer and target byte range before forming the target pointer value, avoiding out-of-object C pointer arithmetic in generated code.

Parameters:

  • site: Per-call-site cache slot owned by the generated access site.
  • base_ptr: Base pointer expression before indexing.
  • index: Element index.
  • element_size: Size in bytes of one indexed element.
  • required_align: Required target alignment, or 0 for no alignment check.
  • access_mode: _RT_ACCESS_READ or _RT_ACCESS_WRITE.
  • loc_file: Source file of the access site.
  • loc_line: Source line of the access site.

Returns: Target pointer when the access is valid; panics otherwise.

Function _rt_l0_string_from_const_literal

1
static l0_string _rt_l0_string_from_const_literal(const char *c_str)

Create an L0 string from a constant C string.

Returns a string with len=0 if c_str is NULL.

Note: Does NOT allocate or copy - just wraps the existing C string. Use only for string literals or static const data.

Parameters:

  • c_str: Constant C string.

Returns: L0 string.

Function _rt_init_heap_string

1
static l0_string _rt_init_heap_string(void *mem, l0_int s_len)

Initialize a heap-allocated L0_string in the given memory.

Character data (bytes[]) is uninitialized; caller must fill it in. Length is assumed to be already validated by the caller. Size of mem MUST be at least sizeof(_l0_h_string) + s_len + 1.

The returned string is of kind L0_STRING_K_HEAP and its data is null-terminated in advance.

Parameters:

  • mem: Allocated memory block.
  • s_len: Length of the string.

Returns: Initialized L0 string.

Function _rt_alloc_string

1
static l0_string _rt_alloc_string(l0_int len)

Allocate a new reference counted L0_string of the given length.

Character data (bytes[]) is uninitialized; caller must fill it in. Panics on allocation failure or negative length. Size of allocated memory is: string header + len + 1 for null terminator.

The returned string is of kind L0_STRING_K_HEAP and its data is null-terminated in advance.

Parameters:

  • len: Length of the string.

Returns: Allocated L0 string.

Function _rt_free_string

1
static void _rt_free_string(l0_string str)

Free a string’s allocated data, if applicable.

If reference counted, decrements reference count and frees when it reaches zero.

Parameters:

  • str: L0 string to free.

Function _rt_realloc_string

1
static l0_string _rt_realloc_string(l0_string s, l0_int new_len)

Reallocate a heap string to a new length.

Parameters:

  • s: Current L0 string.
  • new_len: New length.

Returns: Updated L0 string.

Function _rt_new_l0_string

1
static l0_string _rt_new_l0_string(const char *c_str)

Create a new reference counted L0_string from a null-terminated C string.

Allocates new memory and copies data.

Parameters:

  • c_str: Null-terminated C string.

Returns: L0 string.

Function _rt_string_bytes

1
static char * _rt_string_bytes(l0_string s)

Gets the null-terminated C string underlying an L0 string.

or NULL if not available, e.g. for static empty strings. Useful when interfacing with C APIs that require null-terminated strings.

Note: This is an internal helper, not exposed to L0 code.

Parameters:

  • s: L0 string.

Returns: Pointer to character data.

Function rt_strlen

1
static l0_int rt_strlen(l0_string str)

Get the length of a string.

L0 signature: extern func rt_strlen(str: string) -> int;

Parameters:

  • str: L0 string.

Returns: Length in bytes.

Function rt_string_get

1
static l0_byte rt_string_get(l0_string a, l0_int index)

Bounds-checked character access.

Returns the character at the given index, or panics if out of bounds.

L0 signature: extern func rt_string_get(s: string, index: int) -> byte;

Parameters:

  • a: L0 string.
  • index: Index.

Returns: Byte value.

Function rt_string_bytes_ptr

1
static l0_byte * rt_string_bytes_ptr(l0_string s)

Return a pointer to the raw byte data of a string.

L0 signature: extern func rt_string_bytes_ptr(s: string) -> byte*;

Heap and static string storage is registered with the pointer access tracker lazily here, at first raw-byte exposure, so the returned pointer stays dereferenceable by checked generated code while strings that never hand out raw bytes stay out of the tracker. Both are runtime-managed: passing the returned pointer to drop or rt_free is a runtime error.

Parameters:

  • s: L0 string.

Returns: Pointer to the first byte.

Function rt_string_equals

1
static l0_bool rt_string_equals(l0_string a, l0_string b)

Check if two strings are equal.

L0 signature: extern func rt_string_equals(a: string, b: string) -> bool;

Parameters:

  • a: First string.
  • b: Second string.

Returns: 1 if equal, 0 otherwise.

Function rt_string_compare

1
static l0_int rt_string_compare(l0_string a, l0_string b)

Compare two strings lexicographically.

Returns 0 if equal, <0 if a < b, >0 if a > b.

L0 signature: extern func rt_string_compare(a: string, b: string) -> int;

Parameters:

  • a: First string.
  • b: Second string.

Returns: Comparison result.

Function rt_string_concat

1
static l0_string rt_string_concat(l0_string a, l0_string b)

Concatenate two strings (allocates new memory).

Returns a heap-allocated string containing a + b.

L0 signature: extern func rt_string_concat(a: string, b: string) -> string;

Parameters:

  • a: First string.
  • b: Second string.

Returns: Concatenated string.

Function rt_string_slice

1
static l0_string rt_string_slice(l0_string s, l0_int start, l0_int end)

Create a substring (allocates new memory).

Panics if start/end are out of bounds or start > end.

L0 signature: extern func rt_string_slice(s: string, start: int, end: int) -> string;

Parameters:

  • s: Source string.
  • start: Start index.
  • end: End index.

Returns: Slice string.

Function rt_string_from_byte

1
static l0_string rt_string_from_byte(l0_byte b)

Create an L0 string from a single character (byte).

Allocates a new heap string of length 1. Note: Caller must free the returned string using _rt_free_string.

L0 signature: extern func rt_string_from_byte(b: byte) -> string;

Parameters:

  • b: Character.

Returns: L0 string.

Function rt_string_from_byte_array

1
static l0_string rt_string_from_byte_array(l0_byte *bytes, l0_int len)

Create an L0 string from a byte array and a length.

Allocates a new heap string of the given length and copies data. The array does not need to be a null-terminated C string: all bytes are copied and a null terminator is added for C interoperability. Panics if len is negative.

L0 signature: extern func rt_string_from_byte_array(bytes: byte*, len: int) -> string;

Parameters:

  • bytes: Pointer to bytes.
  • len: Length.

Returns: L0 string.

Function rt_string_retain

1
static void rt_string_retain(l0_string s)

Increment reference count for heap strings (no-op for static).

Panics if the string is heap-allocated but has an invalid refcount state (e.g. double free detected).

L0 signature: extern func rt_string_retain(s: string) -> void;

Parameters:

  • s: L0 string.

Function rt_string_release

1
static void rt_string_release(l0_string s)

Decrement reference count, freeing if zero.

L0 signature: extern func rt_string_release(s: string) -> void;

Parameters:

  • s: L0 string.

Function rt_system

1
static l0_int rt_system(l0_string cmd)

Execute a system command and return its normalized status.

Returns the command exit code, 128 + signal when terminated by a signal, or a negative value on error launching the shell.

L0 signature: extern func rt_system(cmd: string) -> int;

Parameters:

  • cmd: Command string.

Returns: Normalized status.

Function rt_get_env_var

1
static l0_opt_string rt_get_env_var(l0_string name)

Get an environment variable as an L0 optional string.

Returns null (empty optional) if the variable is not set.

L0 signature: extern func rt_get_env_var(name: string) -> string?;

Parameters:

  • name: Variable name.

Returns: Optional string value.

Function rt_get_argc

1
static l0_int rt_get_argc(void)

Get the number of command-line arguments.

L0 signature: extern func rt_get_argc() -> int;

Returns: Argument count.

Function _rt_pid_to_l0_int

1
static l0_bool _rt_pid_to_l0_int(intmax_t value, l0_int *out)

Convert a native process identifier into l0_int .

Parameters:

  • value: Native process identifier.
  • out: Output location.

Returns: 1 when value fits in l0_int, otherwise 0.

Function rt_get_pid

1
static l0_int rt_get_pid(void)

Get the current process identifier.

L0 signature: extern func rt_get_pid() -> int;

Returns: Process identifier.

Function rt_get_argv

1
static l0_string rt_get_argv(l0_int i)

Get the command-line argument at the given index.

Panics if index is out of bounds.

L0 signature: extern func rt_get_argv(i: int) -> string;

Parameters:

  • i: Index.

Returns: Argument string.

Function _rt_time_to_l0_int_sec

1
static l0_bool _rt_time_to_l0_int_sec(time_t value, l0_int *out)

Internal helper to convert time_t to l0_int seconds.

Function _rt_time_to_l0_int_nsec

1
static l0_bool _rt_time_to_l0_int_nsec(long value, l0_int *out)

Internal helper to convert long to l0_int nanoseconds.

Function _rt_time_write_parts

1
static l0_bool _rt_time_write_parts(struct l0_sys_rt_RtTimeParts *out, l0_int sec, l0_int nsec)

Internal helper to write time parts to struct.

Function rt_time_unix

1
static l0_bool rt_time_unix(struct l0_sys_rt_RtTimeParts *out)

Capture current unix wall clock into out .

L0 signature: extern func rt_time_unix(out: RtTimeParts*) -> bool;

Parameters:

Returns: 1 on success, 0 on failure.

Function rt_time_monotonic

1
static l0_bool rt_time_monotonic(struct l0_sys_rt_RtTimeParts *out)

Capture current monotonic clock into out .

L0 signature: extern func rt_time_monotonic(out: RtTimeParts*) -> bool;

Parameters:

Returns: 1 on success, 0 on failure.

Function rt_time_monotonic_supported

1
static l0_bool rt_time_monotonic_supported(void)

Returns whether a monotonic clock source is available.

L0 signature: extern func rt_time_monotonic_supported() -> bool;

Returns: 1 if supported, 0 otherwise.

Function rt_time_local_offset_sec

1
static l0_opt_int rt_time_local_offset_sec(l0_int unix_sec)

Returns local UTC offset in seconds for unix_sec .

Computes the offset by comparing gmtime and localtime breakdowns directly, avoiding mktime which rejects pre-epoch values on some platforms.

L0 signature: extern func rt_time_local_offset_sec(unix_sec: int) -> int?;

Parameters:

  • unix_sec: Unix timestamp.

Returns: Optional integer offset.

Function rt_time_local_is_dst

1
static l0_opt_bool rt_time_local_is_dst(l0_int unix_sec)

Returns whether local time is daylight-saving time for unix_sec .

L0 signature: extern func rt_time_local_is_dst(unix_sec: int) -> bool?;

Parameters:

  • unix_sec: Unix timestamp.

Returns: Optional boolean.

Function rt_read_file_all

1
static l0_opt_string rt_read_file_all(l0_string path)

Read entire file contents into a string.

Returns empty string on error (file not found, read error, allocation failure).

L0 signature: extern func rt_read_file_all(path: string) -> string?;

Parameters:

  • path: File path.

Returns: Optional string containing file contents.

Function rt_write_file_all

1
static l0_bool rt_write_file_all(l0_string path, l0_string data)

Write string data to a file.

Returns 1 (true) on success, 0 (false) on error.

L0 signature: extern func rt_write_file_all(path: string, data: string) -> bool;

Parameters:

  • path: File path.
  • data: Data string.

Returns: 1 on success, 0 on failure.

Function rt_file_info

1
static struct l0_sys_rt_RtFileInfo rt_file_info(l0_string path)

Return basic metadata for a path.

L0 signature: extern func rt_file_info(path: string) -> RtFileInfo;

Parameters:

  • path: File path.

Returns: Metadata record with nullable size and mtime fields.

Function rt_delete_file

1
static l0_bool rt_delete_file(l0_string path)

Delete the file at the given path.

Returns 1 (true) on success, 0 (false) on error.

L0 signature: extern func rt_delete_file(path: string) -> bool;

Parameters:

  • path: File path.

Returns: 1 on success, 0 on failure.

Function _rt_stream_write_some

1
static l0_int _rt_stream_write_some(FILE *stream, const l0_byte *buf, l0_int len)

Write raw bytes to one standard stream.

Parameters:

  • stream: Target stream.
  • buf: Source bytes.
  • len: Maximum number of bytes to write.

Returns: Bytes written, or -1 on error.

Function rt_stdin_read

1
static l0_int rt_stdin_read(l0_byte *buf, l0_int capacity)

Read raw bytes from standard input.

L0 signature: extern func rt_stdin_read(buf: byte*?, capacity: int) -> int;

Parameters:

  • buf: Destination bytes. A NULL buffer is reported as -1.
  • capacity: Maximum number of bytes to read.

Returns: Bytes read, 0 on EOF, or -1 on error (including a NULL buf when capacity > 0).

Function rt_stdout_write

1
static l0_int rt_stdout_write(l0_byte *buf, l0_int len)

Write raw bytes to standard output.

L0 signature: extern func rt_stdout_write(buf: byte*?, len: int) -> int;

Parameters:

  • buf: Source bytes. A NULL buffer is reported as -1.
  • len: Maximum number of bytes to write.

Returns: Bytes written, or -1 on error (including a NULL buf when len > 0).

Function rt_stderr_write

1
static l0_int rt_stderr_write(l0_byte *buf, l0_int len)

Write raw bytes to standard error.

L0 signature: extern func rt_stderr_write(buf: byte*?, len: int) -> int;

Parameters:

  • buf: Source bytes. A NULL buffer is reported as -1.
  • len: Maximum number of bytes to write.

Returns: Bytes written, or -1 on error (including a NULL buf when len > 0).

Function rt_flush_stdout

1
static void rt_flush_stdout(void)

Flush stdout.

Function rt_flush_stderr

1
static void rt_flush_stderr(void)

Flush stderr.

L0 signature: extern func rt_flush_stdout() -> void;

L0 signature: extern func rt_flush_stderr() -> void;

Function _rt_print

1
void _rt_print(l0_string s, FILE *stream)

Internal helper to print an l0_string to a given stream.

Parameters:

  • s: String to print.
  • stream: Target stream.

Function rt_print

1
static void rt_print(l0_string s)

Print a string to stdout.

L0 signature: extern func rt_print(s: string) -> void;

Parameters:

  • s: String to print.

Function rt_print_stderr

1
static void rt_print_stderr(l0_string s)

Print a string to stderr.

L0 signature: extern func rt_print_stderr(s: string) -> void;

Parameters:

  • s: String to print.

Function rt_println

1
static void rt_println(void)

Print a newline to stdout.

Function rt_println_stderr

1
static void rt_println_stderr(void)

Print a newline to stderr.

L0 signature: extern func rt_println() -> void;

L0 signature: extern func rt_println_stderr() -> void;

Function rt_print_int

1
static void rt_print_int(l0_int x)

Print an integer to stdout.

L0 signature: extern func rt_print_int(x: int) -> void;

Parameters:

  • x: Integer value.

Function rt_print_int_stderr

1
static void rt_print_int_stderr(l0_int x)

Print an integer to stderr.

L0 signature: extern func rt_print_int_stderr(x: int) -> void;

Parameters:

  • x: Integer value.

Function rt_print_bool

1
static void rt_print_bool(l0_bool x)

Print a bool to stdout.

L0 signature: extern func rt_print_bool(x: bool) -> void;

Parameters:

  • x: Boolean value.

Function rt_print_bool_stderr

1
static void rt_print_bool_stderr(l0_bool x)

Print a bool to stderr.

L0 signature: extern func rt_print_bool_stderr(x: bool) -> void;

Parameters:

  • x: Boolean value.

Function rt_read_line

1
static l0_opt_string rt_read_line(void)

Read a line from stdin into a dynamically allocated buffer.

Returns None on EOF (no characters read).

  • Ownership: on Some(s), s.data is heap-allocated and must be freed by calling rt_string_release(s) (directly or indirectly via stdlib).

L0 signature: extern func rt_read_line() -> string?;

Returns: Optional string containing the line.

Function rt_read_char

1
static l0_int rt_read_char(void)

Read one character from stdin.

Returns -1 on EOF or error.

L0 signature: extern func rt_read_char() -> int;

Returns: Character value or -1.

Function rt_abort

1
static void rt_abort(l0_string message)

Abort the program with a panic message.

L0 signature: extern func rt_abort(message: string) -> void;

Parameters:

  • message: Panic message.

Function rt_exit

1
static void rt_exit(l0_int code)

Exit the program with the given exit code.

L0 signature: extern func rt_exit(code: int) -> void;

Parameters:

  • code: Exit code.

Function rt_srand

1
static void rt_srand(l0_int seed)

Seed the random number generator.

Uses current time if seed is 0.

L0 signature: extern func rt_srand(seed: int) -> void;

Parameters:

  • seed: Seed value.

Function rt_rand

1
static l0_int rt_rand(l0_int max)

Generate a random integer in the range [0, max).

Returns 0 if max <= 0.

L0 signature: extern func rt_rand(max: int) -> int;

Parameters:

  • max: Upper bound (exclusive).

Returns: Random value.

Function rt_errno

1
static l0_int rt_errno(void)

Get the current errno value.

L0 signature: extern func rt_errno() -> int;

Returns: errno value.

Function rt_alloc

1
static void * rt_alloc(l0_int bytes)

Allocate memory of the given size in bytes.

Returns NULL on allocation failure or if bytes is zero. Panics if bytes is negative, or too large to fit in size_t (platform-dependent).

L0 signature: extern func rt_alloc(bytes: int) -> void*?;

Parameters:

  • bytes: Size in bytes.

Returns: Pointer to allocated memory or NULL.

Function rt_realloc

1
static void * rt_realloc(void *ptr, l0_int new_bytes)

Reallocate a raw runtime allocation to a new size.

Returns NULL on failure. Panics if new_bytes is negative or too large to fit in size_t (platform-dependent). If ptr is NULL, behaves like rt_alloc.

L0 signature: extern func rt_realloc(ptr: void?, new_bytes: int) -> void?;

Parameters:

  • ptr: Pointer to memory, or NULL to allocate fresh.
  • new_bytes: New size.

Returns: Pointer to reallocated memory or NULL.

Function rt_free

1
static void rt_free(void *ptr)

Free a raw runtime allocation.

L0 signature: extern func rt_free(ptr: void*?) -> void;

Parameters:

  • ptr: Pointer to free.

Function rt_calloc

1
static void * rt_calloc(l0_int count, l0_int elem_size)

Allocate zeroed memory for an array of elements.

Returns NULL on allocation failure or if count/elem_size is negative.

L0 signature: extern func rt_calloc(count: int, elem_size: int) -> void*?;

Parameters:

  • count: Number of elements.
  • elem_size: Element size.

Returns: Pointer to zeroed memory or NULL.

Function rt_memset

1
static void * rt_memset(void *dest, l0_int value, l0_int bytes)

Set memory to a specific byte value.

Returns destination pointer.

L0 signature: extern func rt_memset(dest: void, value: int, bytes: int) -> void;

Parameters:

  • dest: Destination pointer.
  • value: Byte value.
  • bytes: Number of bytes.

Returns: dest.

Function rt_memcpy

1
static void * rt_memcpy(void *dest, void *src, l0_int bytes)

Copy memory from source to destination.

Returns destination pointer.

L0 signature: extern func rt_memcpy(dest: void, src: void, bytes: int) -> void*;

Parameters:

  • dest: Destination.
  • src: Source.
  • bytes: Number of bytes.

Returns: dest.

Function rt_memcmp

1
static l0_int rt_memcmp(void *a, void *b, l0_int bytes)

Compare two memory regions.

Returns 0 if equal, <0 if a < b, >0 if a > b.

L0 signature: extern func rt_memcmp(a: void, b: void, bytes: int) -> int;

Parameters:

  • a: First region.
  • b: Second region.
  • bytes: Number of bytes.

Returns: Comparison result.

Function rt_array_element

1
static void * rt_array_element(void *array_data, l0_int element_size, l0_int index)

Get a pointer to an element in an array.

Panics if array_data is NULL, element_size is non-positive, or index is negative.

L0 signature: extern func rt_array_element(array_data: void, element_size: int, index: int) -> void;

Parameters:

  • array_data: Pointer to array data.
  • element_size: Size of one element.
  • index: Element index.

Returns: Pointer to the element.

Function _rt_rec_new

1
static _rt_alloc_record * _rt_rec_new(_rt_alloc_record_cold **cold_out)

Take one record from the pool, refilling it chunk-wise.

Pool memory is never returned to the C allocator, so stale record pointers held by call-site caches remain safe to dereference.

Function _rt_rec_recycle

1
static void _rt_rec_recycle(_rt_alloc_record *rec)

Function _rt_alloc_hash

1
static size_t _rt_alloc_hash(void *ptr, size_t cap)

Function _rt_alloc_table_rehash

1
static void _rt_alloc_table_rehash(void)

Rebuild the hash table sized from the live record count.

Sizing from the live count (not the old capacity) keeps sustained alloc/free churn from ratcheting the table up: a tombstone-triggered rebuild purges tombstones at a stable or smaller capacity instead of doubling it, and a shrunken live set lets the table contract.

Function _rt_alloc_table_lookup

1
static _rt_alloc_record * _rt_alloc_table_lookup(void *ptr)

Function _rt_alloc_table_insert

1
static void _rt_alloc_table_insert(_rt_alloc_record *rec)

Function _rt_alloc_table_remove

1
static void _rt_alloc_table_remove(_rt_alloc_record *target)

Function _rt_panic_invalid_access

1
static void _rt_panic_invalid_access(const char *reason, void *ptr, const char *loc_file, int loc_line)

Function _rt_panic_invalid_drop

1
static void _rt_panic_invalid_drop(const char *reason, void *ptr, const char *loc_file, int loc_line)

Function _rt_panic_invalid_release

1
static void _rt_panic_invalid_release(const char *op_name, const char *reason, void *ptr, const char *loc_file, int loc_line)

Function _rt_trace_invalid_drop

1
static void _rt_trace_invalid_drop(void *ptr, const char *loc_file, int loc_line)

Function _rt_ptr_is_aligned

1
static int _rt_ptr_is_aligned(void *ptr, size_t align)

Function _rt_range_contains

1
static int _rt_range_contains(void *base, size_t total_size, void *ptr, size_t need_size, size_t *offset_out)

Function _rt_tree_prio_for

1
static uint32_t _rt_tree_prio_for(void *base)

Function _rt_tree_insert_at

1
static _rt_alloc_record * _rt_tree_insert_at(_rt_alloc_record *node, _rt_alloc_record *rec)

Function _rt_tree_merge

1
static _rt_alloc_record * _rt_tree_merge(_rt_alloc_record *a, _rt_alloc_record *b)

Merge two treaps where every base in a is below every base in b .

Function _rt_tree_remove_at

1
static _rt_alloc_record * _rt_tree_remove_at(_rt_alloc_record *node, void *base)

Function _rt_alloc_tree_insert

1
static void _rt_alloc_tree_insert(_rt_alloc_record *rec)

Function _rt_alloc_tree_remove

1
static void _rt_alloc_tree_remove(_rt_alloc_record *rec)

Function _rt_alloc_tree_glb

1
static _rt_alloc_record * _rt_alloc_tree_glb(void *ptr)

Return the tracked record with the greatest base at or below ptr .

Function _rt_alloc_tree_lub

1
static _rt_alloc_record * _rt_alloc_tree_lub(void *ptr)

Return the tracked record with the lowest base at or above ptr .

Function _rt_alloc_tree_find_containing

1
static _rt_alloc_record * _rt_alloc_tree_find_containing(void *ptr, size_t need_size)

Function _rt_ptr_site_store

1
static void _rt_ptr_site_store(_rt_ptr_site *site, _rt_alloc_record *owner)

Function _rt_required_size

1
static size_t _rt_required_size(l0_int required_size)

Function _rt_required_align

1
static size_t _rt_required_align(l0_int required_align)

Function _rt_index_element_size

1
static size_t _rt_index_element_size(l0_int element_size)

Function _rt_index_offset

1
static size_t _rt_index_offset(l0_int index, size_t element_size)

Function _rt_required_access_mode

1
static int _rt_required_access_mode(int access_mode)

Function _rt_index_access_mode

1
static int _rt_index_access_mode(int access_mode)

Function _rt_index_allows_untracked

1
static int _rt_index_allows_untracked(int access_mode)

Function _rt_check_ptr_align

1
static void _rt_check_ptr_align(void *ptr, size_t need_align, const char *loc_file, int loc_line)

Panic when a validated access target misses its required alignment.

Parameters:

  • ptr: Access target to check.
  • need_align: Required alignment; values below 2 always pass.
  • loc_file: Source file of the access site.
  • loc_line: Source line of the access site.

Function _rt_check_record_writeable

1
static void _rt_check_record_writeable(_rt_alloc_record *rec, void *ptr, int access_mode, const char *loc_file, int loc_line)

Function _rt_track_alloc_record_kind

1
static void _rt_track_alloc_record_kind(void *ptr, size_t size, size_t align, uint32_t type_id, int mem_kind, int read_only, const char *loc_file, int loc_line)

Function rt_register_foreign

1
static void rt_register_foreign(void *ptr, l0_int bytes, l0_bool read_only)

Register externally owned storage for checked generated pointer accesses.

Function rt_unregister_foreign

1
static void rt_unregister_foreign(void *ptr)

Unregister externally owned storage without releasing its payload.

Function _rt_evict_quarantine

1
static void _rt_evict_quarantine(void)

Function _rt_quarantine_alloc_record

1
static void _rt_quarantine_alloc_record(_rt_alloc_record *rec, _rt_alloc_record_cold *cold, const char *loc_file, int loc_line)

Function _rt_alloc_obj

1
static void * _rt_alloc_obj(l0_int bytes)

Function _rt_fmix32

1
static uint32_t _rt_fmix32(uint32_t x)

Final mixing function for 32-bit hashes (MurmurHash3 fmix32).

Parameters:

  • x: Current hash.

Returns: Mixed hash.

Function _rt_fold_u64_to_u32_fmix

1
static uint32_t _rt_fold_u64_to_u32_fmix(uint64_t h)

Fold a 64-bit hash into a 32-bit hash with final mixing.

Parameters:

  • h: 64-bit hash.

Returns: 32-bit hash.

Function _rt_hash_tag8

1
static l0_int _rt_hash_tag8(const _rt_siphash_tag8_t tag8, const uint8_t flags, const void *data, size_t len, const _rt_siphash_key_t key)

Internal helper to hash data with a given 8-byte tag and flags.

Parameters:

  • tag8: 8-byte tag.
  • flags: Flags.
  • data: Pointer to data.
  • len: Data length.
  • key: SipHash key.

Returns: 32-bit hash.

Function _rt_hash_bool

1
static l0_int _rt_hash_bool(l0_bool value, const uint8_t flags)

Hash a boolean value with the runtime bool tag.

Parameters:

  • value: Boolean value to hash.
  • flags: Type-shaping flags mixed into the hash domain.

Returns: 32-bit hash.

Function _rt_hash_byte

1
static l0_int _rt_hash_byte(l0_byte value, const uint8_t flags)

Hash a byte value with the runtime byte tag.

Parameters:

  • value: Byte value to hash.
  • flags: Type-shaping flags mixed into the hash domain.

Returns: 32-bit hash.

Function _rt_hash_int

1
static l0_int _rt_hash_int(l0_int value, const uint8_t flags)

Hash an integer value with the runtime int tag.

Parameters:

  • value: Integer value to hash.
  • flags: Type-shaping flags mixed into the hash domain.

Returns: 32-bit hash.

Function _rt_hash_string

1
static l0_int _rt_hash_string(l0_string str, const uint8_t flags)

Hash a string’s byte contents with the runtime string tag.

Parameters:

  • str: String value to hash.
  • flags: Type-shaping flags mixed into the hash domain.

Returns: 32-bit hash.

Function _rt_hash_data

1
static l0_int _rt_hash_data(void *data, l0_int size, const uint8_t flags)

Hash an arbitrary byte sequence with the runtime data tag.

Parameters:

  • data: Pointer to the byte sequence.
  • size: Size of data in bytes.
  • flags: Type-shaping flags mixed into the hash domain.

Returns: 32-bit hash.

Function rt_hash_bool

1
static l0_int rt_hash_bool(l0_bool value)

Hash a boolean value.

L0 signature: extern func rt_hash_bool(value: bool) -> int;

Parameters:

  • value: Boolean value.

Returns: 32-bit hash.

Function rt_hash_byte

1
static l0_int rt_hash_byte(l0_byte value)

Hash a byte value.

L0 signature: extern func rt_hash_byte(value: byte) -> int;

Parameters:

  • value: Byte value.

Returns: 32-bit hash.

Function rt_hash_int

1
static l0_int rt_hash_int(l0_int value)

Hash an integer value.

L0 signature: extern func rt_hash_int(value: int) -> int;

Parameters:

  • value: Integer value.

Returns: 32-bit hash.

Function rt_hash_string

1
static l0_int rt_hash_string(l0_string value)

Hash a string value.

L0 signature: extern func rt_hash_string(value: string) -> int;

Parameters:

  • value: L0 string.

Returns: 32-bit hash.

Function rt_hash_data

1
static l0_int rt_hash_data(void *data, l0_int size)

Hash raw data.

Panics if data is null or size is negative.

L0 signature: extern func rt_hash_data(data: void*, size: int) -> int;

Parameters:

  • data: Pointer to data.
  • size: Data size.

Returns: 32-bit hash.

Function rt_hash_opt_bool

1
static l0_int rt_hash_opt_bool(l0_opt_bool opt)

Hash an optional boolean value.

L0 signature: extern func rt_hash_opt_bool(opt: bool?) -> int;

Parameters:

  • opt: Optional bool.

Returns: 32-bit hash.

Function rt_hash_opt_byte

1
static l0_int rt_hash_opt_byte(l0_opt_byte opt)

Hash an optional byte value.

L0 signature: extern func rt_hash_opt_byte(opt: byte?) -> int;

Parameters:

  • opt: Optional byte.

Returns: 32-bit hash.

Function rt_hash_opt_int

1
static l0_int rt_hash_opt_int(l0_opt_int opt)

Hash an optional integer value.

L0 signature: extern func rt_hash_opt_int(opt: int?) -> int;

Parameters:

  • opt: Optional int.

Returns: 32-bit hash.

Function rt_hash_opt_string

1
static l0_int rt_hash_opt_string(l0_opt_string opt)

Hash an optional string value.

If opt is empty, hashes as an empty string with the optional flag.

L0 signature: extern func rt_hash_opt_string(opt: string?) -> int;

Parameters:

  • opt: Optional string.

Returns: 32-bit hash.

Function rt_hash_ptr

1
static l0_int rt_hash_ptr(void *ptr)

Hash a pointer value.

Note: this hashes the pointer value (address), not the data it points to. Panics if ptr is null.

L0 signature: extern func rt_hash_ptr(ptr: void*) -> int;

Parameters:

  • ptr: Pointer.

Returns: 32-bit hash.

Function rt_hash_opt_ptr

1
static l0_int rt_hash_opt_ptr(void *opt)

Hash an optional pointer value.

Note: this hashes the pointer value (address), not the data it points to. Panics if opt is empty (null pointer).

L0 signature: extern func rt_hash_opt_ptr(opt: void*?) -> int;

Parameters:

  • opt: Pointer.

Returns: 32-bit hash.

Struct _l0_h_string

Heap-allocated L0 string header.

L0 string: length-tracked, reference counted, immutable character sequence. Strings are always length-tracked to prevent out-of-bounds access. An l0_string with len=0 represents an empty string. Data should be NULL for empty strings to maintain consistency, but non-NULL is tolerated. refcount is used for memory management; if refcount == INT32_MAX, the string is not reference counted (e.g. allocated strings). Strings with refcount > 0 are reference counted and should be freed when refcount reaches zero. Strings with refcount == INT32_MAX are not ref-counted, but heap-allocated or empty, and should be freed manually. Strings with refcount == _RT_MEM_SENTINEL have already been freed (double-free detected). Data is null-terminated for C interoperability, but length is authoritative.

Member Data _l0_h_string::refcount

1
l0_int refcount

Reference count for memory management, or INT32_MAX if not reference counted.

Member Data _l0_h_string::len

1
l0_int len

Length in bytes (must be >= 0)

Member Data _l0_h_string::bytes

1
char bytes

Mutable character data, 0-terminated for C interoperability.

Struct l0_string

Unified L0 string type (static or heap-allocated).

Member Data l0_string::kind

1
unsigned int kind: 1

Kind of string: either L0_STRING_K_STATIC (0) or L0_STRING_K_HEAP (1)

Member Data l0_string::int

1
unsigned int: 0

Align to next unsigned int boundary.

Member Data l0_string::len

1
l0_int len

Length in bytes (for constant inline strings)

Member Data l0_string::bytes

1
const char* bytes

Pointer to character data (may be NULL for empty string)

Member Data l0_string::s_str

1
struct l0_string s_str

Static string structure for constant inline strings.

Member Data l0_string::h_str

1
_l0_h_string* h_str

Heap-allocated string structure for dynamic strings.

Member Data l0_string::data

1
union l0_string data

Struct l0_opt_bool

Optional boolean wrapper.

Member Data l0_opt_bool::has_value

1
l0_bool has_value

Member Data l0_opt_bool::value

1
l0_bool value

Struct l0_opt_byte

Optional byte wrapper.

Member Data l0_opt_byte::has_value

1
l0_bool has_value

Member Data l0_opt_byte::value

1
l0_byte value

Struct l0_opt_int

Optional integer wrapper.

Member Data l0_opt_int::has_value

1
l0_bool has_value

Member Data l0_opt_int::value

1
l0_int value

Struct l0_opt_string

Optional string wrapper.

Member Data l0_opt_string::has_value

1
l0_bool has_value

Member Data l0_opt_string::value

1
l0_string value

Struct _l0_base_opt

Base structure for optional types to access has_value .

Member Data _l0_base_opt::has_value

1
l0_bool has_value

Struct l0_sys_rt_RtTimeParts

Definition for sys.rt::RtTimeParts .

Member Data l0_sys_rt_RtTimeParts::sec

1
l0_int sec

Member Data l0_sys_rt_RtTimeParts::nsec

1
l0_int nsec

Struct l0_sys_rt_RtFileInfo

Definition for sys.rt::RtFileInfo .

Member Data l0_sys_rt_RtFileInfo::exists

1
l0_bool exists

Member Data l0_sys_rt_RtFileInfo::is_file

1
l0_bool is_file

Member Data l0_sys_rt_RtFileInfo::is_dir

1
l0_bool is_dir

Member Data l0_sys_rt_RtFileInfo::size

1
l0_opt_int size

Member Data l0_sys_rt_RtFileInfo::mtime_sec

1
l0_opt_int mtime_sec

Member Data l0_sys_rt_RtFileInfo::mtime_nsec

1
l0_opt_int mtime_nsec

Struct _rt_alloc_record

Hot allocation fields read by checked pointer cache hits and allocation tracker mutation paths.

Records are pool-allocated and never freed, so a stale record pointer held by a call-site cache stays dereferenceable; the generation counter rejects reuse.

Member Data _rt_alloc_record::base

1
void* base

Member Data _rt_alloc_record::size

1
size_t size

Member Data _rt_alloc_record::generation

1
uint64_t generation

Member Data _rt_alloc_record::tree_left

1
_rt_alloc_record* tree_left

Member Data _rt_alloc_record::tree_right

1
_rt_alloc_record* tree_right

Member Data _rt_alloc_record::q_next

1
_rt_alloc_record* q_next

Member Data _rt_alloc_record::tree_prio

1
uint32_t tree_prio

Member Data _rt_alloc_record::cold_index

1
uint32_t cold_index

Member Data _rt_alloc_record::state

1
uint8_t state

Member Data _rt_alloc_record::read_only

1
uint8_t read_only

Member Data _rt_alloc_record::mem_kind

1
uint8_t mem_kind

Member Data _rt_alloc_record::hot_pad

1
uint8_t hot_pad

Struct _rt_alloc_record_cold

Cold allocation fields used by diagnostics and rare metadata reads.

Member Data _rt_alloc_record_cold::align

1
size_t align

Member Data _rt_alloc_record_cold::type_id

1
uint32_t type_id

Member Data _rt_alloc_record_cold::alloc_line

1
int alloc_line

Member Data _rt_alloc_record_cold::drop_line

1
int drop_line

Member Data _rt_alloc_record_cold::reserved

1
uint32_t reserved

Member Data _rt_alloc_record_cold::alloc_file

1
const char* alloc_file

Member Data _rt_alloc_record_cold::drop_file

1
const char* drop_file

Struct _rt_ptr_site

Per-call-site pointer check cache.

Generated code declares one static instance per checked access site; a hit validates with one generation compare and one range check, without hashing.

Member Data _rt_ptr_site::owner

1
_rt_alloc_record* owner

Member Data _rt_ptr_site::generation

1
uint64_t generation