Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d71ed81

Browse files
author
Sergey Andreenko
authored
Fix callKillSet for CORINFO_HELP_ASSIGN_BYREF on x64. (#19780)
* Fix callKillSet for CORINFO_HELP_ASSIGN_BYREF. on x64. * Fix typos.
1 parent e3c2f5b commit d71ed81

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

src/jit/codegencommon.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,19 @@ regMaskTP Compiler::compNoGCHelperCallKillSet(CorInfoHelpFunc helper)
639639

640640
switch (helper)
641641
{
642+
case CORINFO_HELP_ASSIGN_BYREF:
643+
#if defined(_TARGET_X86_)
644+
// This helper only trashes ECX.
645+
return RBM_ECX;
646+
#elif defined(_TARGET_AMD64_)
647+
// This uses and defs RDI and RSI.
648+
return RBM_CALLEE_TRASH_NOGC & ~(RBM_RDI | RBM_RSI);
649+
#elif defined(_TARGET_ARMARCH_)
650+
return RBM_CALLEE_GCTRASH_WRITEBARRIER_BYREF;
651+
#else
652+
assert(!"unknown arch");
653+
#endif
654+
642655
#if defined(_TARGET_XARCH_)
643656
case CORINFO_HELP_PROF_FCN_ENTER:
644657
return RBM_PROFILER_ENTER_TRASH;
@@ -650,16 +663,7 @@ regMaskTP Compiler::compNoGCHelperCallKillSet(CorInfoHelpFunc helper)
650663
return RBM_PROFILER_TAILCALL_TRASH;
651664
#endif // defined(_TARGET_XARCH_)
652665

653-
#if defined(_TARGET_X86_)
654-
case CORINFO_HELP_ASSIGN_BYREF:
655-
// This helper only trashes ECX.
656-
return RBM_ECX;
657-
#endif // defined(_TARGET_X86_)
658-
659666
#if defined(_TARGET_ARMARCH_)
660-
case CORINFO_HELP_ASSIGN_BYREF:
661-
return RBM_CALLEE_GCTRASH_WRITEBARRIER_BYREF;
662-
663667
case CORINFO_HELP_ASSIGN_REF:
664668
case CORINFO_HELP_CHECKED_ASSIGN_REF:
665669
return RBM_CALLEE_GCTRASH_WRITEBARRIER;

src/vm/amd64/jithelpers_fast.S

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,10 @@ LEAF_END JIT_PatchedCodeLast, _TEXT
228228
// RSI - address of the data (source)
229229
//
230230
// Note: RyuJIT assumes that all volatile registers can be trashed by
231-
// the CORINFO_HELP_ASSIGN_BYREF helper (i.e. JIT_ByRefWriteBarrier).
232-
// The precise set is defined by RBM_CALLEE_TRASH.
231+
// the CORINFO_HELP_ASSIGN_BYREF helper (i.e. JIT_ByRefWriteBarrier)
232+
// except RDI and RSI. This helper uses and defines RDI and RSI, so
233+
// they remain as live GC refs or byrefs, and are not killed.
234+
//
233235
//
234236
// RCX is trashed
235237
// RAX is trashed

0 commit comments

Comments
 (0)