diff --git a/builder/build.go b/builder/build.go index 17b691b57f..54ff4779a1 100644 --- a/builder/build.go +++ b/builder/build.go @@ -854,37 +854,6 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe } } - if config.Options.WizerInit { - var args []string - - resultWizer := result.Executable + "-wizer" - - args = append(args, - "--allow-wasi", - "--wasm-bulk-memory=true", - "-f", "runtime.wizerInit", - result.Executable, - "-o", resultWizer, - ) - - if config.Options.PrintCommands != nil { - config.Options.PrintCommands(goenv.Get("WIZER"), args...) - } - - cmd := exec.Command(goenv.Get("WIZER"), args...) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - - err := cmd.Run() - if err != nil { - return fmt.Errorf("wizer failed: %w", err) - } - - if err := os.Rename(resultWizer, result.Executable); err != nil { - return fmt.Errorf("rename failed: %w", err) - } - } - // Print code size if requested. if config.Options.PrintSizes == "short" || config.Options.PrintSizes == "full" { packagePathMap := make(map[string]string, len(lprogram.Packages)) diff --git a/compileopts/options.go b/compileopts/options.go index bcc3e447dc..debdaf08cd 100644 --- a/compileopts/options.go +++ b/compileopts/options.go @@ -53,7 +53,6 @@ type Options struct { Monitor bool BaudRate int Timeout time.Duration - WizerInit bool } // Verify performs a validation on the given options, raising an error if options are not valid. diff --git a/goenv/goenv.go b/goenv/goenv.go index 9beceb41b6..be1c631ca9 100644 --- a/goenv/goenv.go +++ b/goenv/goenv.go @@ -159,35 +159,6 @@ func Get(name string) string { } return findWasmOpt() - - case "WIZER": - if path := os.Getenv("WIZER"); path != "" { - wizerBin := "wizer" - if runtime.GOOS == "windows" { - wizerBin += ".exe" - } - - _, err := exec.LookPath(wizerBin) - if err != nil { - fmt.Fprintf(os.Stderr, "cannot use %q as wasm-opt (from WASMOPT environment variable): %s", path, err.Error()) - os.Exit(1) - } - - return path - } - - wizerBin := "wizer" - if runtime.GOOS == "windows" { - wizerBin += ".exe" - } - - path, err := exec.LookPath(wizerBin) - if err != nil { - fmt.Fprintf(os.Stderr, "cannot use %q as wizer: %s", path, err.Error()) - os.Exit(1) - } - return path - default: return "" } diff --git a/main.go b/main.go index 25d56e747a..6b3aeb3b03 100644 --- a/main.go +++ b/main.go @@ -1440,7 +1440,6 @@ func main() { cpuprofile := flag.String("cpuprofile", "", "cpuprofile output") monitor := flag.Bool("monitor", false, "enable serial monitor") baudrate := flag.Int("baudrate", 115200, "baudrate of serial monitor") - wizerInit := flag.Bool("wizer-init", false, "use wizer for package initialization") // Internal flags, that are only intended for TinyGo development. printIR := flag.Bool("internal-printir", false, "print LLVM IR") @@ -1513,11 +1512,6 @@ func main() { ocdCommands = strings.Split(*ocdCommandsString, ",") } - if *wizerInit && *target != "wasip1" { - fmt.Fprintf(os.Stderr, "-wizer-init only makes sense with -target=wasip1, got -target=%q\n", *target) - os.Exit(1) - } - options := &compileopts.Options{ GOOS: goenv.Get("GOOS"), GOARCH: goenv.Get("GOARCH"), @@ -1550,9 +1544,7 @@ func main() { Monitor: *monitor, BaudRate: *baudrate, Timeout: *timeout, - WizerInit: *wizerInit, } - if *printCommands { options.PrintCommands = printCommand } diff --git a/src/runtime/runtime_wasip1.go b/src/runtime/runtime_wasip1.go index 26f55d4e67..60707769af 100644 --- a/src/runtime/runtime_wasip1.go +++ b/src/runtime/runtime_wasip1.go @@ -19,7 +19,7 @@ func _start() { run() } -//export runtime.wizerInit +//export runtime.initialize func runtimeInitialize() { if runtimeInitialized { // Second time initialization is happening. Refresh environment @@ -32,10 +32,9 @@ func runtimeInitialize() { heapStart = uintptr(unsafe.Pointer(&heapStartSymbol)) heapEnd = uintptr(wasm_memory_size(0) * wasmPageSize) initHeap() + initAll() if hasScheduler { - go initAll() - } else { - initAll() + go func() {}() } runtimeInitialized = true }