From c67474bd34847bf5ceff3d49f29eb4b778848748 Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Tue, 7 Mar 2017 18:58:11 -0800 Subject: Work for IBC profiling with ReadyToRun images Incremented ReadyToRun version to 2.2 Implemented caching for IsInstrumented using IS_INSTRUMENTED_UNSET Added method Module::InitializeForProfiling() Added full support for method profile counts in ReadyToRun image --- src/vm/assembly.cpp | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'src/vm/assembly.cpp') diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp index 5f0e75dd4d..d95eec0720 100644 --- a/src/vm/assembly.cpp +++ b/src/vm/assembly.cpp @@ -141,6 +141,9 @@ Assembly::Assembly(BaseDomain *pDomain, PEAssembly* pFile, DebuggerAssemblyContr #ifdef FEATURE_COMINTEROP , m_InteropAttributeStatus(INTEROP_ATTRIBUTE_UNSET) #endif +#ifdef FEATURE_PREJIT + , m_isInstrumentedStatus(IS_INSTRUMENTED_UNSET) +#endif { STANDARD_VM_CONTRACT; } @@ -2329,21 +2332,37 @@ BOOL Assembly::IsInstrumented() STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_FAULT; - BOOL isInstrumented = false; - - EX_TRY + // This will set the value of m_isInstrumentedStatus by calling IsInstrumentedHelper() + // that method performs string pattern matching using the Config value of ZapBBInstr + // We cache the value returned from that method in m_isInstrumentedStatus + // + if (m_isInstrumentedStatus == IS_INSTRUMENTED_UNSET) { - FAULT_NOT_FATAL(); + EX_TRY + { + FAULT_NOT_FATAL(); - isInstrumented = IsInstrumentedHelper(); - } - EX_CATCH - { - isInstrumented = false; + if (IsInstrumentedHelper()) + { + m_isInstrumentedStatus = IS_INSTRUMENTED_TRUE; + } + else + { + m_isInstrumentedStatus = IS_INSTRUMENTED_FALSE; + } + } + + EX_CATCH + { + m_isInstrumentedStatus = IS_INSTRUMENTED_FALSE; + } + EX_END_CATCH(RethrowTerminalExceptions); } - EX_END_CATCH(RethrowTerminalExceptions); - return isInstrumented; + // At this point m_isInstrumentedStatus can't have the value of IS_INSTRUMENTED_UNSET + _ASSERTE(m_isInstrumentedStatus != IS_INSTRUMENTED_UNSET); + + return (m_isInstrumentedStatus == IS_INSTRUMENTED_TRUE); } BOOL Assembly::IsInstrumentedHelper() @@ -2357,7 +2376,7 @@ BOOL Assembly::IsInstrumentedHelper() return false; // We must have a native image in order to perform IBC instrumentation - if (!GetManifestFile()->HasNativeImage()) + if (!GetManifestFile()->HasNativeOrReadyToRunImage()) return false; // @Consider using the full name instead of the short form -- cgit v1.2.3