mem: temp allocation primitives for wasm

This commit is contained in:
Judah Caruso 2026-01-31 13:26:06 -07:00
parent 92b04b2566
commit 5d0a71c5be

30
mem/mem_wasm.go Normal file
View file

@ -0,0 +1,30 @@
//go:build wasm
package mem
import (
"runtime"
"unsafe"
)
func reserve(total_address_space uintptr) ([]byte, error) {
data := make([]byte, total_address_space)
p.Pin(unsafe.SliceData(data))
return data, nil
}
func release(_ []byte) error {
p.Unpin()
return nil
}
func commit(_ []byte, _ Access) error {
return nil
}
func decommit(committed []byte) (err error) {
clear(committed)
return nil
}
var p runtime.Pinner