Browse Source

* removed any use of pushleftright_pocalls for non-i386 platforms, since
they always use the same parameter pushing order
* define the pushleftright_pocalls constant only for i386 so it cannot
be accidentally used anymore for other platforms

git-svn-id: trunk@12891 -

Jonas Maebe 16 years ago
parent
commit
7e8343f6e2
3 changed files with 16 additions and 0 deletions
  1. 2 0
      compiler/ncgrtti.pas
  2. 9 0
      compiler/pdecsub.pas
  3. 5 0
      compiler/symconst.pas

+ 2 - 0
compiler/ncgrtti.pas

@@ -662,12 +662,14 @@ implementation
                { write parameter info. The parameters must be written in reverse order
                  if this method uses right to left parameter pushing! }
                current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(def.maxparacount));
+{$ifdef i386}
                if def.proccalloption in pushleftright_pocalls then
                  begin
                    for i:=0 to def.paras.count-1 do
                      write_para(tparavarsym(def.paras[i]));
                  end
                else
+{$endif}
                  begin
                    for i:=def.paras.count-1 downto 0 do
                      write_para(tparavarsym(def.paras[i]));

+ 9 - 0
compiler/pdecsub.pas

@@ -101,10 +101,19 @@ implementation
            if pd.typ=procdef then
             current_tokenpos:=tprocdef(pd).fileinfo;
 
+{$if defined(i386)}
            { For left to right add it at the end to be delphi compatible }
            if pd.proccalloption in (pushleftright_pocalls+[pocall_safecall])  then
              paranr:=paranr_result_leftright
            else
+{$elseif defined(x86) or defined(arm)}
+           { other platforms don't have a "safecall" convention,
+             and never reverse the parameter pushing order
+           }
+           if pd.proccalloption = pocall_safecall)  then
+             paranr:=paranr_result_leftright
+           else
+{$endif}
              paranr:=paranr_result;
            { Generate result variable accessing function result }
            vs:=tparavarsym.create('$result',paranr,vs_var,pd.returndef,[vo_is_funcret,vo_is_hidden_para]);

+ 5 - 0
compiler/symconst.pas

@@ -493,7 +493,12 @@ const
      pocall_cdecl,pocall_cppdecl,pocall_syscall,pocall_mwpascal
    ];
 
+{$ifdef i386}
+   { we only take this into account on i386, on other platforms we always
+     push in the same order
+   }
    pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal];
+{$endif}
 
      SymTypeName : array[tsymtyp] of string[12] = (
        'abstractsym','globalvar','localvar','paravar','fieldvar',