github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/experimental/opt/opt.go (about) 1 package opt 2 3 import ( 4 "runtime" 5 6 wazero "github.com/wasilibs/wazerox" 7 ) 8 9 type enabler interface { 10 // EnableOptimizingCompiler enables the optimizing compiler. 11 // This is only implemented the internal type of wazero.runtimeConfig. 12 EnableOptimizingCompiler() 13 } 14 15 // NewRuntimeConfigOptimizingCompiler returns a new RuntimeConfig with the optimizing compiler enabled. 16 func NewRuntimeConfigOptimizingCompiler() wazero.RuntimeConfig { 17 if runtime.GOARCH != "arm64" { 18 panic("UseOptimizingCompiler is only supported on arm64") 19 } 20 c := wazero.NewRuntimeConfig() 21 c.(enabler).EnableOptimizingCompiler() 22 return c 23 }