@@ -2536,7 +2536,7 @@ void TR::CompilationInfo::purgeMethodQueue(TR_CompilationErrorCode errorCode)
2536
2536
// fail the compilation
2537
2537
void *startPC = 0;
2538
2538
2539
- startPC = compilationEnd(vmThread, cur->getMethodDetails(), _jitConfig, NULL, cur->_oldStartPC);
2539
+ startPC = compilationEnd(vmThread, cur->getMethodDetails(), _jitConfig, NULL, cur->_oldStartPC, false/*preventFutureMethodCountingOnFailure*/ );
2540
2540
cur->_newStartPC = startPC;
2541
2541
cur->_compErrCode = errorCode;
2542
2542
@@ -8023,6 +8023,7 @@ TR::CompilationInfoPerThreadBase::postCompilationTasks(J9VMThread * vmThread,
8023
8023
jitConfig,
8024
8024
metaData ? reinterpret_cast<void *>(metaData->startPC) : 0,
8025
8025
entry->_oldStartPC,
8026
+ true, /*preventFutureMethodCountingOnFailure */
8026
8027
_vm,
8027
8028
entry,
8028
8029
_compiler);
@@ -10135,10 +10136,29 @@ extern J9_CFUNC void jitMethodHandleTranslated (J9VMThread *currentThread, j9ob
10135
10136
#endif
10136
10137
10137
10138
10138
- // static method
10139
+ /**
10140
+ @brief Method called at the end of a successful or unsucessful compilation attempt
10141
+
10142
+ This is a static method that has many side-effects.
10143
+ Its main purpose if to overwrite the j9method->extra with the startPC of the
10144
+ native compiled body (if compilation is successful) or with special code for
10145
+ unsuccessful compilations. It also releases any reserved data caches.
10146
+
10147
+ @param vmThread The VM thread that is currently running the compilatuionEnd() method
10148
+ @param details The IlGeneratorMethodDetails of the method subject to compilation
10149
+ @param jitConfig Pointer to J9JITConfig
10150
+ @param startPC The start of the code for the newly compiled body (if compilation is successful)
10151
+ @param oldStartPC The current entry point for the method being compiled (0 for interpreted methods)
10152
+ @param preventFutureMethodCountingOnFailure Boolean indicating whether a VM helper should be called on
10153
+ compilation failure to prevent future invocation counting of the method (default is true)
10154
+ @param fe The frontend used to compile the method (default NULL)
10155
+ @param entry The compilation request entry for the method being compiled (default NULL)
10156
+ @param comp The compilation object that was created for the method being compiled (default NULL)
10157
+ */
10139
10158
void *
10140
10159
TR::CompilationInfo::compilationEnd(J9VMThread * vmThread, TR::IlGeneratorMethodDetails & details, J9JITConfig *jitConfig, void *startPC,
10141
- void *oldStartPC, TR_FrontEnd *fe, TR_MethodToBeCompiled *entry, TR::Compilation *comp)
10160
+ void *oldStartPC, bool preventFutureMethodCountingOnFailure,TR_FrontEnd *fe,
10161
+ TR_MethodToBeCompiled *entry, TR::Compilation *comp)
10142
10162
{
10143
10163
// This method is only called with both VMAccess and CompilationMutex in hand.
10144
10164
// Performs some necessary updates once a compilation has been attempted
@@ -10639,7 +10659,7 @@ TR::CompilationInfo::compilationEnd(J9VMThread * vmThread, TR::IlGeneratorMethod
10639
10659
{
10640
10660
// Tell the VM that a non-compiled method failed translation
10641
10661
//
10642
- if (vmThread && entry && !entry->isOutOfProcessCompReq() )
10662
+ if (vmThread && !isJITServerMode && preventFutureMethodCountingOnFailure )
10643
10663
jitMethodFailedTranslation(vmThread, method);
10644
10664
#if defined(J9VM_OPT_JITSERVER)
10645
10665
if (entry && isJITServerMode) // failure at the JITServer
0 commit comments