Raw object layer: construction, slot and metadata access, FFI handles, on the Obj class.
ns
objis de-registered – no bare names; boot/hot callers fetch from the catalog.
Obj(Obj make ts n)Allocate a raw typed object with N nil slots (the Vector pattern: slot 0 = length).
GC CONTRACT: raw slots are traced only if the TYPE declares units – ((prim-ref ‘type ‘set-units!) ts -1) for slot-0-counted sizes (the Vector convention), or a fixed count. Without it a collect frees the payloads under the object (the Dict-across-a-REPL-turn segfault class).
Parameters:
ANY — Type handle (from Type of / make-type)INT — Number of slotsReturns: ANY — The new object
(Obj ref obj i)Read slot I of a raw object.
Parameters:
ANY — ObjectINT — Slot index (0-based)Returns: ANY — The slot value
(Obj set! obj i v)Write slot I of a raw object.
Parameters:
ANY — ObjectINT — Slot index (0-based)ANY — Value to storeReturns: ANY — nil
(Obj ->ptr obj)The raw pointer of an object (FFI handle; see also Ptr).
Parameters:
ANY — ObjectReturns: ANY — A PTR to the object’s storage
(Obj meta-count)The base-wide extra-metadata slot count (0 = metadata disabled).
Returns: INT — Current extra-slot count
(Obj meta-count! n)Set the base-wide extra-metadata slot count; objects allocated afterwards carry N extra slots. BOOT-TIME POLICY: setting a width DIFFERENT from the current one while allocated objects are live is undefined – the engine frees each object’s prefix at the width current at COLLECT time, so older objects are freed at the wrong address (x-engine-c#21). Setting the value it already holds is safe.
Parameters:
INT — Extra slots to reserve per objectReturns: INT — The previous extra-slot count
(Obj meta-ref obj i)Read metadata slot I of an object (e.g. coverage flags, source line).
Parameters:
ANY — ObjectINT — Metadata slot indexReturns: ANY — The metadata value
(Obj meta-set! obj i v)Write metadata slot I of an object.
Parameters:
ANY — ObjectINT — Metadata slot indexANY — Value to storeReturns: ANY — nil
(Obj make-callable p)Wrap a C function pointer as a callable primitive object.
Parameters:
ANY — C function pointer (PTR, e.g. from the JIT or dlsym)Returns: CALLABLE — The new callable