From f2096de53a211fc86b307167c6339f7a55985fc0 Mon Sep 17 00:00:00 2001 From: sergei Date: Thu, 19 Dec 2013 10:32:32 +0000 Subject: [PATCH] * tcg386.g_proc_exit: instead of recalculating stack size, use current_procinfo.final_localsize which was calculated in g_proc_entry. * tcgx86.g_proc_entry: don't over-allocate stack in SEH finalizer procedures. git-svn-id: trunk@26251 - --- compiler/i386/cgcpu.pas | 14 ++------------ compiler/x86/cgx86.pas | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/compiler/i386/cgcpu.pas b/compiler/i386/cgcpu.pas index 55254066ce..5f230e82b9 100644 --- a/compiler/i386/cgcpu.pas +++ b/compiler/i386/cgcpu.pas @@ -303,8 +303,6 @@ unit cgcpu; list.concat(Taicpu.op_ref_reg(A_LEA,TCGSize2OpSize[OS_ADDR],href,NR_STACK_POINTER_REG)); end; - var - stacksize : longint; begin { MMX needs to call EMMS } if assigned(rg[R_MMXREGISTER]) and @@ -317,16 +315,8 @@ unit cgcpu; if (current_procinfo.framepointer=NR_STACK_POINTER_REG) or (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then begin - stacksize:=current_procinfo.calc_stackframe_size; - if (target_info.stackalign>4) 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),target_info.stackalign) - sizeof(aint); - if stacksize<>0 then - increase_sp(stacksize); + if current_procinfo.final_localsize<>0 then + increase_sp(current_procinfo.final_localsize); if (not paramanager.use_fixed_stack) then internal_restore_regs(list,true); if (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 811bf4806b..b662fb10b0 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -2660,7 +2660,7 @@ unit cgx86; Exception filters don't have own local vars, and temps are 'mapped' to the parent procedure. maxpushedparasize is already aligned at least on x86_64. } - //localsize:=current_procinfo.maxpushedparasize; + localsize:=current_procinfo.maxpushedparasize; end; current_asmdata.asmcfi.cfa_def_cfa_register(list,NR_FRAME_POINTER_REG); end;