Skip to main content

Module v2_struct_layout

Module v2_struct_layout 

Source
Expand description

Compile-time repr(C) struct layout computation for the v2 runtime.

Given a type definition like type Point { x: number, y: number }, this module computes the exact byte layout with field offsets as compile-time constants:

#[repr(C)]
struct PointLayout {
    header: HeapHeader,   // 8 bytes (offset 0)
    x: f64,               // 8 bytes (offset 8)
    y: f64,               // 8 bytes (offset 16)
}

Field access compiles to a direct load at a known offset: point.x becomes load f64 [ptr + 8]. No schema lookup, no HashMap, no runtime dispatch.

Structs§

StructFieldLayout
Layout information for a single field within a struct.
StructLayout
Complete layout of a repr(C) struct including its v2 heap header.

Enums§

FieldType
Primitive field types with known sizes and alignments.

Constants§

V2_HEADER_ALIGN
Alignment of the v2 heap header.
V2_HEADER_SIZE
Size of the v2 heap header in bytes.

Functions§

compute_struct_layout
Compute the repr(C) struct layout for a named type with the given fields.