Beagle SCM
JS-106: index bulk-load crosses the JS/C boundary once per element
Proposed by the 2026-07-07 jab multi-agent review; confirmed by both skeptic verifiers. Indexing a pack marshals each entry JS->C individually although P.scan already emitted them contiguously in native memory.
Input
Context
idx.put = function (k, v) { this.mem.push(BigInt(k), BigInt(v)); ... } (jab cont.cpp:629) — one native call per entry; jheap_wh128_push (heap.hpp:56) redoes JABCBytesOf (~4 JSC API calls) plus two JSValueToUInt64 each time.
- P.scan (cont.cpp:219-227) already emits n contiguous wh128 entries zero-copy into a Buf; the documented flow then loops idx.put per entry — BigInts read out of a BigUint64Array only to be marshalled back one at a time.
- A 10^5-10^6 object pack pays ~10 JSC calls + a heap sift per entry where one memcpy-shaped bulk feed would do.
Goals
- A bulk leaf
_heap_<lane>_feed(arr, size, entries) -> newsize + mem.feed(view) sugar; the pack-index flow uses it.
Constraints
- Bindings hold no memory (JS owns the buffers); the leaf validates argc per JS-101.
WIP
TODOs