Lazy shape computation
Date: 2026-06-11
Area: bytecode
Shape-lite landed with one refinement over the design entry below: shapes are computed lazily at cache-fill time (EnsureShape resumes from the stale prefix shape) instead of eagerly at property-append time, because a stale shape is a true prefix description of an append-only layout — the hit path reads it raw and at worst misses. This removed the measured 3–6% object-construction overhead of eager maintenance while keeping the can't-bypass property (only Remove/Clear, which break append-only, are intercepted on the map). The method-holder tier also shifted from the designed class-method-table validation to a pure prototype-holder cache validated by fresh shape identity per chain level, after code reading showed bytecode classes install methods as data properties on the prototype object and map entry versions cannot prove continued absence (appends don't re-stamp). Fill declines advance the megamorphic streak so uncacheable sites converge to dormant. Measured (interleaved 3× medians): cross-instance field reads +26%, own-class method dispatch +16.5% and inherited +15.1% on top of the own tier, object/class median within ±1% noise; zero per-test test262 status changes across built-ins/Object, language/statements/class, and built-ins/Proxy. bytecode-vm.md § Inline Caches.