Closed greenhat closed 23 hours ago
The initial state of memory is guaranteed to be zero (for now at least), but alloc_zeroed
is still needed because the allocator itself might free and reuse memory that was previously written to, which will no longer have that guarantee. So we'll definitely need this.
I'll make a note to add memset
/memory.fill
to the instruction set while I'm in there working on other things.
NOTE: We don't need this for the alpha, since we're leaning on WeeAlloc which doesn't reuse memory AFAIK, but we won't be able to make that assumption longer term.
Implemented in #242
I encountered the Wasm
memory.fill
instruction in theGlobalAlloc::alloc_zeroed
function, which is used to zero out the memory allocated byGlobalAlloc::alloc
. Since the memory in Miden VM is guaranteed to be initialized to zeros, I ignored this instruction for now, but we're going to need it in the future.See semantics at https://webassembly.github.io/spec/core/exec/instructions.html#exec-memory-fill