ReviewOS

zig-utils/zig-js

Cache VM statement locations per interpreter in shared realms

#441
Closed chris opened this 11 days ago ·
11 days ago

Problem

The comparison benchmark exposed severe shared-realm debug-registry contention. Registered AST-node locations are immutable, so synchronized misses can safely feed an interpreter-local cache.

Acceptance

  • VM and tree-walker statement-location reads share an interpreter-local cache.
  • Cache misses remain synchronized in shared realms; cached values own copied location data.
  • Debug hooks, stack-frame locations, dynamic scripts, and exception locations retain exact behavior.
  • Focused normal and TSan coverage proves cache hits and concurrent publication safety.
  • The eight-lane arithmetic comparison returns near the accepted scale and the complete matrix is regenerated.

Result

fd206c6 adds a 64-entry direct-mapped cache shared by VM and tree-walker statement lookup. The focused debug filter passes 16/16 normally and under TSan. The complete suite passes 1,404/1,404. After the batched contention fixes, the exact eight-lane arithmetic reproducer returned to 2.308 seconds and the published clean matrix records 2.569 seconds median.

11 days ago

Completed by fd206c6 and verified normally, under TSan, in the clean comparison matrix, and in the full 1,404/1,404 suite.

Sign in to comment on this issue.