Moves test-only symbols out of wazero package (#597)
This moves the compiler support flag out of the public package as it was only put there for tests. This also files modgen under the testing subdir so that it isn't mistaken for main code. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
package wazero
|
package wazero
|
||||||
|
|
||||||
// CompilerSupported returns whether the compiler is supported in this environment.
|
|
||||||
const CompilerSupported = true
|
|
||||||
|
|
||||||
// NewRuntimeConfig returns NewRuntimeConfigCompiler
|
// NewRuntimeConfig returns NewRuntimeConfigCompiler
|
||||||
func NewRuntimeConfig() RuntimeConfig {
|
func NewRuntimeConfig() RuntimeConfig {
|
||||||
return NewRuntimeConfigCompiler()
|
return NewRuntimeConfigCompiler()
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
package wazero
|
package wazero
|
||||||
|
|
||||||
// CompilerSupported returns whether the compiler is supported in this environment.
|
|
||||||
const CompilerSupported = false
|
|
||||||
|
|
||||||
// NewRuntimeConfig returns NewRuntimeConfigInterpreter
|
// NewRuntimeConfig returns NewRuntimeConfigInterpreter
|
||||||
func NewRuntimeConfig() RuntimeConfig {
|
func NewRuntimeConfig() RuntimeConfig {
|
||||||
return NewRuntimeConfigInterpreter()
|
return NewRuntimeConfigInterpreter()
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ var (
|
|||||||
newArchContext func() archContext
|
newArchContext func() archContext
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// IsSupported returns whether the compiler is supported on this architecture.
|
||||||
|
const IsSupported = isSupported
|
||||||
|
|
||||||
// nativecall is used by callEngine.execWasmFunction and the entrypoint to enter the compiled native code.
|
// nativecall is used by callEngine.execWasmFunction and the entrypoint to enter the compiled native code.
|
||||||
// codeSegment is the pointer to the initial instruction of the compiled native code.
|
// codeSegment is the pointer to the initial instruction of the compiled native code.
|
||||||
// ce is "*callEngine" as uintptr.
|
// ce is "*callEngine" as uintptr.
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/tetratelabs/wazero/internal/wazeroir"
|
"github.com/tetratelabs/wazero/internal/wazeroir"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isSupported = true
|
||||||
|
|
||||||
// init initializes variables for the amd64 architecture
|
// init initializes variables for the amd64 architecture
|
||||||
func init() {
|
func init() {
|
||||||
newArchContext = newArchContextImpl
|
newArchContext = newArchContextImpl
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import (
|
|||||||
"github.com/tetratelabs/wazero/internal/wazeroir"
|
"github.com/tetratelabs/wazero/internal/wazeroir"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isSupported = true
|
||||||
|
|
||||||
// init initializes variables for the arm64 architecture
|
// init initializes variables for the arm64 architecture
|
||||||
func init() {
|
func init() {
|
||||||
newArchContext = newArchContextImpl
|
newArchContext = newArchContextImpl
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
"github.com/tetratelabs/wazero/internal/wazeroir"
|
"github.com/tetratelabs/wazero/internal/wazeroir"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isSupported = false
|
||||||
|
|
||||||
// archContext is empty on an unsupported architecture.
|
// archContext is empty on an unsupported architecture.
|
||||||
type archContext struct{}
|
type archContext struct{}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/tetratelabs/wazero"
|
"github.com/tetratelabs/wazero"
|
||||||
"github.com/tetratelabs/wazero/api"
|
"github.com/tetratelabs/wazero/api"
|
||||||
|
"github.com/tetratelabs/wazero/internal/engine/compiler"
|
||||||
"github.com/tetratelabs/wazero/internal/testing/require"
|
"github.com/tetratelabs/wazero/internal/testing/require"
|
||||||
"github.com/tetratelabs/wazero/internal/wasm"
|
"github.com/tetratelabs/wazero/internal/wasm"
|
||||||
"github.com/tetratelabs/wazero/sys"
|
"github.com/tetratelabs/wazero/sys"
|
||||||
@@ -46,7 +47,7 @@ var tests = map[string]func(t *testing.T, r wazero.Runtime){
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEngineCompiler(t *testing.T) {
|
func TestEngineCompiler(t *testing.T) {
|
||||||
if !wazero.CompilerSupported {
|
if !compiler.IsSupported {
|
||||||
t.Skip()
|
t.Skip()
|
||||||
}
|
}
|
||||||
runAllTests(t, tests, wazero.NewRuntimeConfigCompiler())
|
runAllTests(t, tests, wazero.NewRuntimeConfigCompiler())
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/tetratelabs/wazero"
|
"github.com/tetratelabs/wazero"
|
||||||
"github.com/tetratelabs/wazero/api"
|
"github.com/tetratelabs/wazero/api"
|
||||||
|
"github.com/tetratelabs/wazero/internal/engine/compiler"
|
||||||
"github.com/tetratelabs/wazero/internal/testing/hammer"
|
"github.com/tetratelabs/wazero/internal/testing/hammer"
|
||||||
"github.com/tetratelabs/wazero/internal/testing/require"
|
"github.com/tetratelabs/wazero/internal/testing/require"
|
||||||
"github.com/tetratelabs/wazero/sys"
|
"github.com/tetratelabs/wazero/sys"
|
||||||
@@ -18,7 +19,7 @@ var hammers = map[string]func(t *testing.T, r wazero.Runtime){
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEngineCompiler_hammer(t *testing.T) {
|
func TestEngineCompiler_hammer(t *testing.T) {
|
||||||
if !wazero.CompilerSupported {
|
if !compiler.IsSupported {
|
||||||
t.Skip()
|
t.Skip()
|
||||||
}
|
}
|
||||||
runAllTests(t, hammers, wazero.NewRuntimeConfigCompiler())
|
runAllTests(t, hammers, wazero.NewRuntimeConfigCompiler())
|
||||||
|
|||||||
1
wasm.go
1
wasm.go
@@ -116,6 +116,7 @@ type Runtime interface {
|
|||||||
api.Closer
|
api.Closer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewRuntime returns a runtime with a configuration assigned by NewRuntimeConfig.
|
||||||
func NewRuntime() Runtime {
|
func NewRuntime() Runtime {
|
||||||
return NewRuntimeWithConfig(NewRuntimeConfig())
|
return NewRuntimeWithConfig(NewRuntimeConfig())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user