[Stack Switching] Fix binary writing of continuation types when GC is not enabled#7827
[Stack Switching] Fix binary writing of continuation types when GC is not enabled#7827kripken wants to merge 3 commits intoWebAssembly:mainfrom
Conversation
tlively
left a comment
There was a problem hiding this comment.
This doesn't seem right. If GC is not enabled, so we only have reference types, then e.g. a local variable holding a reference to a particular function type should be emitted as funcref whether or not stack switching is also enabled.
How does CallIndirect emit its function type index? We should do the same when emitting a continuation type definition.
|
Ah, good point, I had a vague worry like that, but didn't see tests fail so I figured I was confused... Fixed like callIndirect, and simplifed callIndirect too. |
| (cont.new $cont | ||
| (ref.func $main) | ||
| ) |
There was a problem hiding this comment.
Actually, this doesn't make any sense without typed function references. If the ref.func is just a funcref, then there's no way to validate that the continuation type has the the same parameters as the type of the function reference it is initialized with.
And we don't differentiate between typed-function-references and gc as features, so continuations without GC simply don't make sense.
There was a problem hiding this comment.
Wait, wasn't there an effort to avoid continuations from depending on GC?
Anyhow, I'm fine with making stack switching depend on GC, is that the right thing then?
There was a problem hiding this comment.
Yes, but they still depend on typed function references, and we don't differentiate between that and GC. So making stack switching depend on GC is the right thing for our purposes. We can revisit this in the future (probably by adding a separate typed-function-references feature again) if anyone really needs it.
Stack switching depends on part of GC, at least atm. See #7827 (comment)
Continuation types refer to a Function type, and the old code was
emitting a top type instead of that function type, which is invalid.