Răsfoiți Sursa

* emit a tai_tagtype for __FPC_exception instead of hardcoding the asm output
directly when wasm native exceptions are enabled

Nikolay Nikolov 3 ani în urmă
părinte
comite
a1c8e92904
3 a modificat fișierele cu 7 adăugiri și 6 ștergeri
  1. 2 0
      compiler/aggas.pas
  2. 0 5
      compiler/wasm32/agllvmmc.pas
  3. 5 1
      compiler/wasm32/nwasmutil.pas

+ 2 - 0
compiler/aggas.pas

@@ -840,6 +840,8 @@ implementation
               writer.AsmWrite(gas_wasm_basic_type_str[wasm_basic_typ]);
               writer.AsmWrite(gas_wasm_basic_type_str[wasm_basic_typ]);
             end;
             end;
           writer.AsmLn;
           writer.AsmLn;
+          writer.AsmWrite(hp.tagname);
+          writer.AsmWriteLn(':');
         end;
         end;
 {$endif WASM}
 {$endif WASM}
 
 

+ 0 - 5
compiler/wasm32/agllvmmc.pas

@@ -83,11 +83,6 @@ implementation
   procedure TLLVMMachineCodePlaygroundAssembler.WriteAsmList;
   procedure TLLVMMachineCodePlaygroundAssembler.WriteAsmList;
     begin
     begin
       writer.AsmWriteLn(#9'.globaltype'#9+STACK_POINTER_SYM+', i32');
       writer.AsmWriteLn(#9'.globaltype'#9+STACK_POINTER_SYM+', i32');
-      if ts_wasm_native_exceptions in current_settings.targetswitches then
-        begin
-          writer.AsmWriteLn(#9'.tagtype'#9'__FPC_exception');
-          writer.AsmWriteLn('__FPC_exception:');
-        end;
       inherited;
       inherited;
     end;
     end;
 
 

+ 5 - 1
compiler/wasm32/nwasmutil.pas

@@ -40,7 +40,7 @@ interface
 implementation
 implementation
 
 
   uses
   uses
-    globtype,
+    globtype,globals,
     cpubase,
     cpubase,
     aasmdata,aasmcpu,
     aasmdata,aasmcpu,
     hlcgobj,hlcgcpu,
     hlcgobj,hlcgcpu,
@@ -68,6 +68,10 @@ implementation
       inherited;
       inherited;
 
 
       list:=current_asmdata.asmlists[al_start];
       list:=current_asmdata.asmlists[al_start];
+
+      if ts_wasm_native_exceptions in current_settings.targetswitches then
+        list.Concat(tai_tagtype.create('__FPC_exception', []));
+
       for i:=0 to current_module.deflist.Count-1 do
       for i:=0 to current_module.deflist.Count-1 do
         begin
         begin
           def:=tdef(current_module.deflist[i]);
           def:=tdef(current_module.deflist[i]);