Skip to content

Commit 2f6110e

Browse files
authored
Merge pull request eclipse-openj9#20511 from mpirvu/compileend
Prevent repeated comp requests when code caches are full
2 parents e7ac90c + b79c394 commit 2f6110e

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

runtime/compiler/control/CompilationRuntime.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,8 @@ class CompilationInfo
457457
static bool canRelocateMethod(TR::Compilation * comp);
458458
static int computeCompilationThreadPriority(J9JavaVM *vm);
459459
static void *compilationEnd(J9VMThread *context, TR::IlGeneratorMethodDetails & details, J9JITConfig *jitConfig, void * startPC,
460-
void *oldStartPC, TR_FrontEnd *vm=0, TR_MethodToBeCompiled *entry=NULL, TR::Compilation *comp=NULL);
460+
void *oldStartPC, bool preventFutureMethodCountingOnFailure = true, TR_FrontEnd *vm=0,
461+
TR_MethodToBeCompiled *entry=NULL, TR::Compilation *comp=NULL);
461462
#if defined(J9VM_OPT_JITSERVER)
462463
static JITServer::ServerStream *getStream();
463464
#endif /* defined(J9VM_OPT_JITSERVER) */

runtime/compiler/control/CompilationThread.cpp

+24-4
Original file line numberDiff line numberDiff line change
@@ -2536,7 +2536,7 @@ void TR::CompilationInfo::purgeMethodQueue(TR_CompilationErrorCode errorCode)
25362536
// fail the compilation
25372537
void *startPC = 0;
25382538

2539-
startPC = compilationEnd(vmThread, cur->getMethodDetails(), _jitConfig, NULL, cur->_oldStartPC);
2539+
startPC = compilationEnd(vmThread, cur->getMethodDetails(), _jitConfig, NULL, cur->_oldStartPC, false/*preventFutureMethodCountingOnFailure*/);
25402540
cur->_newStartPC = startPC;
25412541
cur->_compErrCode = errorCode;
25422542

@@ -8023,6 +8023,7 @@ TR::CompilationInfoPerThreadBase::postCompilationTasks(J9VMThread * vmThread,
80238023
jitConfig,
80248024
metaData ? reinterpret_cast<void *>(metaData->startPC) : 0,
80258025
entry->_oldStartPC,
8026+
true, /*preventFutureMethodCountingOnFailure */
80268027
_vm,
80278028
entry,
80288029
_compiler);
@@ -10135,10 +10136,29 @@ extern J9_CFUNC void jitMethodHandleTranslated (J9VMThread *currentThread, j9ob
1013510136
#endif
1013610137

1013710138

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+
*/
1013910158
void *
1014010159
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)
1014210162
{
1014310163
// This method is only called with both VMAccess and CompilationMutex in hand.
1014410164
// Performs some necessary updates once a compilation has been attempted
@@ -10639,7 +10659,7 @@ TR::CompilationInfo::compilationEnd(J9VMThread * vmThread, TR::IlGeneratorMethod
1063910659
{
1064010660
// Tell the VM that a non-compiled method failed translation
1064110661
//
10642-
if (vmThread && entry && !entry->isOutOfProcessCompReq())
10662+
if (vmThread && !isJITServerMode && preventFutureMethodCountingOnFailure)
1064310663
jitMethodFailedTranslation(vmThread, method);
1064410664
#if defined(J9VM_OPT_JITSERVER)
1064510665
if (entry && isJITServerMode) // failure at the JITServer

0 commit comments

Comments
 (0)