This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import upstream and rename imports (#4)
- Loading branch information
Showing
51 changed files
with
1,101 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package opt | ||
|
||
import ( | ||
"runtime" | ||
|
||
wazero "github.com/wasilibs/wazerox" | ||
) | ||
|
||
type enabler interface { | ||
// EnableOptimizingCompiler enables the optimizing compiler. | ||
// This is only implemented the internal type of wazero.runtimeConfig. | ||
EnableOptimizingCompiler() | ||
} | ||
|
||
// NewRuntimeConfigOptimizingCompiler returns a new RuntimeConfig with the optimizing compiler enabled. | ||
func NewRuntimeConfigOptimizingCompiler() wazero.RuntimeConfig { | ||
if runtime.GOARCH != "arm64" { | ||
panic("UseOptimizingCompiler is only supported on arm64") | ||
} | ||
c := wazero.NewRuntimeConfig() | ||
c.(enabler).EnableOptimizingCompiler() | ||
return c | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package opt_test | ||
|
||
import ( | ||
"context" | ||
"runtime" | ||
"testing" | ||
|
||
wazero "github.com/wasilibs/wazerox" | ||
"github.com/wasilibs/wazerox/experimental/opt" | ||
"github.com/wasilibs/wazerox/internal/testing/require" | ||
) | ||
|
||
func TestUseOptimizingCompiler(t *testing.T) { | ||
if runtime.GOARCH != "arm64" { | ||
return | ||
} | ||
c := opt.NewRuntimeConfigOptimizingCompiler() | ||
r := wazero.NewRuntimeWithConfig(context.Background(), c) | ||
require.NoError(t, r.Close(context.Background())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.