Browse Source

* fail with an internal compiler error in case an atomic WebAssembly instruction
is generated, while WebAssembly multithreading is disabled

Nikolay Nikolov 1 year ago
parent
commit
35701f8fa2
1 changed files with 10 additions and 0 deletions
  1. 10 0
      compiler/wasm32/aasmcpu.pas

+ 10 - 0
compiler/wasm32/aasmcpu.pas

@@ -147,6 +147,8 @@ uses
       taicpu = class(tai_cpu_abstract_sym)
          is_br_generated_by_goto: boolean;
 
+         constructor Create(op : tasmop);override;
+
          constructor op_none(op : tasmop);
 
          constructor op_reg(op : tasmop;_op1 : tregister);
@@ -1910,6 +1912,14 @@ uses
                                  taicpu Constructors
 *****************************************************************************}
 
+    constructor taicpu.Create(op: tasmop);
+      begin
+        inherited Create(op);
+        if not (ts_wasm_threads in current_settings.targetswitches) and is_atomic_op(op) then
+          internalerror(2024070701);
+      end;
+
+
     constructor taicpu.op_none(op : tasmop);
       begin
         inherited create(op);