diff --git a/runtime/compiler/control/CompilationThread.cpp b/runtime/compiler/control/CompilationThread.cpp index 725fd80f045..a815b1aaa5b 100644 --- a/runtime/compiler/control/CompilationThread.cpp +++ b/runtime/compiler/control/CompilationThread.cpp @@ -11955,7 +11955,11 @@ TR::CompilationInfo::replenishInvocationCount(J9Method *method, TR::Compilation } else { - TR_ASSERT(false, "Unexpected value for method->extra = %p (method=%p)\n", TR::CompilationInfo::getJ9MethodExtra(method), method); + if (!comp->getOptimizationPlan()->getIsCompileMethodAPI()) + { + TR_ASSERT(false, "Unexpected value for method->extra = %p (method=%p)\n", + TR::CompilationInfo::getJ9MethodExtra(method), method); + } } } diff --git a/runtime/compiler/control/J9CompilationStrategy.cpp b/runtime/compiler/control/J9CompilationStrategy.cpp index f972a3aed89..4affb3157c8 100644 --- a/runtime/compiler/control/J9CompilationStrategy.cpp +++ b/runtime/compiler/control/J9CompilationStrategy.cpp @@ -97,6 +97,7 @@ TR_OptimizationPlan *J9::CompilationStrategy::processEvent(TR_MethodEvent *event plan = self()->processInterpreterSample(event); *newPlanCreated = true; break; + case TR_MethodEvent::CompileMethodAPI: case TR_MethodEvent::InterpreterCounterTripped: TR_ASSERT(event->_oldStartPC == 0, "oldStartPC should be 0 for an interpreted method"); compInfo->_stats._methodsCompiledOnCount++; @@ -115,6 +116,13 @@ TR_OptimizationPlan *J9::CompilationStrategy::processEvent(TR_MethodEvent *event plan = TR_OptimizationPlan::alloc(hotnessLevel, true, false); else plan = TR_OptimizationPlan::alloc(hotnessLevel); + + // set a flag to indicate the counter was not tripped + if (event->_eventType == TR_MethodEvent::CompileMethodAPI) + { + plan->setIsCompileMethodAPI(true); + } + *newPlanCreated = true; // the optimization plan needs to include opt level and if we do profiling // these may change diff --git a/runtime/compiler/control/J9CompilationStrategy.hpp b/runtime/compiler/control/J9CompilationStrategy.hpp index 444aaf08ec7..d2602b8aab8 100644 --- a/runtime/compiler/control/J9CompilationStrategy.hpp +++ b/runtime/compiler/control/J9CompilationStrategy.hpp @@ -48,6 +48,7 @@ class TR_MethodEvent { public: enum { InvalidEvent=0, + CompileMethodAPI, InterpreterCounterTripped, InterpretedMethodSample, JittedMethodSample, diff --git a/runtime/compiler/control/rossa.cpp b/runtime/compiler/control/rossa.cpp index 621a09ed720..424341a7267 100644 --- a/runtime/compiler/control/rossa.cpp +++ b/runtime/compiler/control/rossa.cpp @@ -879,7 +879,7 @@ internalCompileClass(J9VMThread * vmThread, J9Class * clazz) { bool queued = false; TR_MethodEvent event; - event._eventType = TR_MethodEvent::InterpreterCounterTripped; + event._eventType = TR_MethodEvent::CompileMethodAPI; event._j9method = method; event._oldStartPC = 0; event._vmThread = vmThread; diff --git a/runtime/compiler/env/ClassLoaderTable.cpp b/runtime/compiler/env/ClassLoaderTable.cpp index d6116c1296b..de4bed6c8d3 100644 --- a/runtime/compiler/env/ClassLoaderTable.cpp +++ b/runtime/compiler/env/ClassLoaderTable.cpp @@ -189,7 +189,7 @@ TR_PersistentClassLoaderTable::associateClassLoaderWithClass(J9VMThread *vmThrea { // Since current thread has shared VM access and holds the classTableMutex, // no other thread can be modifying the table at the same time. - TR_ASSERT(hasSharedVMAccess(vmThread), "Must have shared VM access"); + TR_ASSERT((vmThread->publicFlags & J9_PUBLIC_FLAGS_VM_ACCESS), "Must have shared VM access"); TR_ASSERT(TR::MonitorTable::get()->getClassTableMutex()->owned_by_self(), "Must hold classTableMutex"); bool useAOTCache = false;