Skip to content

Commit

Permalink
fix(threads): add atomic.fence
Browse files Browse the repository at this point in the history
atomic.fence was added to the threads proposal in
WebAssembly/threads#141, and supported in wabt
in
WebAssembly/wabt@d041025#diff-25d902c24283ab8cfbac54dfa101ad31.
  • Loading branch information
ngzhian authored and bmeurer committed Aug 19, 2020
1 parent d4699cf commit a9fd605
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/WasmParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export const enum OperatorCode {
atomic_notify = 0xfe00,
i32_atomic_wait = 0xfe01,
i64_atomic_wait = 0xfe02,
atomic_fence = 0xfe03,
i32_atomic_load = 0xfe10,
i64_atomic_load = 0xfe11,
i32_atomic_load8_u = 0xfe12,
Expand Down Expand Up @@ -2401,6 +2402,14 @@ export class BinaryReader {
case OperatorCode.i64_atomic_rmw32_cmpxchg_u:
memoryAddress = this.readMemoryImmediate();
break;
case OperatorCode.atomic_fence: {
var consistency_model = this.readUint8();
if (consistency_model != 0) {
this.error = new Error("atomic.fence consistency model must be 0");
this.state = BinaryReaderState.ERROR;
return true;
}
}
default:
this.error = new Error(`Unknown operator: ${code}`);
this.state = BinaryReaderState.ERROR;
Expand Down

0 comments on commit a9fd605

Please sign in to comment.