Reverts dotnet/coreclr#9655 which didn't work correctly
Revised code to match amd64
Fixes many failing GCStress tests
Commit migrated from https://github.com/dotnet/coreclr/commit/
915df991419a5da16bc6fbb81d3218eac96d451c
// In the case of a GC-Pointer we'll call the ByRef write barrier helper
genEmitHelperCall(CORINFO_HELP_ASSIGN_BYREF, 0, EA_PTRSIZE);
- // genEmitHelperCall(CORINFO_HELP_ASSIGN_BYREF...) killed these registers.
- // However they are still live references to the structures we are copying.
- gcInfo.gcMarkRegPtrVal(REG_WRITE_BARRIER_SRC_BYREF, TYP_BYREF);
- gcInfo.gcMarkRegPtrVal(REG_WRITE_BARRIER_DST_BYREF, TYP_BYREF);
-
gcPtrCount--;
break;
}
#if defined(_TARGET_AMD64_)
return RBM_RSI | RBM_RDI | RBM_CALLEE_TRASH;
#elif defined(_TARGET_ARM64_)
- return RBM_CALLEE_TRASH_NOGC;
+ return RBM_WRITE_BARRIER_SRC_BYREF | RBM_WRITE_BARRIER_DST_BYREF | RBM_CALLEE_TRASH_NOGC;
#elif defined(_TARGET_X86_)
return RBM_ESI | RBM_EDI | RBM_ECX;
#else
#elif defined(_TARGET_X86_)
// This helper only trashes ECX.
return RBM_ECX;
+#elif defined(_TARGET_ARM64_)
+ return RBM_CALLEE_TRASH_NOGC & ~(RBM_WRITE_BARRIER_SRC_BYREF | RBM_WRITE_BARRIER_DST_BYREF);
#else
return RBM_CALLEE_TRASH_NOGC;
#endif // defined(_TARGET_AMD64_)
{
assert(emitNoGChelper(Compiler::eeGetHelperNum(methHnd)));
- // This call will preserve the liveness of most registers
- //
- // - On the ARM64 the NOGC helpers will preserve all registers,
- // except for those listed in the RBM_CALLEE_TRASH_NOGC mask
-
- savedSet = RBM_ALLINT & ~RBM_CALLEE_TRASH_NOGC;
+ // Get the set of registers that this call kills and remove it from the saved set.
+ savedSet = RBM_ALLINT & ~emitComp->compNoGCHelperCallKillSet(Compiler::eeGetHelperNum(methHnd));
// In case of Leave profiler callback, we need to preserve liveness of REG_PROFILER_RET_SCRATCH
if (isProfLeaveCB)