Browse Source

+ introduced the STACK_POINTER_SYM constant

git-svn-id: branches/wasm@46800 -
nickysn 4 years ago
parent
commit
9f4f432fc6
2 changed files with 4 additions and 3 deletions
  1. 1 0
      compiler/wasm32/cpubase.pas
  2. 3 3
      compiler/wasm32/hlcgcpu.pas

+ 1 - 0
compiler/wasm32/cpubase.pas

@@ -273,6 +273,7 @@ uses
       maxfpuregs = 0;
       maxfpuregs = 0;
       FRAME_POINTER_SYM = '$fp';
       FRAME_POINTER_SYM = '$fp';
       BASE_POINTER_SYM = '$bp';
       BASE_POINTER_SYM = '$bp';
+      STACK_POINTER_SYM = '__stack_top';
 
 
 {*****************************************************************************
 {*****************************************************************************
                                   Helpers
                                   Helpers

+ 3 - 3
compiler/wasm32/hlcgcpu.pas

@@ -1680,7 +1680,7 @@ implementation
       list.Concat(tai_local.create(wbt_i32, FRAME_POINTER_SYM)); //TWasmBasicType
       list.Concat(tai_local.create(wbt_i32, FRAME_POINTER_SYM)); //TWasmBasicType
       list.Concat(tai_local.create(wbt_i32, BASE_POINTER_SYM)); //TWasmBasicType
       list.Concat(tai_local.create(wbt_i32, BASE_POINTER_SYM)); //TWasmBasicType
 
 
-      list.Concat(taicpu.op_sym(a_get_global , current_asmdata.RefAsmSymbol('__stack_top',AT_LABEL)));
+      list.Concat(taicpu.op_sym(a_get_global , current_asmdata.RefAsmSymbol(STACK_POINTER_SYM,AT_LABEL)));
       list.Concat(taicpu.op_sym(a_set_local, current_asmdata.RefAsmSymbol(BASE_POINTER_SYM,AT_LABEL)));
       list.Concat(taicpu.op_sym(a_set_local, current_asmdata.RefAsmSymbol(BASE_POINTER_SYM,AT_LABEL)));
 
 
       if (localsize>0) then begin
       if (localsize>0) then begin
@@ -1689,7 +1689,7 @@ implementation
         list.concat(taicpu.op_none(a_i32_sub));
         list.concat(taicpu.op_none(a_i32_sub));
         list.Concat(taicpu.op_sym(a_set_local, current_asmdata.RefAsmSymbol(FRAME_POINTER_SYM,AT_LABEL)));
         list.Concat(taicpu.op_sym(a_set_local, current_asmdata.RefAsmSymbol(FRAME_POINTER_SYM,AT_LABEL)));
         list.Concat(taicpu.op_sym(a_get_local, current_asmdata.RefAsmSymbol(FRAME_POINTER_SYM,AT_LABEL)));
         list.Concat(taicpu.op_sym(a_get_local, current_asmdata.RefAsmSymbol(FRAME_POINTER_SYM,AT_LABEL)));
-        list.Concat(taicpu.op_sym(a_set_global, current_asmdata.RefAsmSymbol('__stack_top',AT_LABEL)));
+        list.Concat(taicpu.op_sym(a_set_global, current_asmdata.RefAsmSymbol(STACK_POINTER_SYM,AT_LABEL)));
       end;
       end;
 
 
       //list.concat(tai_directive.Create(asd_jlimit,'stack '+tostr(fmaxevalstackheight)));
       //list.concat(tai_directive.Create(asd_jlimit,'stack '+tostr(fmaxevalstackheight)));
@@ -1698,7 +1698,7 @@ implementation
   procedure thlcgwasm.g_proc_exit(list: TAsmList; parasize: longint; nostackframe: boolean);
   procedure thlcgwasm.g_proc_exit(list: TAsmList; parasize: longint; nostackframe: boolean);
     begin
     begin
       list.Concat(taicpu.op_sym(a_get_local, current_asmdata.RefAsmSymbol(BASE_POINTER_SYM,AT_LABEL)));
       list.Concat(taicpu.op_sym(a_get_local, current_asmdata.RefAsmSymbol(BASE_POINTER_SYM,AT_LABEL)));
-      list.Concat(taicpu.op_sym(a_set_global , current_asmdata.RefAsmSymbol('__stack_top',AT_LABEL)));
+      list.Concat(taicpu.op_sym(a_set_global , current_asmdata.RefAsmSymbol(STACK_POINTER_SYM,AT_LABEL)));
 
 
       list.concat(taicpu.op_none(a_return));
       list.concat(taicpu.op_none(a_return));
     end;
     end;