diff options
author | Noah Falk <noahfalk@users.noreply.github.com> | 2017-10-11 14:06:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-11 14:06:31 -0700 |
commit | f4d374833a7892abfc9a720f36507f4e70282962 (patch) | |
tree | 2c48f41107ca5f57f7e682519318c51ccf91fd4b /src/debug | |
parent | 27a25bd37fa1fe6201c27709b1884e1b328f8beb (diff) | |
parent | 079f9b7aca410aae735fd68a94a92818c6afb17a (diff) | |
download | coreclr-f4d374833a7892abfc9a720f36507f4e70282962.tar.gz coreclr-f4d374833a7892abfc9a720f36507f4e70282962.tar.bz2 coreclr-f4d374833a7892abfc9a720f36507f4e70282962.zip |
Merge pull request #14424 from noahfalk/fix_14423
Fix #14423
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/ee/debugger.cpp | 23 | ||||
-rw-r--r-- | src/debug/ee/debugger.h | 2 | ||||
-rw-r--r-- | src/debug/ee/functioninfo.cpp | 10 |
3 files changed, 31 insertions, 4 deletions
diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index 9954839701..772862d839 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -2670,6 +2670,10 @@ void Debugger::JITComplete(MethodDesc* fd, TADDR newAddress) } CONTRACTL_END; + LOG((LF_CORDB, LL_INFO100000, "D::JITComplete: md:0x%x (%s::%s), address:0x%x.\n", + fd, fd->m_pszDebugClassName, fd->m_pszDebugMethodName, + newAddress)); + #ifdef _TARGET_ARM_ newAddress = newAddress|THUMB_CODE; #endif @@ -2690,7 +2694,24 @@ void Debugger::JITComplete(MethodDesc* fd, TADDR newAddress) { goto Exit; } - DebuggerJitInfo * ji = dmi->CreateInitAndAddJitInfo(fd, newAddress); + BOOL jiWasCreated = FALSE; + DebuggerJitInfo * ji = dmi->CreateInitAndAddJitInfo(fd, newAddress, &jiWasCreated); + if (!jiWasCreated) + { + // we've already been notified about this code, no work remains. + // The JIT is occasionally asked to generate code for the same + // method on two threads. When this occurs both threads will + // return the same code pointer and this callback is invoked + // multiple times. + LOG((LF_CORDB, LL_INFO1000000, "D::JITComplete: md:0x%x (%s::%s), address:0x%x. Already created\n", + fd, fd->m_pszDebugClassName, fd->m_pszDebugMethodName, + newAddress)); + goto Exit; + } + + LOG((LF_CORDB, LL_INFO1000000, "D::JITComplete: md:0x%x (%s::%s), address:0x%x. Created ji:0x%x\n", + fd, fd->m_pszDebugClassName, fd->m_pszDebugMethodName, + newAddress, ji)); // Bind any IL patches to the newly jitted native code. HRESULT hr; diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h index f99931e9dd..812bde5513 100644 --- a/src/debug/ee/debugger.h +++ b/src/debug/ee/debugger.h @@ -1003,7 +1003,7 @@ public: // Creating the Jit-infos. DebuggerJitInfo *FindOrCreateInitAndAddJitInfo(MethodDesc* fd); - DebuggerJitInfo *CreateInitAndAddJitInfo(MethodDesc* fd, TADDR startAddr); + DebuggerJitInfo *CreateInitAndAddJitInfo(MethodDesc* fd, TADDR startAddr, BOOL* jitInfoWasCreated); void DeleteJitInfo(DebuggerJitInfo *dji); diff --git a/src/debug/ee/functioninfo.cpp b/src/debug/ee/functioninfo.cpp index aa75b30407..78bba432e5 100644 --- a/src/debug/ee/functioninfo.cpp +++ b/src/debug/ee/functioninfo.cpp @@ -1580,14 +1580,15 @@ DebuggerJitInfo *DebuggerMethodInfo::FindOrCreateInitAndAddJitInfo(MethodDesc* f // CreateInitAndAddJitInfo takes a lock and checks the list again, which // makes this thread-safe. - return CreateInitAndAddJitInfo(fd, addr); + BOOL unused; + return CreateInitAndAddJitInfo(fd, addr, &unused); } // Create a DJI around a method-desc. The EE already has all the information we need for a DJI, // the DJI just serves as a cache of the information for the debugger. // Caller makes no guarantees about whether the DJI is already in the table. (Caller should avoid this if // it knows it's in the table, but b/c we can't expect caller to synchronize w/ the other threads). -DebuggerJitInfo *DebuggerMethodInfo::CreateInitAndAddJitInfo(MethodDesc* fd, TADDR startAddr) +DebuggerJitInfo *DebuggerMethodInfo::CreateInitAndAddJitInfo(MethodDesc* fd, TADDR startAddr, BOOL* jitInfoWasCreated) { CONTRACTL { @@ -1603,6 +1604,7 @@ DebuggerJitInfo *DebuggerMethodInfo::CreateInitAndAddJitInfo(MethodDesc* fd, TAD // May or may-not be jitted, that's why we passed in the start addr & size explicitly. _ASSERTE(startAddr != NULL); + *jitInfoWasCreated = FALSE; // No support for light-weight codegen methods. if (fd->IsDynamicMethod()) @@ -1642,6 +1644,10 @@ DebuggerJitInfo *DebuggerMethodInfo::CreateInitAndAddJitInfo(MethodDesc* fd, TAD DeleteInteropSafe(dji); return pResult; } + else + { + *jitInfoWasCreated = TRUE; + } } // We know it's not in the table. Go add it! |