wasm: implement a growable heap

On WebAssembly it is possible to grow the heap with the memory.grow
instruction. This commit implements this feature and with that also
removes the -heap-size flag that was reportedly broken (I haven't
verified that). This should make it easier to use TinyGo for
WebAssembly, where there was no good reason to use a fixed heap size.

This commit has no effect on baremetal targets with optimizations
enabled.
This commit is contained in:
Ayke van Laethem
2021-01-09 01:11:36 +01:00
committed by Ron Evans
parent 5af4c073cd
commit da0161d6ab
10 changed files with 115 additions and 47 deletions
+7
View File
@@ -217,6 +217,13 @@ func setupHeap() {
}
}
// growHeap tries to grow the heap size. It returns true if it succeeds, false
// otherwise.
func growHeap() bool {
// Growing the heap is unimplemented.
return false
}
// getHeapBase returns the start address of the heap
// this is externally linked by gonx
func getHeapBase() uintptr {