Checked bounded-read fusion experiment
Status: candidate only, against acbb2d7; not accepted production behavior.
The format-9 geometry already places the actor bootstrap, live bitmap for its first arena, owner/index records and first descriptor page in the first retained 64-KiB tracking region. The logical first data byte is 25,088. Actor construction allocates owner/index records before the 16-KiB descriptor allocation, so that page starts at 41,472, and its payload starts at 41,536. The retained backend adds its 16-MiB plus 64-byte base. Shrinking the band or descriptor page therefore has no demonstrated way to remove the first ordinary metadata region access; this experiment leaves geometry unchanged.
The candidate instead changes StoreRead::with_bounded_block_bytes on cold block
admission. Map's public root currently reads the 64-byte allocation header,
then the bounded payload; private descendants already use one bounded read.
On the measured IC implementation an initial stable read can copy directly,
while a second overlapping read can map the tracking region. Combining header
and payload might avoid that promotion. RTree and external sequence values use
the same public author interface and can benefit without special Store support.
For a maximum payload of at most 3,968 bytes contained within the existing arena data extent, the candidate checks the resource and independent live-start bit, then reads the 64-byte header plus the requested maximum in one backing call. The same allocation header checks, resource owner, incarnation, public-payload kind and requested min/max bounds run before the application callback. It gets only the actual admitted payload slice. Already admitted blocks retain the existing exact-payload path, as do large maxima and arena-tail requests.
This intentionally changes the old promise that a rejected allocation length
cannot grow scratch. Cold preflight is bounded to 4,032 bytes even for invalid
lengths. Extra internally copied bytes can include neighboring allocations;
none are exposed. The Memory contract initializes all grown backing bytes,
and the read remains inside existing arena data. A smaller actual allocation
can copy more bytes than the old path, so both small and large collections must
be measured. There is no persistent cache, new format, weaker handle authority,
collection privilege, transaction journal or application API change.
Apply fused-bounded-read.patch and fused-bounded-read-tests.patch together.
The latter adds copied/lent backing coverage for both placements, read and write
scopes, nested immutable access, exact callback slices, cached exact-range reads,
wrong allocation ownership/incarnation and rejected lengths. It deliberately
updates the old scratch-allocation assertion. Existing private-pool rejection,
interior stale-header and lifecycle tests still apply. Full qualification and
performance acceptance remain pending.