Skip to content

[GTO] Avoid newly exposing prototypes when supertype fields are removed - #9278

Merged
tlively merged 1 commit into
mainfrom
gto-super-no-kept-fields-proto
Oct 19, 2026
Merged

tlively merged 1 commit into
mainfrom
gto-super-no-kept-fields-proto

Conversation

@tlively

@tlively tlively commented Oct 19, 2026

Copy link
Copy Markdown
Member

When GlobalTypeOptimization removes all fields from a non-empty supertype descriptor, a subtype descriptor whose unread supertype fields are also removed can shift a subsequent externref field to index 0. Check whether the supertype retained any kept fields after removal (!superHasKeptFields) rather than checking whether the unoptimized supertype had empty fields (!super->getStruct().fields.empty()) when deciding whether to insert an i8 placeholder at index 0 for exposedNoProtoDescs.

When GlobalTypeOptimization removes all fields from a non-empty supertype descriptor, a subtype descriptor whose unread supertype fields are also removed can shift a subsequent externref field to index 0. Check whether the supertype retained any kept fields after removal (!superHasKeptFields) rather than checking whether the unoptimized supertype had empty fields (!super->getStruct().fields.empty()) when deciding whether to insert an i8 placeholder at index 0 for exposedNoProtoDescs.
@tlively
tlively requested a review from a team as a code owner October 19, 2026 17:37
@tlively
tlively requested review from kripken and removed request for a team October 19, 2026 17:37

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes an issue in GlobalTypeOptimization where a type with a supertype whose fields were all removed during optimization was not correctly identified as having no kept fields. This caused it to miss adding a placeholder at index 0 to prevent prototype exposure. The fix introduces a superHasKeptFields flag to track if any fields from the supertype are actually kept, and updates the condition to use this flag. A corresponding test case has been added to verify the behavior. I have no feedback to provide.

@tlively
tlively merged commit 64f128f into main Oct 19, 2026
16 checks passed
@tlively
tlively deleted the gto-super-no-kept-fields-proto branch October 19, 2026 20:14
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.

2 participants