Skip to content

Commit

Permalink
move calledFinally to CGstate
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored and dlang-bot committed May 15, 2024
1 parent 001b66e commit 45cc33f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions compiler/src/dmd/backend/cgcod.d
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ char needframe; // if true, then we will need the frame
// pointer (BP for the 8088)
char gotref; // !=0 if the GOTsym was referenced
uint usednteh; // if !=0, then used NT exception handling
bool calledFinally; // true if called a BC_finally block

/* Register contents */
con_t regcon;
Expand Down Expand Up @@ -156,7 +155,7 @@ void codgen(Symbol *sfunc)
regsave.reset();
memset(global87.stack.ptr,0,global87.stack.sizeof);

calledFinally = false;
cgstate.calledFinally = false;
usednteh = 0;

if (sfunc.Sfunc.Fflags3 & Fjmonitor &&
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/cod1.d
Original file line number Diff line number Diff line change
Expand Up @@ -3392,7 +3392,7 @@ void cdfunc(ref CodeBuilder cdb, elem* e, regm_t* pretregs)
* A better solution is turn this off only inside the cleanup code.
*/
!usednteh &&
!calledFinally &&
!cgstate.calledFinally &&
(numpara || config.exe == EX_WIN64) &&
cgstate.stackpush == 0 && // cgstate.funcarg needs to be at top of stack
(cgstate.funcargtos == ~0 || numpara < cgstate.funcargtos) &&
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/backend/cod3.d
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ private code *callFinallyBlock(block *bf, regm_t retregs)
CodeBuilder cdbr; cdbr.ctor();
int nalign = 0;

calledFinally = true;
cgstate.calledFinally = true;
uint npush = gensaverestore(retregs,cdbs,cdbr);

if (STACKALIGN >= 16)
Expand Down Expand Up @@ -2511,7 +2511,7 @@ regm_t cod3_useBP()
config.flags & CFGstack ||
localsize >= 0x100 || // arbitrary value < 0x1000
(usednteh & (NTEH_try | NTEH_except | NTEHcpp | EHcleanup | EHtry | NTEHpassthru)) ||
calledFinally ||
cgstate.calledFinally ||
cgstate.Alloca.size
)
goto Lcant;
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/cod5.d
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ else
anyiasm ||
cgstate.Alloca.size ||
usednteh ||
calledFinally ||
cgstate.calledFinally ||
tyf & (mTYnaked | mTYloadds) ||
tym == TYifunc ||
tym == TYmfunc || // can't yet handle ECX passed as parameter
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dmd/backend/code.d
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ struct CGstate
// Special case: if funcargtos==~0, then no
// arguments are there.
bool accessedTLS; // set if accessed Thread Local Storage (TLS)
bool calledFinally; // true if called a BC_finally block

regm_t[4] lastRetregs; // used to not allocate the same register over and over again,
// to improve instruction scheduling
Expand Down

0 comments on commit 45cc33f

Please sign in to comment.