Parent: #62
Follows: #74 / cfed7bc
After hoisting immutable shape validation, the fresh object_churn profile attributes 325 top-of-stack samples to Interpreter.checkRestricted and 227 to Object.replaceDenseElement. The structurally quickened path is already disabled for parallel/shared execution and escaped frames, performs no calls or other re-entry, validates a dense hole-free ordinary array at entry, and checks each selected index before mutation. Repeating the thread restriction check and dense presence/lock guards for every replacement is therefore redundant inside one quick chunk.
Scope:
- expose a non-throwing restriction-access predicate shared with checkRestricted
- at quick-loop entry, fall back to ordinary bytecode when the current thread cannot access the receiver so the eventual error retains its exact bytecode position
- add an explicitly exclusive known-present dense replacement helper that retains the GC insertion barrier but omits locks, bounds, and hole probes
- call it only after the isolated/no-reentry path has validated array shape and the current element index
- leave shared/no-GIL and all generic element operations unchanged
Acceptance:
- direct tests cover allowed/unrestricted and rejected foreign restriction ownership
- exclusive replacement retains the stored object/value and GC barrier path; the VM exact result/step and Proxy/accessor fallbacks remain green
- profile removes per-iteration checkRestricted and generic replaceDenseElement overhead while retaining header/barrier attribution
- pinned
cfed7bcA/B is repeatably faster with exact checksums - run the full unit plus benchmark-harness suite once after the measured win
- commit references this issue and is pushed as Chris without coauthors