Skip to content

Avoid newly exposing prototypes in GTO - #9043

Open
tlively wants to merge 1 commit into
mainfrom
fix-9026
Open

Avoid newly exposing prototypes in GTO#9043
tlively wants to merge 1 commit into
mainfrom
fix-9026

Conversation

@tlively

@tlively tlively commented Aug 26, 2026

Copy link
Copy Markdown
Member

When GTO removes fields or makes them immutable, it may introduce an immutable externref first field on the descriptor of a JS-exposed type where there was none before. That means that the described type could now have a JS-observable prototype where it did not before optimization, which makes this a misoptimization.

Fix the problem by inserting an i8 placeholder first field wherever we would otherwise start exposing a prototype where there was none before. This is expected to be exceptionally rare in practice, so the extra memory use is not expected to be a real problem.

Instead of adding a placeholder field, we could have inhibited optimization of the existing first field, but that would be more likely than an unaccessed placeholder field to have adverse effects in later passes.

@tlively
tlively requested a review from a team as a code owner August 26, 2026 01:34
@tlively
tlively requested review from aheejin and removed request for a team August 26, 2026 01:34
When GTO removes fields or makes them immutable, it may introduce an immutable externref first field on the descriptor of a JS-exposed type where there was none before. That means that the described type could now have a JS-observable prototype where it did not before optimization, which makes this a misoptimization.

Fix the problem by inserting an i8 placeholder first field wherever we would otherwise start exposing a prototype where there was none before. This is expected to be exceptionally rare in practice, so the extra memory use is not expected to be a real problem.

Instead of adding a placeholder field, we could have inhibited optimization of the existing first field, but that would be more likely than an unaccessed placeholder field to have adverse effects in later passes.

Fixes #9026.
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