diff options
author | 2024-06-12 14:21:34 +0200 | |
---|---|---|
committer | 2024-06-12 13:21:34 +0100 | |
commit | 978b4176f1a31a497aaadd33f21659b318832c95 (patch) | |
tree | 8ab36617b993a457af5d2975bedaa63a57031ff3 /vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go | |
parent | [bugfix] Correct Swagger path for poll voting (#2996) (diff) | |
download | gotosocial-978b4176f1a31a497aaadd33f21659b318832c95.tar.xz |
[chore] Upgrade wasm-sqlite to v0.16.2 (#2997)
Diffstat (limited to 'vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go')
-rw-r--r-- | vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go index f7c0450ae..e49353dc8 100644 --- a/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go +++ b/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/engine_cache.go @@ -31,6 +31,13 @@ func fileCacheKey(m *wasm.Module) (ret filecache.Key) { s := sha256.New() s.Write(m.ID[:]) s.Write(magic) + // Write the CPU features so that we can cache the compiled module for the same CPU. + // This prevents the incompatible CPU features from being used. + cpu := platform.CpuFeatures.Raw() + // Reuse the `ret` buffer to write the first 8 bytes of the CPU features so that we can avoid the allocation. + binary.LittleEndian.PutUint64(ret[:8], cpu) + s.Write(ret[:8]) + // Finally, write the hash to the ret buffer. s.Sum(ret[:0]) return } |