Notify dac when prejitted code is going to be used for a method (dotnet/coreclr#22296)
authorAndy Ayers <andya@microsoft.com>
Tue, 5 Feb 2019 08:43:23 +0000 (00:43 -0800)
committerMike McLaughlin <mikem@microsoft.com>
Tue, 5 Feb 2019 08:43:23 +0000 (00:43 -0800)
This allows sos bpmd breakpoints to work on prejitted methods.

Closes dotnet/coreclr#22265.

Commit migrated from https://github.com/dotnet/coreclr/commit/98b0e9a2b67c668fc9c29f3c12ecb02a1a535154

src/coreclr/src/vm/prestub.cpp

index f1d4851..ba84927 100644 (file)
@@ -369,12 +369,17 @@ PCODE MethodDesc::PrepareILBasedCode(PrepareCodeConfig* pConfig)
     {
         pCode = GetPrecompiledCode(pConfig);
     }
+
     if (pCode == NULL)
     {
         LOG((LF_CLASSLOADER, LL_INFO1000000,
             "    In PrepareILBasedCode, calling JitCompileCode\n"));
         pCode = JitCompileCode(pConfig);
     }
+    else
+    {
+        DACNotifyCompilationFinished(this, pCode);
+    }
 
     // Mark the code as hot in case the method ends up in the native image
     g_IBCLogger.LogMethodCodeAccess(this);
@@ -397,6 +402,14 @@ PCODE MethodDesc::GetPrecompiledCode(PrepareCodeConfig* pConfig)
         pCode = GetPrecompiledR2RCode(pConfig);
         if (pCode != NULL)
         {
+            LOG((LF_ZAP, LL_INFO10000,
+                    "ZAP: Using R2R precompiled code" FMT_ADDR "for %s.%s sig=\"%s\" (token %x).\n",
+                    DBG_ADDR(pCode),
+                    m_pszDebugClassName,
+                    m_pszDebugMethodName,
+                    m_pszDebugMethodSignature,
+                    GetMemberDef()));
+
             pConfig->SetNativeCode(pCode, &pCode);
         }
     }
@@ -449,7 +462,7 @@ PCODE MethodDesc::GetPrecompiledNgenCode(PrepareCodeConfig* pConfig)
     if (pCode != NULL)
     {
         LOG((LF_ZAP, LL_INFO10000,
-            "ZAP: Using code" FMT_ADDR "for %s.%s sig=\"%s\" (token %x).\n",
+            "ZAP: Using NGEN precompiled code" FMT_ADDR "for %s.%s sig=\"%s\" (token %x).\n",
             DBG_ADDR(pCode),
             m_pszDebugClassName,
             m_pszDebugMethodName,