ReviewOS

zig-utils/zig-js

VM: quicken distant sparse array creation

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

Parent: #498 Related: #1049, #1050, #1051, #1052, #493

Measured problem

The executed sparse-store VM witness confirms that creating the first distant Array index (for example values[1000000] = 7) produces the correct sparse own property and length but leaves the sparse-store quick counter unchanged. Only a later replacement of that property is quickened.

Scope

  • Add an exact create-only path for distant primitive Number and canonical String Array indices.
  • Publish the named own data property and sparse Array length under the indexed/property/element synchronization contract.
  • Recheck exact own accessors/data, attributes, extensibility, dense representation, restriction ownership, and the prototype chain at mutation time.
  • Preserve inherited setters/non-writable data, frozen length, own accessors/descriptors, Proxies, object/Symbol/non-canonical keys, strict failure, OOM behavior, and no-GIL safety.
  • Add a dedicated hit counter and update the source-derived quickening inventory and generated architecture page.

Acceptance

  • The pre-change generic-creation witness records positive sparse-creation hits with identical Node results.
  • Multiple distant Number and canonical String creations update Array length and read back exactly.
  • Existing sparse data uses the replacement path; exact accessors/descriptors and dense indices are never consumed by creation.
  • Prototype interceptors, frozen length, non-extensibility, Proxies, and observable/generic keys stay generic.
  • Receiver/prototype restriction ownership and unsuppressed TSan coverage pass.
  • Quickening inventory, benchmark-validator, docs-manifest, and offline-link gates pass.
9 days ago

Implemented and pushed in 14ec355.

Distant primitive Number and canonical String Array indices now use a create-only path. The path rejects published JIT shape dependencies, proves a clean restriction-owned prototype chain, then rechecks receiver descriptors, extensibility, exact own state, and dense eligibility while publishing sparse length and the named data property under the indexed/property/element synchronization contract.

Measured evidence:

  • The pre-change creation witness remained generic; the completed isolated/shared matrix records positive sparse-creation hits.
  • The 11-case behavior matrix matches Node exactly.
  • The consolidated sparse-array suite passes 8/8 in normal and 8/8 in unsuppressed TSan builds, including receiver/prototype ownership and own-key enumeration.
  • Canonical String and dense-creation neighboring tests pass 2/2 each.
  • Quickening inventory: 17 guarded families, 5 unsupported families, and 41 observability counters.
  • Aggregate benchmark validators: 19/19.
  • Documentation: 51 pages generated and all 378 offline links resolve.

The test262 corpus is unavailable in this checkout, so no conformance-flip claim is made.

Sign in to comment on this issue.