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

Commit

Permalink
Fix callKillSet for CORINFO_HELP_ASSIGN_BYREF on x64. (#19780) (#19803)
Browse files Browse the repository at this point in the history
* Fix callKillSet for CORINFO_HELP_ASSIGN_BYREF.

on x64.
  • Loading branch information
Sergey Andreenko authored Sep 11, 2018
1 parent d05c93d commit cb730c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
22 changes: 13 additions & 9 deletions src/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,19 @@ regMaskTP Compiler::compNoGCHelperCallKillSet(CorInfoHelpFunc helper)

switch (helper)
{
case CORINFO_HELP_ASSIGN_BYREF:
#if defined(_TARGET_X86_)
// This helper only trashes ECX.
return RBM_ECX;
#elif defined(_TARGET_AMD64_)
// This uses and defs RDI and RSI.
return RBM_CALLEE_TRASH_NOGC & ~(RBM_RDI | RBM_RSI);
#elif defined(_TARGET_ARMARCH_)
return RBM_CALLEE_GCTRASH_WRITEBARRIER_BYREF;
#else
assert(!"unknown arch");
#endif

#if defined(_TARGET_XARCH_)
case CORINFO_HELP_PROF_FCN_ENTER:
return RBM_PROFILER_ENTER_TRASH;
Expand All @@ -748,16 +761,7 @@ regMaskTP Compiler::compNoGCHelperCallKillSet(CorInfoHelpFunc helper)
return RBM_PROFILER_TAILCALL_TRASH;
#endif // defined(_TARGET_XARCH_)

#if defined(_TARGET_X86_)
case CORINFO_HELP_ASSIGN_BYREF:
// This helper only trashes ECX.
return RBM_ECX;
#endif // defined(_TARGET_X86_)

#if defined(_TARGET_ARMARCH_)
case CORINFO_HELP_ASSIGN_BYREF:
return RBM_CALLEE_GCTRASH_WRITEBARRIER_BYREF;

case CORINFO_HELP_ASSIGN_REF:
case CORINFO_HELP_CHECKED_ASSIGN_REF:
return RBM_CALLEE_GCTRASH_WRITEBARRIER;
Expand Down
6 changes: 4 additions & 2 deletions src/vm/amd64/jithelpers_fast.S
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,10 @@ LEAF_END JIT_PatchedCodeLast, _TEXT
// RSI - address of the data (source)
//
// Note: RyuJIT assumes that all volatile registers can be trashed by
// the CORINFO_HELP_ASSIGN_BYREF helper (i.e. JIT_ByRefWriteBarrier).
// The precise set is defined by RBM_CALLEE_TRASH.
// the CORINFO_HELP_ASSIGN_BYREF helper (i.e. JIT_ByRefWriteBarrier)
// except RDI and RSI. This helper uses and defines RDI and RSI, so
// they remain as live GC refs or byrefs, and are not killed.
//
//
// RCX is trashed
// RAX is trashed
Expand Down

0 comments on commit cb730c5

Please sign in to comment.