mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
all: make WebAssembly initial linear memory size configurable
When the target supports it, allow the (initial) heap size to be configured. Currently only supported in WebAssembly. This also changes the default heap size of WebAssembly from 64kB to 1MB.
This commit is contained in:
committed by
Ron Evans
parent
152caa3b0a
commit
d627208c48
@@ -14,9 +14,12 @@ const TargetBits = 32
|
||||
//go:extern __heap_base
|
||||
var heapStartSymbol unsafe.Pointer
|
||||
|
||||
//go:export llvm.wasm.memory.size.i32
|
||||
func wasm_memory_size(index int32) int32
|
||||
|
||||
var (
|
||||
heapStart = uintptr(unsafe.Pointer(&heapStartSymbol))
|
||||
heapEnd = (heapStart + wasmPageSize - 1) &^ (wasmPageSize - 1) // conservative guess: one page of heap memory
|
||||
heapEnd = uintptr(wasm_memory_size(0) * wasmPageSize)
|
||||
)
|
||||
|
||||
const wasmPageSize = 64 * 1024
|
||||
|
||||
Reference in New Issue
Block a user