mem: temp allocation primitives for wasm
This commit is contained in:
parent
92b04b2566
commit
5d0a71c5be
1 changed files with 30 additions and 0 deletions
30
mem/mem_wasm.go
Normal file
30
mem/mem_wasm.go
Normal 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
|
||||
Loading…
Reference in a new issue