runtime: avoid heap allocs for plain errors

This commit is contained in:
Jake Bailey
2026-07-27 09:08:47 -07:00
committed by Ron Evans
parent 1d2bc0fd64
commit 206d9ae8e0
17 changed files with 132 additions and 50 deletions
+3 -3
View File
@@ -66,9 +66,9 @@ var initializeCalled bool
func wasmExportCheckRun() {
switch {
case !initializeCalled:
runtimePanic("//go:wasmexport function called before runtime initialization")
runtimePanic(errWasmBeforeInit)
case mainExited:
runtimePanic("//go:wasmexport function called after main.main returned")
runtimePanic(errWasmAfterMain)
}
}
@@ -81,6 +81,6 @@ func wasmExportCheckRun() {
func wasmExportRun(done *bool) {
scheduler(true)
if !*done {
runtimePanic("//go:wasmexport function did not finish")
runtimePanic(errWasmDidNotFinish)
}
}