Skip to content

Handle more types exposed to JS in GTO#8454

Open
tlively wants to merge 2 commits intomainfrom
gto-jsinterop-subtypes-exports
Open

Handle more types exposed to JS in GTO#8454
tlively wants to merge 2 commits intomainfrom
gto-jsinterop-subtypes-exports

Conversation

@tlively
Copy link
Member

@tlively tlively commented Mar 11, 2026

GTO already handled keeping the prototype configuration fields on
descriptors of types that flowed out to JS via @binaryen.js.called
functions, but it did not handle propagating the information that a
type flows out to JS to that type's subtypes. It also did not consider
that types may flow out to JS via imports and exports. Fix these issues.

GTO already handled keeping the prototype configuration fields on
descriptors of types that flowed out to JS via @binaryen.js.called
functions, but it did not handle propagating the information that a
type flows out to JS to that type's subtypes. It also did not consider
that types may flow out to JS via imports and exports. Fix these issues.
@tlively tlively requested a review from kripken March 11, 2026 22:18
if (global->imported() && global->mutable_) {
flowOut(global->type);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can share this logic with your last PR? a general utility that finds the flow out/flow in JS stuff.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yes, that's a good idea. Do you mind if I do it as a follow-up?

(type $sub-desc (describes $sub) (struct (field externref i64)))
)

;; $super flows out, so $sub is exposed, so $sub-desc field is kept.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
;; $super flows out, so $sub is exposed, so $sub-desc field is kept.
;; $super flows out, so $sub is exposed, so $sub-desc's externref field is kept.


(module
;; Same, but now the type is exact on the boundary, so it does not propagate
;; exposure to subtypes. We can optimize $sub-desc.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
;; exposure to subtypes. We can optimize $sub-desc.
;; exposure to subtypes. We can remove all $sub-desc's fields, unlike before.


(module
;; Same, but now there is an abstract supertype on the boundary. We still
;; propagate expose and keep the externref field in $sub-desc.
Copy link
Member

Choose a reason for hiding this comment

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

"propagate expose"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will fix to "propagate the fact that the type flows out..."

@tlively tlively enabled auto-merge (squash) March 12, 2026 00:35
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