Expand description
TypedObject - Fixed-layout objects for JIT optimization
TypedObject provides O(1) field access by pre-computed byte offsets, eliminating HashMap lookups entirely. This is the core optimization for type-specialized JIT code.
§Memory Layout
+-------------+-------------+-------------+-------------+
| schema_id | ref_count | field[0] | field[1] | ...
| (4 bytes) | (4 bytes) | (8 bytes) | (8 bytes) |
+-------------+-------------+-------------+-------------+
Header (8 bytes) Data (field_count * 8 bytes)§Performance
| Operation | HashMap | TypedObject | Speedup |
|---|---|---|---|
| Single field get | ~25ns | ~2ns | 12.5x |
| Single field set | ~30ns | ~2ns | 15x |
| 5 fields batch | ~125ns | ~10ns | 12.5x |
Structs§
- Typed
Object - A typed object with fixed field layout for O(1) access.
Constants§
- TYPED_
OBJECT_ ALIGNMENT - Memory alignment for TypedObject allocation. 64-byte alignment for L1 cache line optimization and SIMD operations.
- TYPED_
OBJECT_ HEADER_ SIZE - Header size in bytes (schema_id + ref_count)
Functions§
- jit_
new_ typed_ object - Allocate and initialize a new typed object with field values.
- jit_
typed_ merge_ object - Merge two TypedObjects into a new TypedObject.
- jit_
typed_ object_ alloc - Allocate a new typed object.
- jit_
typed_ object_ dec_ ref - Decrement reference count on a typed object. Frees the object if ref_count reaches 0.
- jit_
typed_ object_ from_ hashmap - Create a typed object from a HashMap-based object.
- jit_
typed_ object_ get_ field - Get a field from a typed object by byte offset.
- jit_
typed_ object_ inc_ ref - Increment reference count on a typed object.
- jit_
typed_ object_ schema_ id - Get the schema ID from a typed object.
- jit_
typed_ object_ set_ field - Set a field on a typed object by byte offset.