Skip to content

Commit f117df8

Browse files
Copilotlpcox
andauthored
guard: use auto-detecting wazero runtime config for portability
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent 21a82a4 commit f117df8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

internal/guard/wasm_lifecycle.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,16 @@ const guardMemoryLimitPages = 512
200200
// binaries are untrusted third-party artifacts and the gateway never
201201
// symbolicates guest stack traces, so skipping DWARF parsing saves compile
202202
// time and memory without any functional loss.
203+
//
204+
// wazero.NewRuntimeConfig() is used (rather than NewRuntimeConfigCompiler())
205+
// so the runtime auto-selects the Compiler (AOT) engine on supported
206+
// architectures (amd64/arm64) and transparently falls back to the
207+
// Interpreter engine elsewhere (e.g. riscv64), matching wazero's own
208+
// recommended usage and keeping WASM guard support portable across all
209+
// Go-supported architectures instead of failing to instantiate on
210+
// unsupported ones.
203211
func newGuardRuntimeConfig(opts *WasmGuardOptions) wazero.RuntimeConfig {
204-
runtimeConfig := wazero.NewRuntimeConfigCompiler().
212+
runtimeConfig := wazero.NewRuntimeConfig().
205213
WithCloseOnContextDone(true).
206214
WithMemoryLimitPages(guardMemoryLimitPages).
207215
WithDebugInfoEnabled(logWasm.Enabled())

0 commit comments

Comments
 (0)