target/wasm_unknown: remove bulk memory and use imported memory for extreme tinyness

Signed-off-by: deadprogram <ron@hybridgroup.com>
Этот коммит содержится в:
deadprogram 2024-02-15 14:33:24 +01:00 коммит произвёл Ron Evans
родитель 186018abeb
коммит 5879d785a9
4 изменённых файлов: 9 добавлений и 14 удалений

Просмотреть файл

@ -1,4 +1,4 @@
//go:build tinygo.wasm && !custommalloc //go:build tinygo.wasm && !(custommalloc || wasm_unknown)
package runtime package runtime

Просмотреть файл

@ -31,10 +31,9 @@ func abort() {
//go:linkname syscall_Exit syscall.Exit //go:linkname syscall_Exit syscall.Exit
func syscall_Exit(code int) { 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. // can be left empty.
//go:linkname procPin sync/atomic.runtime_procPin //go:linkname procPin sync/atomic.runtime_procPin

Просмотреть файл

@ -2,9 +2,7 @@
package runtime package runtime
import ( import "unsafe"
"unsafe"
)
type timeUnit int64 type timeUnit int64
@ -21,10 +19,6 @@ func _start() {
run() 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() { func init() {
__wasm_call_ctors() __wasm_call_ctors()
} }
@ -39,7 +33,8 @@ func nanosecondsToTicks(ns int64) timeUnit {
return timeUnit(ns) 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) { func sleepTicks(d timeUnit) {
} }

Просмотреть файл

@ -1,7 +1,7 @@
{ {
"llvm-target": "wasm32-unknown-unknown", "llvm-target": "wasm32-unknown-unknown",
"cpu": "generic", "cpu": "generic",
"features": "+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext", "features": "+mutable-globals,+nontrapping-fptoint,+sign-ext",
"build-tags": ["tinygo.wasm", "wasm_unknown"], "build-tags": ["tinygo.wasm", "wasm_unknown"],
"goos": "linux", "goos": "linux",
"goarch": "arm", "goarch": "arm",
@ -10,13 +10,14 @@
"scheduler": "none", "scheduler": "none",
"default-stack-size": 4096, "default-stack-size": 4096,
"cflags": [ "cflags": [
"-mbulk-memory", "-mno-bulk-memory",
"-mnontrapping-fptoint", "-mnontrapping-fptoint",
"-msign-ext" "-msign-ext"
], ],
"ldflags": [ "ldflags": [
"--no-demangle", "--no-demangle",
"--no-entry" "--no-entry",
"--import-memory"
], ],
"extra-files": [ "extra-files": [
"src/runtime/asm_tinygowasm.S" "src/runtime/asm_tinygowasm.S"