Top-levels CoreFeatures and defaults to 2.0 (#800)
While compilers should be conservative when targeting WebAssembly Core features, runtimes should be lenient as otherwise people need to constantly turn on all features. Currently, most examples have to turn on 2.0 features because compilers such as AssemblyScript and TinyGo use them by default. This matches the policy with the reality, and should make first time use easier. This top-levels an internal type as `api.CoreFeatures` and defaults to 2.0 as opposed to 1.0, our previous default. This is less cluttered than the excess of `WithXXX` methods we had prior to implementing all planned WebAssembly Core Specification 1.0 features. Finally, this backfills rationale as flat config types were a distinct decision even if feature set selection muddied the topic. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -24,7 +24,7 @@ var (
|
||||
func TestNewRuntimeWithConfig_version(t *testing.T) {
|
||||
cfg := NewRuntimeConfig().(*runtimeConfig)
|
||||
oldNewEngine := cfg.newEngine
|
||||
cfg.newEngine = func(ctx context.Context, features wasm.Features) wasm.Engine {
|
||||
cfg.newEngine = func(ctx context.Context, features api.CoreFeatures) wasm.Engine {
|
||||
// Ensures that wazeroVersion is propagated to the engine.
|
||||
v := ctx.Value(version.WazeroVersionKey{})
|
||||
require.NotNil(t, v)
|
||||
@@ -519,7 +519,7 @@ func TestRuntime_CloseWithExitCode(t *testing.T) {
|
||||
func TestRuntime_Close_ClosesCompiledModules(t *testing.T) {
|
||||
engine := &mockEngine{name: "mock", cachedModules: map[*wasm.Module]struct{}{}}
|
||||
conf := *engineLessConfig
|
||||
conf.newEngine = func(context.Context, wasm.Features) wasm.Engine {
|
||||
conf.newEngine = func(context.Context, api.CoreFeatures) wasm.Engine {
|
||||
return engine
|
||||
}
|
||||
r := NewRuntimeWithConfig(testCtx, &conf)
|
||||
|
||||
Reference in New Issue
Block a user