You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There were multiple issues with having BailOnNoProfile for functions with try.
1. BailOnNoProfile for functions within try can make argouts orphaned. For orphaned argouts, we allocate space in locals area for bailouts.
But when there is a try we expect all live out params at the top of the stack instead of the locals area. We cannot distinguish at Bailout time to
read from the locals area or the top of the stack for out params, because all we depend upon to distinguish between the two are if the offsets are -ve or +ve.
2. To compute totalStackToBeRestored on return from EH bailout, we use totalOutParamCount.
But with BailOnNoProfile, we need to remove the number of orphaned args and the number of dead out params from this number.
3 We compute startCallArgRestoreAdjustCounts in GlobOptBailOut which consist of offsets from top of the try c++ frame in case of nested calls.
For nested calls, argouts for the outer call need to be restored from an offset of stack-adjustment-done-by-the-inner-call from esp.
If the inner call consisted of orphaned args, this calculation is inaccurate. At this point we do not know how many orphaned args are present.
We know if an arg is orphaned only during lowering.
Similarly if the inner call consisted of dead out params, this calculation will be inaccurate.
This change fixes the above issues.
Fixes OS#14486384
if (this->currentRegion && (this->currentRegion->GetType() == RegionTypeTry || this->currentRegion->GetType() == RegionTypeFinally))
1003
-
{
1004
-
// For a bailout in argument evaluation from an EH region, the esp is offset by the TryCatch helper's frame. So, the argouts are not actually pushed at the
1005
-
// offsets stored in the bailout record, which are relative to ebp. Need to restore the argouts from the actual value of esp before calling the Bailout helper.
1006
-
// For nested calls, argouts for the outer call need to be restored from an offset of stack-adjustment-done-by-the-inner-call from esp.
1007
-
if (startCallNumber + 1 == bailOutInfo->startCallCount)
if (this->currentRegion && (this->currentRegion->GetType() == RegionTypeTry || this->currentRegion->GetType() == RegionTypeFinally))
2169
+
{
2170
+
// For a bailout in argument evaluation from an EH region, the esp is offset by the TryCatch helper's frame. So, the argouts are not actually pushed at the
2171
+
// offsets stored in the bailout record, which are relative to ebp. Need to restore the argouts from the actual value of esp before calling the Bailout helper.
2172
+
// For nested calls, argouts for the outer call need to be restored from an offset of stack-adjustment-done-by-the-inner-call from esp.
2173
+
if ((unsigned)(i + 1) == bailOutInfo->startCallCount)
0 commit comments