diff options
author | Sergey Andreenko <seandree@microsoft.com> | 2018-03-05 13:38:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 13:38:31 -0800 |
commit | 5763bb4fa31a856a6fc510f46dc059907d6f03af (patch) | |
tree | 00657373a89cbee4026f086a23331e3a167411a7 /src | |
parent | 1affbe5800ab35836e14e3d7fbe133f8762c1779 (diff) | |
download | coreclr-5763bb4fa31a856a6fc510f46dc059907d6f03af.tar.gz coreclr-5763bb4fa31a856a6fc510f46dc059907d6f03af.tar.bz2 coreclr-5763bb4fa31a856a6fc510f46dc059907d6f03af.zip |
[ARM32] RyuJIT support for profiler ELT callbacks (#16728)
* add assert that argReg was PreSpilled
* genProfilingEnterCallback for RyuJit arm
* fix genProfilingLeaveCallback for RyuJit arm
* call genProfilingLeaveCallback for arm from genJmpMethod
Diffstat (limited to 'src')
-rw-r--r-- | src/jit/codegenarmarch.cpp | 3 | ||||
-rw-r--r-- | src/jit/codegencommon.cpp | 34 |
2 files changed, 23 insertions, 14 deletions
diff --git a/src/jit/codegenarmarch.cpp b/src/jit/codegenarmarch.cpp index 22eb70e40a..d4f6343515 100644 --- a/src/jit/codegenarmarch.cpp +++ b/src/jit/codegenarmarch.cpp @@ -73,7 +73,6 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) getEmitter()->emitDisableGC(); break; -#ifdef _TARGET_ARM64_ case GT_PROF_HOOK: // We should be seeing this only if profiler hook is needed noway_assert(compiler->compIsProfilerHookNeeded()); @@ -87,8 +86,6 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) #endif // PROFILING_SUPPORTED break; -#endif // _TARGET_ARM64_ - case GT_LCLHEAP: genLclHeap(treeNode); break; diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp index 6ff6f1196b..f57abb06d6 100644 --- a/src/jit/codegencommon.cpp +++ b/src/jit/codegencommon.cpp @@ -7891,7 +7891,7 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed) #endif // !defined(UNIX_AMD64_ABI) -#elif defined(_TARGET_X86_) || (defined(_TARGET_ARM_) && defined(LEGACY_BACKEND)) +#elif defined(_TARGET_X86_) || defined(_TARGET_ARM_) unsigned saveStackLvl2 = genStackLevel; @@ -7909,12 +7909,19 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed) inst_IV(INS_push, (size_t)compiler->compProfilerMethHnd); } #elif defined(_TARGET_ARM_) - // On Arm arguments are prespilled on stack, which frees r0-r3. - // For generating Enter callout we would need two registers and one of them has to be r0 to pass profiler handle. - // The call target register could be any free register. +// On Arm arguments are prespilled on stack, which frees r0-r3. +// For generating Enter callout we would need two registers and one of them has to be r0 to pass profiler handle. +// The call target register could be any free register. +#ifdef LEGACY_BACKEND regNumber argReg = regSet.rsGrabReg(RBM_PROFILER_ENTER_ARG); noway_assert(argReg == REG_PROFILER_ENTER_ARG); regSet.rsLockReg(RBM_PROFILER_ENTER_ARG); +#else // !LEGACY_BACKEND + regNumber argReg = REG_PROFILER_ENTER_ARG; +#endif // !LEGACY_BACKEND + + regMaskTP argRegMask = genRegMask(argReg); + assert((regSet.rsMaskPreSpillRegArg & argRegMask) != 0); if (compiler->compProfilerMethHndIndirected) { @@ -7951,8 +7958,10 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed) compiler->fgPtrArgCntMax = 1; } #elif defined(_TARGET_ARM_) +#ifdef LEGACY_BACKEND // Unlock registers regSet.rsUnlockReg(RBM_PROFILER_ENTER_ARG); +#endif // LEGACY_BACKEND if (initReg == argReg) { @@ -8154,17 +8163,18 @@ void CodeGen::genProfilingLeaveCallback(unsigned helper /*= CORINFO_HELP_PROF_FC compiler->fgPtrArgCntMax = 1; } -#elif defined(LEGACY_BACKEND) && defined(_TARGET_ARM_) - - // - // Push the profilerHandle - // +#elif defined(_TARGET_ARM_) +// +// Push the profilerHandle +// - // We could optimize register usage based on return value is int/long/void. But to keep it simple we will lock - // RBM_PROFILER_RET_USED always. +// We could optimize register usage based on return value is int/long/void. But to keep it simple we will lock +// RBM_PROFILER_RET_USED always. +#ifdef LEGACY_BACKEND regNumber scratchReg = regSet.rsGrabReg(RBM_PROFILER_RET_SCRATCH); noway_assert(scratchReg == REG_PROFILER_RET_SCRATCH); regSet.rsLockReg(RBM_PROFILER_RET_USED); +#endif // LEGACY_BACKEND // Contract between JIT and Profiler Leave callout on arm: // Return size <= 4 bytes: REG_PROFILER_RET_SCRATCH will contain return value @@ -8230,7 +8240,9 @@ void CodeGen::genProfilingLeaveCallback(unsigned helper /*= CORINFO_HELP_PROF_FC gcInfo.gcMarkRegSetNpt(RBM_PROFILER_RET_SCRATCH); } +#ifdef LEGACY_BACKEND regSet.rsUnlockReg(RBM_PROFILER_RET_USED); +#endif // LEGACY_BACKEND #else // target NYI("Emit Profiler Leave callback"); |