From 77615cd3c0fb70da12c1d1d3532f1296f182713b Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 24 Feb 2019 21:06:14 +0000 Subject: [PATCH] * cleanup stack on i386 after call to fpc_psabi_begin_catch git-svn-id: branches/debug_eh@41454 - --- compiler/psabiehpi.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/psabiehpi.pas b/compiler/psabiehpi.pas index 2b8f0dbef5..61695edab8 100644 --- a/compiler/psabiehpi.pas +++ b/compiler/psabiehpi.pas @@ -121,7 +121,11 @@ implementation parabase,paramgr, hlcgobj, pass_2, - ncgflw; + ncgflw +{$ifdef i386} + ,aasmcpu +{$endif i386} + ; type @@ -616,6 +620,7 @@ implementation hlcg.a_load_reg_cgpara(list,voidpointertype,t.unwind_info,cgpara1); paramanager.freecgpara(list,cgpara1); hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_resume',[@cgpara1],nil).resetiftemp; + { we do not have to clean up the stack, we never return } cgpara1.done; psabiehprocinfo.CreateNewPSABIEHCallsite(list); @@ -708,6 +713,11 @@ implementation paramanager.getintparaloc(list, pd, 1, paraloc1); hlcg.a_load_reg_cgpara(list,voidpointertype,wrappedexception,paraloc1); begincatchres:=hlcg.g_call_system_proc(list,pd,[@paraloc1],nil); +{$ifdef i386} + { fpc_psabi_begin_catch is cdecl, not sure how to do this properly } + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_ADD,S_L,4,NR_ESP)); +{$endif i386} + location_reset(exceptloc, LOC_REGISTER, def_cgsize(begincatchres.def)); exceptloc.register:=hlcg.getaddressregister(list, begincatchres.def); hlcg.gen_load_cgpara_loc(list, begincatchres.def, begincatchres, exceptloc, true);