diff options
Diffstat (limited to 'vendor/github.com/tetratelabs/wazero/internal/platform/platform.go')
| -rw-r--r-- | vendor/github.com/tetratelabs/wazero/internal/platform/platform.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/platform.go b/vendor/github.com/tetratelabs/wazero/internal/platform/platform.go index b9af094c1..532cc7b8c 100644 --- a/vendor/github.com/tetratelabs/wazero/internal/platform/platform.go +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/platform.go @@ -6,18 +6,28 @@ package platform import ( "runtime" -) -// archRequirementsVerified is set by platform-specific init to true if the platform is supported -var archRequirementsVerified bool + "github.com/tetratelabs/wazero/api" + "github.com/tetratelabs/wazero/experimental" +) // CompilerSupported includes constraints here and also the assembler. func CompilerSupported() bool { + return CompilerSupports(api.CoreFeaturesV2) +} + +func CompilerSupports(features api.CoreFeatures) bool { switch runtime.GOOS { case "linux", "darwin", "freebsd", "netbsd", "dragonfly", "windows": - return archRequirementsVerified + if runtime.GOARCH == "arm64" { + if features.IsEnabled(experimental.CoreFeaturesThreads) { + return CpuFeatures.Has(CpuFeatureArm64Atomic) + } + return true + } + fallthrough case "solaris", "illumos": - return runtime.GOARCH == "amd64" && archRequirementsVerified + return runtime.GOARCH == "amd64" && CpuFeatures.Has(CpuFeatureAmd64SSE4_1) default: return false } |
