From 8de6f6058e6236ad13ccac933158def70237e946 Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Thu, 5 Sep 2024 19:21:52 -0700 Subject: [PATCH] Fix atomic fence encoding --- src/mono/browser/runtime/jiterpreter-trace-generator.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/jiterpreter-trace-generator.ts b/src/mono/browser/runtime/jiterpreter-trace-generator.ts index 092d721daa2bd..956538ffe5f3c 100644 --- a/src/mono/browser/runtime/jiterpreter-trace-generator.ts +++ b/src/mono/browser/runtime/jiterpreter-trace-generator.ts @@ -3977,8 +3977,12 @@ function emit_atomics ( builder: WasmBuilder, ip: MintOpcodePtr, opcode: number ) { if (opcode === MintOpcode.MINT_MONO_MEMORY_BARRIER) { - if (WasmEnableThreads) + if (WasmEnableThreads) { builder.appendAtomic(WasmAtomicOpcode.atomic_fence); + // The text format and other parts of the spec say atomic.fence has no operands, + // but the binary encoding requires a dummy zero byte for some reason + builder.appendU8(0); + } return true; }