-
Notifications
You must be signed in to change notification settings - Fork 246
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
Add pointer and length types to WasmType
.
#1423
Add pointer and length types to WasmType
.
#1423
Conversation
In anticipation of memory64, provenance in Rust, and guest bindings with instrumented pointers, add `Pointer` and `Length` types to `WasmType`, and use it in the ABI for list, strings, and argument/return value pointers. Consumers that don't have anything special to do with these can handle them both the same as `i32`. And, because the variant type Canonical ABI can unify pointers with integer types like `i64`, add a `Pointer64` type as well, which represents a conceptual union of a pointer and an `i64`. Consumers that don't have anything special to do with this type can handle it the same as an `i64`.
One awkward thing about this is that we no longer get signature deduping between two types that differ only in |
Can you say more about I'm apprehensive that this is the right way to solve this problem - right now the WasmType corresponds to the spec |
Not deduping some types I think is fine, everything is dedup'd at the runtime layer anyway typically. One thing that I'd find helpful to review this, which I think might also help address @pchickey's concern, could this be integrated with |
Rust is adopting a semantic model where pointers conceptually carry additional "provenance" information which describes what objects may be accessed. We should ideally make the bindings use pointer types like For instrumented pointers, I'm thinking about systems that use fat-pointer techniques to add spatial or temporal memory safety bookkeeping to pointers. Not everyone will want to do this, but for people who do, the bindings generator will want to know which values are pointers. Here's a preview of what this looks like it wit-bindgen: sunfishcode/wit-bindgen@a939252 It's not done yet; in particular, the |
Oh nice! That does look pretty self-contained yeah. Some questions I have from this approach:
|
|
Concerning |
Ah I see, I misunderstood I'm also not sure how this will be represented in Rust. In the bindings you're representing it currently as |
Yeah, |
Ok looks good to me, and thanks again for this! |
In anticipation of memory64, provenance in Rust, and guest bindings with instrumented pointers, add
Pointer
andLength
types toWasmType
, and use it in the ABI for list, strings, and argument/return value pointers. Consumers that don't have anything special to do with these can handle them both the same asi32
.And, because the variant type Canonical ABI can unify pointers with integer types like
i64
, add aPointer64
type as well, which represents a conceptual union of a pointer and ani64
. Consumers that don't have anything special to do with this type can handle it the same as ani64
.