prep / wasmexec

Implementation of wasm_exec.js for Go Wasm runtimes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switch SP and memory offset to uint32

codefromthecrypt opened this issue · comments

There are some confusing code in the source wasm_exec.js which is about forcing unsigned numbers. The memory offset and stack pointer should both be uint32 not int32 where possible.

This is the correct way to force unsigned in go. The javascript does it via sp >>>= 0; which can be wholesale removed here as it has no effect, regardless of if the variable types are changed.

golang/go@9848e93

Yes, fair point. I set out to mimic as much of the original wasm_exec.js as possible to get things working quickly and spot deviations more easily. Now that things are starting to work, I'll sort things like this out 👍

sounds good. PS I'm starting a reference doc here and will continue tomorrow https://github.com/tetratelabs/wazero/pull/621/files just in case the notes help

Very nice! I've pushed some changes including the change to uint32 for offset and length.

thanks!