Stream: wasmtime

Topic: pointers vs references


view this post on Zulip Dan Gohman (Mar 11 2020 at 19:04):

@Alex Crichton Can you help me understand what's going on in this code: https://github.com/bytecodealliance/wasmtime/pull/957/files?diff=unified&w=1#diff-af6ebc80017af9e760df6358eeae6b00R606

The wasmtime crate supports calling arbitrary function signatures in wasm code, and to do this it generates "trampoline functions" which have a known ABI that then internally convert to a...

view this post on Zulip Dan Gohman (Mar 11 2020 at 19:05):

It looks like *ptr is meant to be the u128 value in memory. But then in the next line, *ptr is the pointer to the u128?

view this post on Zulip Alex Crichton (Mar 11 2020 at 19:05):

oh that's a helper for reading a value from *mut u128 and automatically incrementing the *mut u128 if something was read

view this post on Zulip Alex Crichton (Mar 11 2020 at 19:05):

it's more like a *mut *mut u128

view this post on Zulip Alex Crichton (Mar 11 2020 at 19:05):

oh

view this post on Zulip Alex Crichton (Mar 11 2020 at 19:05):

no that's just straight up buggy

view this post on Zulip Dan Gohman (Mar 11 2020 at 19:05):

ah, ok

view this post on Zulip Alex Crichton (Mar 11 2020 at 19:05):

yeah no all of those are buggy

view this post on Zulip Alex Crichton (Mar 11 2020 at 19:06):

wow I am bad at testing apparentluy


Last updated: Dec 23 2024 at 13:07 UTC