Skip to content

Commit

Permalink
make localsize a parameter (#16681)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored Jul 12, 2024
1 parent e455dab commit 179f1f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions compiler/src/dmd/backend/pdata.d
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ enum ALLOCA_LIMIT = 0x10000;
*
* Params:
* sf = function to generate unwind data for
* localsize = offset to symbols on stack
*/
@trusted
public void win64_pdata(Symbol *sf)
public void win64_pdata(Symbol *sf, targ_size_t localsize)
{
//printf("win64_pdata()\n");
assert(config.exe == EX_WIN64);
Expand All @@ -71,7 +72,7 @@ public void win64_pdata(Symbol *sf)
symbol_keep(spdata);
symbol_debug(spdata);

Symbol *sunwind = win64_unwind(sf);
Symbol *sunwind = win64_unwind(sf, localsize);

/* 3 pointers are emitted:
* 1. pointer to start of function sf
Expand All @@ -96,13 +97,14 @@ private:

/**************************************************
* Unwind data symbol goes in the .xdata section.
* Input:
* sf function to generate unwind data for
* Params:
* sf = function to generate unwind data for
* localsize = offset to symbols on stack
* Returns:
* generated symbol referring to unwind data
*/
@trusted
private Symbol *win64_unwind(Symbol *sf)
private Symbol *win64_unwind(Symbol *sf, targ_size_t localsize)
{
// Generate the unwind name, which is $unwind$funcname
size_t sflen = strlen(sf.Sident.ptr);
Expand All @@ -115,7 +117,7 @@ private Symbol *win64_unwind(Symbol *sf)
symbol_keep(sunwind);
symbol_debug(sunwind);

sunwind.Sdt = unwind_data();
sunwind.Sdt = unwind_data(localsize);
sunwind.Sseg = symbol_iscomdat3(sf) ? MsCoffObj_seg_xdata_comdat(sf) : MsCoffObj_seg_xdata();
sunwind.Salignment = 1;
outdata(sunwind);
Expand Down Expand Up @@ -199,7 +201,7 @@ static if (0)


@trusted
private dt_t *unwind_data()
private dt_t *unwind_data(targ_size_t localsize)
{
UNWIND_INFO ui;

Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/backend/x86/cgcod.d
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void codgen(Symbol *sfunc)
static if (MARS)
{
if (config.exe == EX_WIN64)
win64_pdata(sfunc);
win64_pdata(sfunc, localsize);
}

static if (MARS)
Expand Down Expand Up @@ -2860,7 +2860,7 @@ void scodelem(ref CGstate cg, ref CodeBuilder cdb, elem *e,regm_t *pretregs,regm
touse &= ~mj;
cg.mfuncreg &= ~mj;
cg.regcon.used |= mj;
assert(!(cg.regcon.used & mPSW));
assert(!(cg.regcon.used & mPSW));
break;
}
}
Expand Down

0 comments on commit 179f1f3

Please sign in to comment.