From 179f1f339c867643cee63ddbf3b35d799c7cdfa8 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Thu, 11 Jul 2024 20:20:47 -0700 Subject: [PATCH] make localsize a parameter (#16681) --- compiler/src/dmd/backend/pdata.d | 16 +++++++++------- compiler/src/dmd/backend/x86/cgcod.d | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/compiler/src/dmd/backend/pdata.d b/compiler/src/dmd/backend/pdata.d index a7031d4ef6db..5f9f0749812e 100644 --- a/compiler/src/dmd/backend/pdata.d +++ b/compiler/src/dmd/backend/pdata.d @@ -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); @@ -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 @@ -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); @@ -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); @@ -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; diff --git a/compiler/src/dmd/backend/x86/cgcod.d b/compiler/src/dmd/backend/x86/cgcod.d index c800ee1eeef7..a83e904aa687 100644 --- a/compiler/src/dmd/backend/x86/cgcod.d +++ b/compiler/src/dmd/backend/x86/cgcod.d @@ -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) @@ -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; } }