mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-01 18:29:03 +00:00
runtime: run syscall/js finalizers on wasm without a manual GC (#5545)
* runtime: run syscall/js finalizers on wasm without a manual GC * runtime: address review feedback on finalizer idle GC * runtime: clear a finished task's args pointer so its arguments are collectable * runtime: skip the finalizer scan with a per-block registration bit * runtime: guard the finalizer registration bitmap with gcLock * testdata: cover finalizer invariants on every scheduler * main_test: limit the finalizer scheduler variants to linux and darwin * testdata: wait for the finalizer queue to drain before asserting * testdata: make the finalizer counters atomic and wait for a known drain count * runtime: add finalizer bookkeeping asserts under runtime_asserts * runtime: address finalizer GC review feedback * testdata: strengthen blocked stack finalizer test * runtime: fix finalizer cleanup edge cases * runtime: decouple wasm export scheduling from finalizers * runtime: avoid redundant wakeups for re-entrant wasm exports * runtime: simplify finalizer comments
This commit is contained in:
@@ -7,7 +7,6 @@ package runtime
|
||||
// compiler for //go:wasmexport support.
|
||||
|
||||
import (
|
||||
"internal/task"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@@ -85,19 +84,3 @@ func wasmExportRun(done *bool) {
|
||||
runtimePanic("//go:wasmexport function did not finish")
|
||||
}
|
||||
}
|
||||
|
||||
// Called from the goroutine wrapper for the //go:wasmexport function. It just
|
||||
// signals to the runtime that the //go:wasmexport call has finished, and can
|
||||
// switch back to the wasmExportRun function.
|
||||
//
|
||||
// This function is not called when the scheduler is disabled.
|
||||
func wasmExportExit() {
|
||||
// Signal to the scheduler that it should return, since this call to a
|
||||
// //go:wasmexport function has exited.
|
||||
schedulerExit = true
|
||||
|
||||
task.Pause()
|
||||
|
||||
// TODO: we could cache the allocated stack so we don't have to keep
|
||||
// allocating a new stack on every //go:wasmexport call.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user