Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,14 @@ insGroup* emitter::emitSavIG(bool emitAdd)
VarSetOps::Assign(emitComp, emitPrevGCrefVars, emitThisGCrefVars);
emitPrevGCrefRegs = emitThisGCrefRegs;
emitPrevByrefRegs = emitThisByrefRegs;
}

if (emitAddedLabel)
{
// Reset emitForceStoreGCState only after seeing label. It will keep
// marking IGs with IGF_GC_VARS flag until that.
emitForceStoreGCState = false;
emitAddedLabel = false;
}

#ifdef DEBUG
Expand Down Expand Up @@ -2839,6 +2845,11 @@ void* emitter::emitAddLabel(VARSET_VALARG_TP GCvars, regMaskTP gcrefRegs, regMas
}
}

if (emitForceStoreGCState)
{
emitAddedLabel = true;
}

/* Create a new IG if the current one is non-empty */

if (emitCurIGnonEmpty())
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2761,6 +2761,14 @@ class emitter

bool emitForceStoreGCState;

// This flag is used together with `emitForceStoreGCState`. After we set
// emitForceStoreGCState = true, we will mark `emitAddedLabel` to true whenever
// we see a label IG. In emitSavIG, we will reset `emitForceStoreGCState = false`
// only after seeing `emitAddedLabel == true`. Until then, we will keep recording
// GC_VARS on the IGs.

bool emitAddedLabel;

// emitThis* variables are used during emission, to track GC updates
// on a per-instruction basis. During code generation, per-instruction
// tracking is done with variables gcVarPtrSetCur, gcRegGCrefSetCur,
Expand Down
Loading