Browse Source

* WebAssembly: a_catch instruction renamed a_legacy_catch

Nikolay Nikolov 2 days ago
parent
commit
7ce80bac7d
3 changed files with 18 additions and 18 deletions
  1. 13 13
      compiler/wasm32/aasmcpu.pas
  2. 1 1
      compiler/wasm32/cpubase.pas
  3. 4 4
      compiler/wasm32/nwasmflw.pas

+ 13 - 13
compiler/wasm32/aasmcpu.pas

@@ -1077,12 +1077,12 @@ uses
                 internalerror(2024022512);
               PushCtrl(a_else,frame.start_types,frame.end_types);
             end;
-          a_catch:
+          a_legacy_catch:
             begin
               frame:=PopCtrl;
-              if (frame.opcode<>a_legacy_try) and (frame.opcode<>a_catch) then
+              if (frame.opcode<>a_legacy_try) and (frame.opcode<>a_legacy_catch) then
                 internalerror(2024022701);
-              PushCtrl(a_catch,frame.start_types,frame.end_types);
+              PushCtrl(a_legacy_catch,frame.start_types,frame.end_types);
             end;
           a_end_if:
             begin
@@ -1108,7 +1108,7 @@ uses
           a_end_try:
             begin
               frame:=PopCtrl;
-              if (frame.opcode<>a_legacy_try) and (frame.opcode<>a_catch) then
+              if (frame.opcode<>a_legacy_try) and (frame.opcode<>a_legacy_catch) then
                 internalerror(2024022702);
               PushVals(frame.end_types);
             end;
@@ -1212,7 +1212,7 @@ uses
           p:=tai(srclist.First);
           if not assigned(p) then
             internalerror(2023100302);
-          if (p.typ=ait_instruction) and (taicpu(p).opcode in [a_else,a_end_if,a_end_block,a_end_loop,a_end_try,a_catch,a_catch_all,a_delegate]) then
+          if (p.typ=ait_instruction) and (taicpu(p).opcode in [a_else,a_end_if,a_end_block,a_end_loop,a_end_try,a_legacy_catch,a_catch_all,a_delegate]) then
             begin
               srclist.Remove(p);
               case taicpu(p).opcode of
@@ -1559,7 +1559,7 @@ uses
           p:=tai(srclist.First);
           if not assigned(p) then
             internalerror(2023100308);
-          if (p.typ=ait_instruction) and (taicpu(p).opcode in [a_end_try,a_catch,a_catch_all,a_delegate]) then
+          if (p.typ=ait_instruction) and (taicpu(p).opcode in [a_end_try,a_legacy_catch,a_catch_all,a_delegate]) then
             begin
               srclist.Remove(p);
               Done:=True;
@@ -1568,7 +1568,7 @@ uses
             tmp_asmlist.Concat(wasm_convert_first_item_to_structured(srclist));
         until Done;
         case taicpu(p).opcode of
-          a_end_try,a_catch,a_catch_all:
+          a_end_try,a_legacy_catch,a_catch_all:
             result:=tai_wasmstruc_try_catch.internal_create(taicpu(p),tmp_asmlist,srclist);
           a_delegate:
             result:=tai_wasmstruc_try_delegate.internal_create(taicpu(p),tmp_asmlist,srclist);
@@ -1629,7 +1629,7 @@ uses
             Done:=False;
             repeat
               pp:=tai(srclist.First);
-              if (pp.typ=ait_instruction) and (taicpu(pp).opcode in [a_catch,a_catch_all,a_end_try]) then
+              if (pp.typ=ait_instruction) and (taicpu(pp).opcode in [a_legacy_catch,a_catch_all,a_end_try]) then
                 Done:=True
               else
                 al.Concat(wasm_convert_first_item_to_structured(srclist));
@@ -1667,7 +1667,7 @@ uses
         repeat
           if p.typ=ait_instruction then
             case taicpu(p).opcode of
-              a_catch:
+              a_legacy_catch:
                 begin
                   parse_next_catch_block;
                   p:=tai(srclist.First);
@@ -2587,7 +2587,7 @@ uses
                     internalerror(2021092625);
                 end;
             end;
-          a_catch,
+          a_legacy_catch,
           a_throw:
             begin
               if ops<>1 then
@@ -3580,11 +3580,11 @@ uses
                     internalerror(2021092625);
                 end;
             end;
-          a_catch,
+          a_legacy_catch,
           a_throw:
             begin
               case opcode of
-                a_catch:
+                a_legacy_catch:
                   WriteByte($07);
                 a_throw:
                   WriteByte($08);
@@ -3732,7 +3732,7 @@ uses
                   result:=tai_wasmstruc_loop.create_from(taicpu(result),srclist);
                 a_legacy_try:
                   result:=tai_wasmstruc_try.create_from(srclist);
-                a_else,a_end_if,a_end_block,a_end_loop,a_end_try,a_catch,a_catch_all,a_delegate:
+                a_else,a_end_if,a_end_block,a_end_loop,a_end_try,a_legacy_catch,a_catch_all,a_delegate:
                   internalerror(2023100503);
                 else
                   ;

+ 1 - 1
compiler/wasm32/cpubase.pas

@@ -100,7 +100,7 @@ uses
       a_i64_trunc_sat_f64_s,
       a_i64_trunc_sat_f64_u,
       // exceptions (legacy)
-      a_legacy_try,a_catch,a_catch_all,a_delegate,a_throw,a_rethrow,a_end_try,
+      a_legacy_try,a_legacy_catch,a_catch_all,a_delegate,a_throw,a_rethrow,a_end_try,
       // atomic memory accesses - load/store
       a_i32_atomic_load8_u, a_i32_atomic_load16_u, a_i32_atomic_load,
       a_i64_atomic_load8_u, a_i64_atomic_load16_u, a_i64_atomic_load32_u,

+ 4 - 4
compiler/wasm32/nwasmflw.pas

@@ -473,7 +473,7 @@ implementation
 
         cexceptionstatehandler.end_try_block(current_asmdata.CurrAsmList,tek_except,excepttemps,trystate,nil);
 
-        current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_catch,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
+        current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_legacy_catch,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
 
         flowcontrol:=[fc_inflowcontrol]+trystate.oldflowcontrol*[fc_catching_exceptions];
         { on statements }
@@ -584,7 +584,7 @@ implementation
                     current_procinfo.CurrBreakLabel:=oldBreakLabel;
                   end;
 
-                current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_catch,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
+                current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_legacy_catch,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
 
                 hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_raise_nested',[],nil).resetiftemp;
 
@@ -1129,7 +1129,7 @@ implementation
         hlcg.g_exception_reason_save_const(current_asmdata.CurrAsmList,exceptionreasontype,0,excepttemps.reasonbuf);
         current_asmdata.CurrAsmList.concat(taicpu.op_const(a_br,4)); // jump to the 'finally' section
 
-        current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_catch,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
+        current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_legacy_catch,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
         { exceptionreason:=1 (exception) }
         hlcg.g_exception_reason_save_const(current_asmdata.CurrAsmList,exceptionreasontype,1,excepttemps.reasonbuf);
         current_asmdata.CurrAsmList.concat(taicpu.op_const(a_br,4)); // jump to the 'finally' section
@@ -1562,7 +1562,7 @@ implementation
             current_procinfo.CurrBreakLabel:=oldBreakLabel;
           end;
 
-        current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_catch,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
+        current_asmdata.CurrAsmList.concat(taicpu.op_sym(a_legacy_catch,current_asmdata.WeakRefAsmSymbol(FPC_EXCEPTION_TAG_SYM,AT_WASM_EXCEPTION_TAG)));
 
         hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_raise_nested',[],nil).resetiftemp;