summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2019-05-30 17:37:23 +0200
committerGitHub <noreply@github.com>2019-05-30 17:37:23 +0200
commit7143390a5834d22213ffbbc04f8817b1c401fb83 (patch)
tree1630ad4da5594a70b90e71df5cfdaa19a720b9e4 /src
parentecc0b6f732a6b1a626d30e2c02d0bcaa7bc69668 (diff)
downloadcoreclr-7143390a5834d22213ffbbc04f8817b1c401fb83.tar.gz
coreclr-7143390a5834d22213ffbbc04f8817b1c401fb83.tar.bz2
coreclr-7143390a5834d22213ffbbc04f8817b1c401fb83.zip
Implement R2R helpers for synchronized methods (#24646)
Synchronized methods show up when `Console` is used and the missing helper mapping would cause us not to AOT compile them.
Diffstat (limited to 'src')
-rw-r--r--src/inc/readytorun.h4
-rw-r--r--src/inc/readytorunhelpers.h2
-rw-r--r--src/jit/codegenxarch.cpp13
-rw-r--r--src/tools/r2rdump/R2RConstants.cs4
4 files changed, 17 insertions, 6 deletions
diff --git a/src/inc/readytorun.h b/src/inc/readytorun.h
index d28d78c67d..7745ad6e2f 100644
--- a/src/inc/readytorun.h
+++ b/src/inc/readytorun.h
@@ -311,6 +311,10 @@ enum ReadyToRunHelper
READYTORUN_HELPER_PersonalityRoutineFilterFunclet = 0xF1,
#endif
+ // Synchronized methods
+ READYTORUN_HELPER_MonitorEnter = 0xF8,
+ READYTORUN_HELPER_MonitorExit = 0xF9,
+
//
// Deprecated/legacy
//
diff --git a/src/inc/readytorunhelpers.h b/src/inc/readytorunhelpers.h
index a8c2327f51..c677f3787a 100644
--- a/src/inc/readytorunhelpers.h
+++ b/src/inc/readytorunhelpers.h
@@ -114,6 +114,8 @@ HELPER(READYTORUN_HELPER_EndCatch, CORINFO_HELP_ENDCATCH,
HELPER(READYTORUN_HELPER_PInvokeBegin, CORINFO_HELP_JIT_PINVOKE_BEGIN, )
HELPER(READYTORUN_HELPER_PInvokeEnd, CORINFO_HELP_JIT_PINVOKE_END, )
+HELPER(READYTORUN_HELPER_MonitorEnter, CORINFO_HELP_MON_ENTER, )
+HELPER(READYTORUN_HELPER_MonitorExit, CORINFO_HELP_MON_EXIT, )
#undef HELPER
#undef OPTIMIZEFORSPEED
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index 0297979266..482607f5d1 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -5613,6 +5613,13 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
instGen(INS_vzeroupper);
}
+ if (callType == CT_HELPER && compiler->info.compFlags & CORINFO_FLG_SYNCH)
+ {
+ fPossibleSyncHelperCall = true;
+ helperNum = compiler->eeGetHelperNum(methHnd);
+ noway_assert(helperNum != CORINFO_HELP_UNDEF);
+ }
+
if (target != nullptr)
{
#ifdef _TARGET_X86_
@@ -5738,12 +5745,6 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
void* pAddr = nullptr;
addr = compiler->compGetHelperFtn(helperNum, (void**)&pAddr);
assert(pAddr == nullptr);
-
- // tracking of region protected by the monitor in synchronized methods
- if (compiler->info.compFlags & CORINFO_FLG_SYNCH)
- {
- fPossibleSyncHelperCall = true;
- }
}
else
{
diff --git a/src/tools/r2rdump/R2RConstants.cs b/src/tools/r2rdump/R2RConstants.cs
index 7f2b2e3035..b3233748b9 100644
--- a/src/tools/r2rdump/R2RConstants.cs
+++ b/src/tools/r2rdump/R2RConstants.cs
@@ -246,6 +246,10 @@ namespace R2RDump
READYTORUN_HELPER_PersonalityRoutine = 0xF0,
READYTORUN_HELPER_PersonalityRoutineFilterFunclet = 0xF1,
+ // Synchronized methods
+ READYTORUN_HELPER_MonitorEnter = 0xF8,
+ READYTORUN_HELPER_MonitorExit = 0xF9,
+
//
// Deprecated/legacy
//