* keep stack aligned to 16 byte borders on winx64

git-svn-id: trunk@3212 -
This commit is contained in:
florian 2006-04-15 16:48:28 +00:00
parent b1ae9595dc
commit 2d3d4a66f6
3 changed files with 17 additions and 4 deletions

View File

@ -1833,12 +1833,12 @@ unit cgx86;
{ allocate stackframe space } { allocate stackframe space }
if (localsize<>0) or if (localsize<>0) or
((target_info.system = system_i386_darwin) and ((target_info.system in [system_i386_darwin,system_x86_64_win64]) and
(stackmisalignment <> 0) and (stackmisalignment <> 0) and
((pi_do_call in current_procinfo.flags) or ((pi_do_call in current_procinfo.flags) or
(po_assembler in current_procinfo.procdef.procoptions))) then (po_assembler in current_procinfo.procdef.procoptions))) then
begin begin
if (target_info.system = system_i386_darwin) then if (target_info.system in [system_i386_darwin,system_x86_64_win64]) then
localsize := align(localsize+stackmisalignment,16)-stackmisalignment; localsize := align(localsize+stackmisalignment,16)-stackmisalignment;
cg.g_stackpointer_alloc(list,localsize); cg.g_stackpointer_alloc(list,localsize);
if current_procinfo.framepointer=NR_STACK_POINTER_REG then if current_procinfo.framepointer=NR_STACK_POINTER_REG then

View File

@ -73,6 +73,13 @@ unit cgcpu;
if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then if (current_procinfo.framepointer=NR_STACK_POINTER_REG) then
begin begin
stacksize:=current_procinfo.calc_stackframe_size; stacksize:=current_procinfo.calc_stackframe_size;
if (target_info.system = system_x86_64_win64) and
((stacksize <> 0) or
(pi_do_call in current_procinfo.flags) or
{ can't detect if a call in this case -> use nostackframe }
{ if you (think you) know what you are doing }
(po_assembler in current_procinfo.procdef.procoptions)) then
stacksize := align(stacksize+sizeof(aint),16) - sizeof(aint);
if (stacksize<>0) then if (stacksize<>0) then
cg.a_op_const_reg(list,OP_ADD,OS_ADDR,stacksize,current_procinfo.framepointer); cg.a_op_const_reg(list,OP_ADD,OS_ADDR,stacksize,current_procinfo.framepointer);
end end

View File

@ -495,7 +495,10 @@ unit cpupara;
begin begin
intparareg:=0; intparareg:=0;
mmparareg:=0; mmparareg:=0;
parasize:=0; if target_info.system=system_x86_64_win64 then
parasize:=4*8
else
parasize:=0;
{ calculate the registers for the normal parameters } { calculate the registers for the normal parameters }
create_paraloc_info_intern(p,callerside,p.paras,intparareg,mmparareg,parasize); create_paraloc_info_intern(p,callerside,p.paras,intparareg,mmparareg,parasize);
{ append the varargs } { append the varargs }
@ -513,7 +516,10 @@ unit cpupara;
begin begin
intparareg:=0; intparareg:=0;
mmparareg:=0; mmparareg:=0;
parasize:=0; if target_info.system=system_x86_64_win64 then
parasize:=4*8
else
parasize:=0;
create_paraloc_info_intern(p,side,p.paras,intparareg,mmparareg,parasize); create_paraloc_info_intern(p,side,p.paras,intparareg,mmparareg,parasize);
{ Create Function result paraloc } { Create Function result paraloc }
create_funcretloc_info(p,side); create_funcretloc_info(p,side);