Skip to content

Fix raw SetProperty on builtin-shaped hosts landing in an invisible dictionary#2591

Merged
lahma merged 1 commit into
sebastienros:mainfrom
lahma:fix-setproperty-shaped-host
Jul 6, 2026
Merged

Fix raw SetProperty on builtin-shaped hosts landing in an invisible dictionary#2591
lahma merged 1 commit into
sebastienros:mainfrom
lahma:fix-setproperty-shaped-host

Conversation

@lahma

@lahma lahma commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

`SetProperty(Key, ...)` deopted hidden-class \ShapeMode\ objects before storing a raw descriptor, but not \BuiltinShapeMode\ hosts: the write created a side _properties\ dictionary that the shape-mode read paths never consult, so the property silently did not exist. Reachable through the public \FastSetProperty\ API on any shaped built-in (\Math, \JSON, prototypes, ...) since the shapes migration.

Regression test included (raw store on shaped \Math: value visible, enumerable via \getOwnPropertyNames, existing shape members still functional after the deopt).

Verification

  • \Jint.Tests\ green (net10.0 + net472), \Jint.Tests.PublicInterface\ green
  • Full test262: 99,260 passed, 0 failed

🤖 Generated with Claude Code

…ictionary

SetProperty(Key, ...) deopted hidden-class ShapeMode objects before storing
a raw descriptor, but not BuiltinShapeMode hosts: the write created a side
_properties dictionary that the shape-mode read paths never consult, so the
property silently did not exist. Reachable through the public
FastSetProperty API on any shaped built-in (Math, JSON, prototypes, ...)
since the shapes migration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lahma
lahma force-pushed the fix-setproperty-shaped-host branch from f002ba9 to 755b6ca Compare July 6, 2026 19:00
@lahma

lahma commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Note for reviewers: while writing the regression test I found a related but distinct pre-existing edge — a raw \SetProperty/\FastSetProperty\ issued before a generated host's lazy \Initialize\ has run gets wiped when initialization later replaces the property bag (\SetProperties), and that affects dictionary-path hosts too, not just shaped ones. This PR intentionally fixes only the post-initialization shaped-host case (the write landing in a dictionary the shape reads never consult); the pre-init store is left as a separate issue since it predates the shapes work.

@lahma
lahma enabled auto-merge (squash) July 6, 2026 19:25
@lahma
lahma merged commit ebfc47e into sebastienros:main Jul 6, 2026
7 of 8 checks passed
lahma added a commit that referenced this pull request Jul 9, 2026
…2601)

A raw SetProperty/FastSetProperty on a lazily-initialized host landed in
_properties (or _symbols) without triggering initialization; the first
read then ran Initialize(), whose generated CreateProperties_Generated/
CreateSymbols_Generated replaced the bag wholesale via SetProperties/
SetSymbols and silently dropped the earlier write. Documented as a known
edge in #2591's review; affects dictionary hosts and shaped hosts alike.

SetProperty(Key) and the symbol arm of SetPropertyUnlikely now run
EnsureInitialized() first, so raw stores always apply on top of the
initialized state - dictionary hosts append to the installed bag and
builtin-shaped hosts route through the hybrid side-dictionary arm.

EngineConstruction A/B: allocation byte-identical (6.63 KB BuildEngine,
7.24 KB EvaluateSimple), time within noise - nothing in engine or realm
construction hits the new initialization path.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@lahma
lahma deleted the fix-setproperty-shaped-host branch July 13, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant