-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
threads: add WasmCompositeInnerType
layer
#9520
Conversation
As in `wasm-tools`, push the type down a layer so that `WasmCompositeType` can be marked shared. This leaves several holes to be filled in by future commits (all marked with `TODO: handle shared`); in effect, this change allows `WasmCompositeType` to be marked shared but mostly does not wire up the sharedness during translation.
Subscribe to Label Actioncc @fitzgen
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:ref-types"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked about this a bit with @abrown yesterday but I wanted to paste the conclusion here as well. My general worry as we propagate this up further is that it's accidentally easy to forget to check .shared
which means that further down the road we might have a bug of "oh forgot to check .shared
there". I'd prefer to continue to panic/error in variuos places where shared
isn't handled today and I've commented a few of them here and there.
assert!(!ty.composite_type.shared); | ||
let gc_layout = match &ty.composite_type.inner { | ||
wasmtime_environ::WasmCompositeInnerType::Func(_) => None, | ||
wasmtime_environ::WasmCompositeInnerType::Array(a) => Some( | ||
gc_runtime | ||
.expect("must have a GC runtime to register array types") | ||
.layouts() | ||
.array_layout(a) | ||
.into(), | ||
), | ||
wasmtime_environ::WasmCompositeInnerType::Struct(s) => Some( | ||
gc_runtime | ||
.expect("must have a GC runtime to register array types") | ||
.layouts() | ||
.struct_layout(s) | ||
.into(), | ||
), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up removing the refactor we used in this PR. Though indeed we could have done gc_runtime.map(...).flatten()
and ended up with the same result, I'm concerned that @fitzgen probably is using these expect
s as an early warning sign for winch, e.g.
As in
wasm-tools
, push the type down a layer so thatWasmCompositeType
can be marked shared. This leaves several holes to be filled in by future commits (all marked withTODO: handle shared
); in effect, this change allowsWasmCompositeType
to be marked shared but mostly does not wire up the sharedness during translation.