Browse documentation

Shape-lite inline cache design

Date: 2026-06-11 Area: bytecode

Shape-lite design for the VM property-read inline caches. Shapes are per-realm interned key-sequence identities — keys only, no prototype pointer and no attribute flags — owned through a realm-owned slot and compared by pointer identity; own-tier cache entries carry no version field because shaped property maps are append-only (delete/clear flips the map to a dictionary-mode sentinel) and function templates never outlive their engine. Shape maintenance lives in a shape-aware property map (TGocciaShapedPropertyMap overriding Add/Remove/Clear in Goccia.Values.Shape.pas) rather than in DefineProperty/AssignProperty call sites, so every existing direct map mutation stays correct without a call-site audit and the Define vs Assign pattern is unchanged. Two cache tiers: own data properties validated by (shape, entry index); direct-class method holders validated by (shape, class identity, class method-table version, instance-prototype map identity + version), inherited methods staying on the generic path. Acceptance gates before landing: cross-instance field reads ≥10% on a new benchmark, instance-method calls ≥5% for the holder tier (dropped otherwise), object/class benchmark median ≥ −1%, zero test262 per-test status changes including built-ins/Proxy. CONTEXT.md (Shape, Dictionary mode). bytecode-vm.md § Inline Caches.