ReviewOS

zig-utils/zig-js

JIT: snapshot named-property ICs into optimizer artifacts

#440
Closed chris opened this 9 days ago ·
9 days ago

Parent: #132 Related: #433, #146, #429

The runtime-operation ABI executes named reads/writes, but optimizer artifacts currently discard the warmed bytecode inline cache and therefore re-enter generic property lookup on every native callback. Preserve the existing four-entry shape/slot contract as immutable artifact metadata before direct backend inlining.

Acceptance

  • Add a stable bytecode-IC snapshot operation that uses the existing seqlock protocol in parallel mode and never publishes torn shape/slot pairs.
  • Copy monomorphic/polymorphic named-property snapshots into optimizer-owned metadata without retaining mutable cache storage.
  • Use exact live-shape, ordinary-object, accessor/attribute/proxy/array, slot-range, and shared-mutation guards for native named reads and existing-slot writes.
  • Preserve canonical generic fallback, assignment results, GC barriers, exceptions, exact steps, stack maps, and nested completion behavior.
  • Add focused monomorphic/polymorphic, shape-transition, accessor/proxy, shared-write, malformed-metadata, and ownership tests.
  • Pass focused JIT/full-root evidence and the relevant suppression-free TSan gate; update #132/#433 documentation without changing benchmark scores until the profile workload is rerun.

This child is intentionally backend-neutral. #132 retains direct generated-code lowering, complete native-on/off differential coverage, and exact-parent profile evidence.

9 days ago

Completed on main through 87513c2 (implementation 7a26276, docs 87513c2). Optimizer artifacts now own stable four-entry named-property IC snapshots copied through the existing seqlock protocol. Native reads and existing-slot writes guard live shape, slot bounds, ordinary-object state, accessors/attributes, arrays, and proxies; misses and malformed metadata fall back canonically, writes preserve the GC barrier, and parallel access uses the object lock. Evidence: property-cache full-root TSan 5/5, named property/getter/setter/proxy integration 7/7, and broad JIT TSan 165/165, all with zero failures, skips, or leaks. Benchmark scores are unchanged pending #132 direct lowering and its exact-parent profile.

Sign in to comment on this issue.