Skip to content

Commit f23fe27

Browse files
committed
Fix asserts
1 parent 931464e commit f23fe27

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/coreclr/jit/codegencommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ void CodeGen::genUpdateCurrentFunclet(BasicBlock* block)
16421642
}
16431643
else
16441644
{
1645-
assert(compiler->compCurrFuncIdx <= compiler->compFuncInfoCount);
1645+
assert(compiler->funCurrentFuncIdx() <= compiler->compFuncInfoCount);
16461646
if (compiler->funCurrentFunc()->funKind == FUNC_FILTER)
16471647
{
16481648
assert(compiler->ehGetDsc(compiler->funCurrentFunc()->funEHIndex)->InFilterRegionBBRange(block));

src/coreclr/jit/compiler.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8417,7 +8417,7 @@ class Compiler
84178417

84188418
// Things that MAY belong either in CodeGen or CodeGenContext
84198419
FuncInfoDsc* compFuncInfos;
8420-
unsigned short compCurrFuncIdx = 0;
8420+
unsigned short compCurrFuncIdx;
84218421
unsigned short compFuncInfoCount;
84228422
FuncInfoDsc compFuncInfoRoot;
84238423

@@ -8434,6 +8434,11 @@ class Compiler
84348434
}
84358435
}
84368436

8437+
unsigned short funCurrentFuncIdx()
8438+
{
8439+
return UsesFunclets() ? compCurrFuncIdx : 0;
8440+
}
8441+
84378442
FuncInfoDsc* funCurrentFunc();
84388443
void funSetCurrentFunc(unsigned funcIdx);
84398444
FuncInfoDsc* funGetFunc(unsigned funcIdx);

src/coreclr/jit/emit.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,8 +2101,7 @@ void emitter::emitCreatePlaceholderIG(insGroupPlaceholderType igType,
21012101
* case, we need to make sure any re-used fields, such as igFuncIdx, are correct.
21022102
*/
21032103

2104-
assert(emitComp->UsesFunclets() || emitComp->compCurrFuncIdx == 0);
2105-
igPh->igFuncIdx = emitComp->compCurrFuncIdx;
2104+
igPh->igFuncIdx = emitComp->funCurrentFuncIdx();
21062105

21072106
/* Create a separate block of memory to store placeholder information.
21082107
* We could use unions to put some of this into the insGroup itself, but we don't
@@ -9553,8 +9552,7 @@ void emitter::emitInitIG(insGroup* ig)
95539552

95549553
/* Set the current function index */
95559554

9556-
assert(emitComp->UsesFunclets() || emitComp->compCurrFuncIdx == 0);
9557-
ig->igFuncIdx = emitComp->compCurrFuncIdx;
9555+
ig->igFuncIdx = emitComp->funCurrentFuncIdx();
95589556

95599557
ig->igFlags = 0;
95609558

src/coreclr/jit/fgbasic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5694,7 +5694,7 @@ BasicBlock* Compiler::fgRelocateEHRange(unsigned regionIndex, FG_RELOCATE_TYPE r
56945694
BasicBlock* bPrev = nullptr;
56955695

56965696
// We don't support moving try regions... yet?
5697-
noway_assert(UsesFunclets() && relocateType == FG_RELOCATE_HANDLER);
5697+
noway_assert(!UsesFunclets() || relocateType == FG_RELOCATE_HANDLER);
56985698

56995699
HBtab = ehGetDsc(regionIndex);
57005700

0 commit comments

Comments
 (0)