mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 10:45:08 +02:00
* abstractprocdef.para_size needs alignment parameter
* secondcallparan gets para_alignment size instead of dword_align
This commit is contained in:
parent
c8469b68ea
commit
62df907953
@ -29,7 +29,7 @@ interface
|
||||
symtable,tree;
|
||||
|
||||
procedure secondcallparan(var p : ptree;defcoll : pparaitem;
|
||||
push_from_left_to_right,inlined,dword_align : boolean;para_offset : longint);
|
||||
push_from_left_to_right,inlined : boolean;para_alignment,para_offset : longint);
|
||||
procedure secondcalln(var p : ptree);
|
||||
procedure secondprocinline(var p : ptree);
|
||||
|
||||
@ -52,7 +52,7 @@ implementation
|
||||
*****************************************************************************}
|
||||
|
||||
procedure secondcallparan(var p : ptree;defcoll : pparaitem;
|
||||
push_from_left_to_right,inlined,dword_align : boolean;para_offset : longint);
|
||||
push_from_left_to_right,inlined : boolean;para_alignment,para_offset : longint);
|
||||
|
||||
procedure maybe_push_high;
|
||||
begin
|
||||
@ -74,15 +74,18 @@ implementation
|
||||
|
||||
var
|
||||
otlabel,oflabel : pasmlabel;
|
||||
align : longint;
|
||||
{ temporary variables: }
|
||||
tempdeftype : tdeftype;
|
||||
r : preference;
|
||||
begin
|
||||
{ set default para_alignment to target_os.stackalignment }
|
||||
if para_alignment=0 then
|
||||
para_alignment:=target_os.stackalignment;
|
||||
|
||||
{ push from left to right if specified }
|
||||
if push_from_left_to_right and assigned(p^.right) then
|
||||
secondcallparan(p^.right,pparaitem(defcoll^.next),push_from_left_to_right,
|
||||
inlined,dword_align,para_offset);
|
||||
inlined,para_alignment,para_offset);
|
||||
otlabel:=truelabel;
|
||||
oflabel:=falselabel;
|
||||
getlabel(truelabel);
|
||||
@ -194,10 +197,7 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
align:=target_os.stackalignment;
|
||||
if dword_align then
|
||||
align:=4;
|
||||
push_value_para(p^.left,inlined,para_offset,align);
|
||||
push_value_para(p^.left,inlined,para_offset,para_alignment);
|
||||
end;
|
||||
end;
|
||||
truelabel:=otlabel;
|
||||
@ -205,7 +205,7 @@ implementation
|
||||
{ push from right to left }
|
||||
if not push_from_left_to_right and assigned(p^.right) then
|
||||
secondcallparan(p^.right,pparaitem(defcoll^.next),push_from_left_to_right,
|
||||
inlined,dword_align,para_offset);
|
||||
inlined,para_alignment,para_offset);
|
||||
end;
|
||||
|
||||
|
||||
@ -239,6 +239,7 @@ implementation
|
||||
pp,params : ptree;
|
||||
inlined : boolean;
|
||||
inlinecode : ptree;
|
||||
para_alignment,
|
||||
para_offset : longint;
|
||||
{ instruction for alignement correction }
|
||||
{ corr : paicpu;}
|
||||
@ -261,6 +262,12 @@ implementation
|
||||
unusedregisters:=unused;
|
||||
usablecount:=usablereg32;
|
||||
|
||||
if (pocall_cdecl in p^.procdefinition^.proccalloptions) or
|
||||
(pocall_stdcall in p^.procdefinition^.proccalloptions) then
|
||||
para_alignment:=4
|
||||
else
|
||||
para_alignment:=target_os.stackalignment;
|
||||
|
||||
if not assigned(p^.procdefinition) then
|
||||
exit;
|
||||
if (pocall_inline in p^.procdefinition^.proccalloptions) then
|
||||
@ -343,7 +350,7 @@ implementation
|
||||
if i>0 then
|
||||
inc(pop_size,4-i);
|
||||
{ This parasize aligned on 4 ? }
|
||||
i:=p^.procdefinition^.para_size and 3;
|
||||
i:=p^.procdefinition^.para_size(para_alignment) and 3;
|
||||
if i>0 then
|
||||
inc(pop_size,4-i);
|
||||
{ insert the opcode and update pushedparasize }
|
||||
@ -396,17 +403,11 @@ implementation
|
||||
if assigned(p^.right) then
|
||||
secondcallparan(p^.left,pparaitem(pabstractprocdef(p^.right^.resulttype)^.para^.first),
|
||||
(pocall_leftright in p^.procdefinition^.proccalloptions),
|
||||
inlined,
|
||||
(pocall_cdecl in p^.procdefinition^.proccalloptions) or
|
||||
(pocall_stdcall in p^.procdefinition^.proccalloptions),
|
||||
para_offset)
|
||||
inlined,para_alignment,para_offset)
|
||||
else
|
||||
secondcallparan(p^.left,pparaitem(p^.procdefinition^.para^.first),
|
||||
(pocall_leftright in p^.procdefinition^.proccalloptions),
|
||||
inlined,
|
||||
(pocall_cdecl in p^.procdefinition^.proccalloptions) or
|
||||
(pocall_stdcall in p^.procdefinition^.proccalloptions),
|
||||
para_offset);
|
||||
inlined,para_alignment,para_offset);
|
||||
end;
|
||||
params:=p^.left;
|
||||
p^.left:=nil;
|
||||
@ -1332,7 +1333,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.121 2000-01-23 18:50:07 peter
|
||||
Revision 1.122 2000-01-26 12:02:29 peter
|
||||
* abstractprocdef.para_size needs alignment parameter
|
||||
* secondcallparan gets para_alignment size instead of dword_align
|
||||
|
||||
Revision 1.121 2000/01/23 18:50:07 peter
|
||||
* fixed missing push esi for constructor calling
|
||||
|
||||
Revision 1.120 2000/01/21 22:06:16 florian
|
||||
|
@ -338,7 +338,7 @@ implementation
|
||||
else
|
||||
if (is_chararray(hp^.resulttype)) then
|
||||
dummycoll.paratype.setdef(openchararraydef);
|
||||
secondcallparan(hp,@dummycoll,false,false,false,0);
|
||||
secondcallparan(hp,@dummycoll,false,false,0,0);
|
||||
if ft=ft_typed then
|
||||
never_copy_const_param:=false;
|
||||
end;
|
||||
@ -382,7 +382,7 @@ implementation
|
||||
hp^.right:=nil;
|
||||
dummycoll.paratype.setdef(hp^.resulttype);
|
||||
dummycoll.paratyp:=vs_value;
|
||||
secondcallparan(hp,@dummycoll,false,false,false,0);
|
||||
secondcallparan(hp,@dummycoll,false,false,0,0);
|
||||
hp^.right:=node;
|
||||
if codegenerror then
|
||||
exit;
|
||||
@ -400,7 +400,7 @@ implementation
|
||||
hp^.right:=nil;
|
||||
dummycoll.paratype.setdef(hp^.resulttype);
|
||||
dummycoll.paratyp:=vs_value;
|
||||
secondcallparan(hp,@dummycoll,false,false,false,0);
|
||||
secondcallparan(hp,@dummycoll,false,false,0,0);
|
||||
hp^.right:=node;
|
||||
if pararesult^.deftype<>floatdef then
|
||||
CGMessage(parser_e_illegal_colon_qualifier);
|
||||
@ -562,7 +562,7 @@ implementation
|
||||
else
|
||||
dummycoll.paratype.setdef(hp^.resulttype);
|
||||
procedureprefix:='FPC_'+pstringdef(hp^.resulttype)^.stringtypname+'_';
|
||||
secondcallparan(hp,@dummycoll,false,false,false,0);
|
||||
secondcallparan(hp,@dummycoll,false,false,0,0);
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
@ -584,9 +584,7 @@ implementation
|
||||
begin
|
||||
dummycoll.paratype.setdef(hp^.resulttype);
|
||||
dummycoll.paratyp:=vs_value;
|
||||
secondcallparan(hp,@dummycoll,false
|
||||
,false,false,0
|
||||
);
|
||||
secondcallparan(hp,@dummycoll,false,false,0,0);
|
||||
if codegenerror then
|
||||
exit;
|
||||
disposetree(hp);
|
||||
@ -603,9 +601,7 @@ implementation
|
||||
begin
|
||||
dummycoll.paratype.setdef(hp^.resulttype);
|
||||
dummycoll.paratyp:=vs_value;
|
||||
secondcallparan(hp,@dummycoll,false
|
||||
,false,false,0
|
||||
);
|
||||
secondcallparan(hp,@dummycoll,false,false,0,0);
|
||||
if codegenerror then
|
||||
exit;
|
||||
disposetree(hp);
|
||||
@ -629,9 +625,7 @@ implementation
|
||||
{ last arg longint or real }
|
||||
dummycoll.paratype.setdef(hp^.resulttype);
|
||||
dummycoll.paratyp:=vs_value;
|
||||
secondcallparan(hp,@dummycoll,false
|
||||
,false,false,0
|
||||
);
|
||||
secondcallparan(hp,@dummycoll,false,false,0,0);
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
@ -701,7 +695,7 @@ implementation
|
||||
{load and push the address of the destination}
|
||||
dummycoll.paratyp:=vs_var;
|
||||
dummycoll.paratype.setdef(dest_para^.resulttype);
|
||||
secondcallparan(dest_para,@dummycoll,false,false,false,0);
|
||||
secondcallparan(dest_para,@dummycoll,false,false,0,0);
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
@ -715,7 +709,7 @@ implementation
|
||||
Begin
|
||||
dummycoll.paratyp:=vs_var;
|
||||
dummycoll.paratype.setdef(code_para^.resulttype);
|
||||
secondcallparan(code_para,@dummycoll,false,false,false,0);
|
||||
secondcallparan(code_para,@dummycoll,false,false,0,0);
|
||||
if codegenerror then
|
||||
exit;
|
||||
Disposetree(code_para);
|
||||
@ -730,7 +724,7 @@ implementation
|
||||
{node = first parameter = string}
|
||||
dummycoll.paratyp:=vs_const;
|
||||
dummycoll.paratype.setdef(node^.resulttype);
|
||||
secondcallparan(node,@dummycoll,false,false,false,0);
|
||||
secondcallparan(node,@dummycoll,false,false,0,0);
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
@ -1513,7 +1507,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.91 2000-01-24 20:11:10 florian
|
||||
Revision 1.92 2000-01-26 12:02:29 peter
|
||||
* abstractprocdef.para_size needs alignment parameter
|
||||
* secondcallparan gets para_alignment size instead of dword_align
|
||||
|
||||
Revision 1.91 2000/01/24 20:11:10 florian
|
||||
* internalerror 10 for inlined math functions fixed
|
||||
|
||||
Revision 1.90 2000/01/09 23:16:05 peter
|
||||
@ -1659,4 +1657,4 @@ end.
|
||||
* some fixes for qword
|
||||
* start of register calling conventions
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2372,7 +2372,7 @@
|
||||
end;
|
||||
|
||||
|
||||
function tabstractprocdef.para_size : longint;
|
||||
function tabstractprocdef.para_size(alignsize:longint) : longint;
|
||||
var
|
||||
pdc : pparaitem;
|
||||
l : longint;
|
||||
@ -2387,8 +2387,9 @@
|
||||
vs_const : if push_addr_param(pdc^.paratype.def) then
|
||||
inc(l,target_os.size_of_pointer)
|
||||
else
|
||||
inc(l,align(pdc^.paratype.def^.size,target_os.stackalignment));
|
||||
inc(l,pdc^.paratype.def^.size);
|
||||
end;
|
||||
l:=align(l,alignsize);
|
||||
pdc:=pparaitem(pdc^.next);
|
||||
end;
|
||||
para_size:=l;
|
||||
@ -3858,7 +3859,11 @@ Const local_symtable_index : longint = $8001;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.188 2000-01-23 16:35:31 peter
|
||||
Revision 1.189 2000-01-26 12:02:29 peter
|
||||
* abstractprocdef.para_size needs alignment parameter
|
||||
* secondcallparan gets para_alignment size instead of dword_align
|
||||
|
||||
Revision 1.188 2000/01/23 16:35:31 peter
|
||||
* localbrowser loading of absolute fixed. It needed a symtablestack
|
||||
which was not setup correctly
|
||||
|
||||
|
@ -346,7 +346,7 @@
|
||||
procedure write;virtual;
|
||||
procedure deref;virtual;
|
||||
procedure concatpara(tt:ttype;vsp : tvarspez);
|
||||
function para_size : longint;
|
||||
function para_size(alignsize:longint) : longint;
|
||||
function demangled_paras : string;
|
||||
function proccalloption2str : string;
|
||||
procedure test_if_fpu_result;
|
||||
@ -528,7 +528,11 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.50 2000-01-07 01:14:40 peter
|
||||
Revision 1.51 2000-01-26 12:02:30 peter
|
||||
* abstractprocdef.para_size needs alignment parameter
|
||||
* secondcallparan gets para_alignment size instead of dword_align
|
||||
|
||||
Revision 1.50 2000/01/07 01:14:40 peter
|
||||
* updated copyright to 2000
|
||||
|
||||
Revision 1.49 2000/01/03 19:26:04 peter
|
||||
|
@ -1298,7 +1298,7 @@ unit tree;
|
||||
p^.inlineprocsym:=callp^.symtableprocentry;
|
||||
p^.retoffset:=-4; { less dangerous as zero (PM) }
|
||||
p^.para_offset:=0;
|
||||
p^.para_size:=p^.inlineprocsym^.definition^.para_size;
|
||||
p^.para_size:=p^.inlineprocsym^.definition^.para_size(target_os.stackalignment);
|
||||
if ret_in_param(p^.inlineprocsym^.definition^.rettype.def) then
|
||||
p^.para_size:=p^.para_size+target_os.size_of_pointer;
|
||||
{ copy args }
|
||||
@ -1918,7 +1918,11 @@ unit tree;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.109 2000-01-09 23:16:07 peter
|
||||
Revision 1.110 2000-01-26 12:02:30 peter
|
||||
* abstractprocdef.para_size needs alignment parameter
|
||||
* secondcallparan gets para_alignment size instead of dword_align
|
||||
|
||||
Revision 1.109 2000/01/09 23:16:07 peter
|
||||
* added st_default stringtype
|
||||
* genstringconstnode extended with stringtype parameter using st_default
|
||||
will do the old behaviour
|
||||
|
Loading…
Reference in New Issue
Block a user