Jelajahi Sumber

+ introduced end_block, end_if, end_loop

git-svn-id: branches/wasm@46842 -
nickysn 4 tahun lalu
induk
melakukan
e1b6f0bd85

+ 2 - 2
compiler/wasm32/cpubase.pas

@@ -39,8 +39,8 @@ uses
     type
       TAsmOp=(A_None,
       // control flow
-      a_block, a_loop, a_br, a_br_if, a_br_table, a_if, a_else, a_end,
-      a_return, a_unreachable,
+      a_block, a_loop, a_br, a_br_if, a_br_table, a_if, a_else, a_end_block,
+      a_end_loop, a_end_if, a_return, a_unreachable,
       // basic
       a_nop, a_drop, a_i32_const, a_i64_const, a_f32_const, a_f64_const,
       a_get_local, a_set_local, a_tee_local, a_get_global, a_set_global,

+ 2 - 2
compiler/wasm32/itcpugas.pas

@@ -38,8 +38,8 @@ interface
     gas_op2str : op2strtable = (
       '<none>',
       // control flow
-      'block', 'loop', 'br', 'br_if', 'br_table', 'if', 'else', 'end',
-      'return', 'unreachable',
+      'block', 'loop', 'br', 'br_if', 'br_table', 'if', 'else', 'end_block',
+      'end_loop', 'end_if', 'return', 'unreachable',
       // basic
       'nop', 'drop', 'i32.const', 'i64.const', 'f32.const', 'f64.const',
       'local.get', 'local.set', 'local.tee', 'global.get', 'global.set',

+ 2 - 2
compiler/wasm32/nwasmadd.pas

@@ -275,7 +275,7 @@ interface
                    // inside of ELSE (the condition evaluated as false)
                    // for "and" must end evaluation immediately
                    current_asmdata.CurrAsmList.Concat( taicpu.op_const(a_i32_const, 0) );
-                   current_asmdata.CurrAsmList.Concat( taicpu.op_none(a_end) );
+                   current_asmdata.CurrAsmList.Concat( taicpu.op_none(a_end_if) );
                 end;
               orn :
                 begin
@@ -289,7 +289,7 @@ interface
                    secondpass(right);
                    // inside of ELSE (the condition evaluated as false)
                    // for "and" must end evaluation immediately
-                   current_asmdata.CurrAsmList.Concat( taicpu.op_none(a_end) );
+                   current_asmdata.CurrAsmList.Concat( taicpu.op_none(a_end_if) );
                 end;
               else
                 Internalerror(2019091902);

+ 4 - 4
compiler/wasm32/nwasmflw.pas

@@ -120,14 +120,14 @@ begin
   if (lnf_testatbegin in loopflags) then
     current_asmdata.CurrAsmList.concat(taicpu.op_const(a_br,1) ); // jump back to the external loop
 
-  current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end));
+  current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_block));
   if not (lnf_testatbegin in loopflags) then begin
     pass_generate_code_condition;
   end;
   current_asmdata.CurrAsmList.concat(taicpu.op_const(a_br,0) ); // jump back to loop
 
-  current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end));
-  current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end));
+  current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_loop));
+  current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_block));
 
   current_procinfo.CurrContinueLabel:=oldclabel;
   current_procinfo.CurrBreakLabel:=oldblabel;
@@ -175,7 +175,7 @@ begin
 
   // 0 const on stack if used to return IF value
   current_asmdata.CurrAsmList.concat(taicpu.op_const(a_i32_const, 0));
-  current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end));
+  current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_if));
   thlcgwasm(hlcg).decblock;
 
   // clearing IF return value

+ 1 - 1
compiler/wasm32/strinst.inc

@@ -22,7 +22,7 @@
 
         '<none>',
         // control flow
-        'block', 'loop', 'br', 'br_if', 'br_table', 'if', 'else', 'end',
+        'block', 'loop', 'br', 'br_if', 'br_table', 'if', 'else', 'end', 'end', 'end',
         'return', 'unreachable',
         // basic
         'nop', 'drop', 'i32.const', 'i64.const', 'f32.const', 'f64.const',