diff options
author | deadprogram <[email protected]> | 2024-02-15 14:33:24 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-02-15 17:54:18 +0100 |
commit | 5879d785a986ab980f96ec2acadea8465d5fb51a (patch) | |
tree | dd5b39182580676e296cc28f011ee4d03ac94ebc | |
parent | 186018abebe67052ce53c610ce0eaab1bef6d24a (diff) | |
download | tinygo-5879d785a986ab980f96ec2acadea8465d5fb51a.tar.gz tinygo-5879d785a986ab980f96ec2acadea8465d5fb51a.zip |
target/wasm_unknown: remove bulk memory and use imported memory for extreme tinyness
Signed-off-by: deadprogram <[email protected]>
-rw-r--r-- | src/runtime/arch_tinygowasm_malloc.go | 2 | ||||
-rw-r--r-- | src/runtime/runtime_tinygowasm_unknown.go | 3 | ||||
-rw-r--r-- | src/runtime/runtime_wasm_unknown.go | 11 | ||||
-rw-r--r-- | targets/wasm-unknown.json | 7 |
4 files changed, 9 insertions, 14 deletions
diff --git a/src/runtime/arch_tinygowasm_malloc.go b/src/runtime/arch_tinygowasm_malloc.go index acbea9ab7..239f7c73e 100644 --- a/src/runtime/arch_tinygowasm_malloc.go +++ b/src/runtime/arch_tinygowasm_malloc.go @@ -1,4 +1,4 @@ -//go:build tinygo.wasm && !custommalloc +//go:build tinygo.wasm && !(custommalloc || wasm_unknown) package runtime diff --git a/src/runtime/runtime_tinygowasm_unknown.go b/src/runtime/runtime_tinygowasm_unknown.go index 08a9414fc..39caa245a 100644 --- a/src/runtime/runtime_tinygowasm_unknown.go +++ b/src/runtime/runtime_tinygowasm_unknown.go @@ -31,10 +31,9 @@ func abort() { //go:linkname syscall_Exit syscall.Exit func syscall_Exit(code int) { - //proc_exit(uint32(code)) } -// TinyGo does not yet support any form of parallelism on WebAssembly, so these +// There is not yet any support for any form of parallelism on WebAssembly, so these // can be left empty. //go:linkname procPin sync/atomic.runtime_procPin diff --git a/src/runtime/runtime_wasm_unknown.go b/src/runtime/runtime_wasm_unknown.go index c17ece257..5ba832116 100644 --- a/src/runtime/runtime_wasm_unknown.go +++ b/src/runtime/runtime_wasm_unknown.go @@ -2,9 +2,7 @@ package runtime -import ( - "unsafe" -) +import "unsafe" type timeUnit int64 @@ -21,10 +19,6 @@ func _start() { run() } -// Read the command line arguments from WASI. -// For example, they can be passed to a program with wasmtime like this: -// -// wasmtime run ./program.wasm arg1 arg2 func init() { __wasm_call_ctors() } @@ -39,7 +33,8 @@ func nanosecondsToTicks(ns int64) timeUnit { return timeUnit(ns) } -const timePrecisionNanoseconds = 1000 // TODO: how can we determine the appropriate `precision`? +// with the wasm32-unknown-unknown target there is no way to determine any `precision` +const timePrecisionNanoseconds = 1000 func sleepTicks(d timeUnit) { } diff --git a/targets/wasm-unknown.json b/targets/wasm-unknown.json index 3a96eb036..aefc6047e 100644 --- a/targets/wasm-unknown.json +++ b/targets/wasm-unknown.json @@ -1,7 +1,7 @@ { "llvm-target": "wasm32-unknown-unknown", "cpu": "generic", - "features": "+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext", + "features": "+mutable-globals,+nontrapping-fptoint,+sign-ext", "build-tags": ["tinygo.wasm", "wasm_unknown"], "goos": "linux", "goarch": "arm", @@ -10,13 +10,14 @@ "scheduler": "none", "default-stack-size": 4096, "cflags": [ - "-mbulk-memory", + "-mno-bulk-memory", "-mnontrapping-fptoint", "-msign-ext" ], "ldflags": [ "--no-demangle", - "--no-entry" + "--no-entry", + "--import-memory" ], "extra-files": [ "src/runtime/asm_tinygowasm.S" |