Skip to content

Commit e2005d1

Browse files
authored
JIT: Skip GC info for trivial async calls for x86 (#121941)
For x86 we only report GC pointers live in callee save registers, and we also avoid reporting any trivial call. There is compensating code upstream of the GC reporting that returns for trivial calls, but this code did not account for the GC ref returned for async continuations. Thus it was possible that we made it into the GC encoder with a trivial call and then hit an assert. Fix #121872
1 parent f1e2f89 commit e2005d1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/coreclr/jit/emit.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10373,9 +10373,10 @@ void emitter::emitStackPopLargeStk(BYTE* addr, bool isCall, unsigned char callIn
1037310373
assert(regMaskTP::FromIntRegSet(SingleTypeRegSet(byrefRegs << REG_INT_FIRST)) == emitThisByrefRegs);
1037410374

1037510375
#ifdef JIT32_GCENCODER
10376-
// x86 does not report GC refs/byrefs in return registers at call sites
10377-
gcrefRegs &= ~(1u << (REG_INTRET - REG_INT_FIRST));
10378-
byrefRegs &= ~(1u << (REG_INTRET - REG_INT_FIRST));
10376+
// x86 only reports GC refs/byrefs in callee saves at call sites -- no return registers.
10377+
unsigned reportedRegs = (RBM_INT_CALLEE_SAVED | RBM_EBP).GetIntRegSet() >> REG_INT_FIRST;
10378+
gcrefRegs &= reportedRegs;
10379+
byrefRegs &= reportedRegs;
1037910380

1038010381
// For the general encoder, we always have to record calls, so we don't take this early return. /* Are there any
1038110382
// args to pop at this call site?

0 commit comments

Comments
 (0)