Skip to content

Commit 0dcff38

Browse files
authored
Merge pull request #22101 from dsouzai/deseriaizedFlag
Refactor wasDeserialized flag
2 parents f91146b + fdbd2a5 commit 0dcff38

File tree

7 files changed

+98
-60
lines changed

7 files changed

+98
-60
lines changed

runtime/compiler/control/CompilationThread.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,6 @@ TR::CompilationInfoPerThread::CompilationInfoPerThread(TR::CompilationInfo &comp
11691169
{
11701170
_classesThatShouldNotBeNewlyExtended = NULL;
11711171
}
1172-
_deserializerWasReset = false;
11731172
#endif /* defined(J9VM_OPT_JITSERVER) */
11741173
}
11751174

@@ -13374,7 +13373,10 @@ TR::CompilationInfo::notifyCompilationThreadsOfDeserializerReset()
1337413373
{
1337513374
TR::CompilationInfoPerThread *curCompThreadInfoPT = _arrayOfCompilationInfoPerThread[i];
1337613375
TR_ASSERT(curCompThreadInfoPT, "a thread's compinfo is missing\n");
13377-
curCompThreadInfoPT->setDeserializerWasReset();
13376+
13377+
// The curCompThreadInfoPT->_vm may not be set yet
13378+
auto vm = TR_J9VMBase::get(_jitConfig, curCompThreadInfoPT->getCompilationThread());
13379+
vm->setDeserializerWasReset();
1337813380
}
1337913381
}
1338013382
#endif /* defined(J9VM_OPT_JITSERVER) */

runtime/compiler/control/CompilationThread.hpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ class CompilationInfoPerThreadBase
145145
public:
146146
CompilationInfoPerThreadBase(TR::CompilationInfo &compInfo, J9JITConfig *jitConfig, int32_t id, bool onSeparateThread);
147147

148-
TR::CompilationInfo *getCompilationInfo() { return &_compInfo; }
148+
TR::CompilationInfo *getCompilationInfo() { return &_compInfo; }
149149
J9JITConfig *getJitConfig() { return _jitConfig; }
150+
TR_J9VMBase *getJ9VM() { return _vm; }
151+
150152
TR_MethodToBeCompiled *getMethodBeingCompiled() { return _methodBeingCompiled; }
151153
void setMethodBeingCompiled(TR_MethodToBeCompiled *m) { _methodBeingCompiled = m; }
152154

@@ -516,11 +518,6 @@ class CompilationInfoPerThread : public TR::CompilationInfoPerThreadBase
516518
J9ROMClass *getAndCacheRemoteROMClass(J9Class *clazz);
517519
J9ROMClass *getRemoteROMClassIfCached(J9Class *clazz);
518520
PersistentUnorderedSet<TR_OpaqueClassBlock*> *getClassesThatShouldNotBeNewlyExtended() const { return _classesThatShouldNotBeNewlyExtended; }
519-
bool getDeserializerWasReset() const { return _deserializerWasReset; }
520-
// Called externally by a compilation thread that is resetting the JITServer AOT deserializer
521-
void setDeserializerWasReset() { _deserializerWasReset = true; }
522-
// Called by the current compilation thread at the beginning of a remote compilation to clear the _deserializerWasReset flag
523-
void clearDeserializerWasReset() { _deserializerWasReset = false; }
524521
#endif /* defined(J9VM_OPT_JITSERVER) */
525522

526523
protected:
@@ -545,8 +542,6 @@ class CompilationInfoPerThread : public TR::CompilationInfoPerThreadBase
545542
// The following hastable caches <classLoader,classname> --> <J9Class> mappings
546543
// The cache only lives during a compilation due to class unloading concerns
547544
PersistentUnorderedSet<TR_OpaqueClassBlock*> *_classesThatShouldNotBeNewlyExtended;
548-
// A flag notifying this thread that the JITServer AOT deserializer was reset.
549-
bool _deserializerWasReset;
550545
#endif /* defined(J9VM_OPT_JITSERVER) */
551546

552547
}; // CompilationInfoPerThread

runtime/compiler/control/JITClientCompilationThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3445,7 +3445,7 @@ remoteCompile(J9VMThread *vmThread, TR::Compilation *compiler, TR_ResolvedMethod
34453445
// 1. Requests an AOT cache store or load from the server, or
34463446
// 2. Accesses the JITServer AOT deserializer in any way.
34473447
// That moment is currently right here, when we get the new known IDs that are cached in the deserializer.
3448-
((TR::CompilationInfoPerThread *)compInfoPT)->clearDeserializerWasReset();
3448+
compInfoPT->getJ9VM()->clearDeserializerWasReset();
34493449
std::vector<uintptr_t> newKnownIds = deserializer ? deserializer->getNewKnownIds(compiler) : std::vector<uintptr_t>();
34503450

34513451
// TODO: make this a synchronized region to avoid bad_alloc exceptions

runtime/compiler/env/VMJ9.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ TR_J9VMBase::TR_J9VMBase(
798798
_shouldSleep(false)
799799
#if defined(J9VM_OPT_JITSERVER)
800800
,_deserializerSharedCache(NULL)
801+
,_deserializerWasReset(false)
801802
#endif /* defined(J9VM_OPT_JITSERVER) */
802803
{
803804
for (int32_t i = 0; i < UT_MODULE_INFO.count; ++i)

runtime/compiler/env/VMJ9.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,12 @@ class TR_J9VMBase : public TR_FrontEnd
14531453

14541454
#if defined(J9VM_OPT_JITSERVER)
14551455
TR_J9DeserializerSharedCache *deserializerSharedCache() const { return _deserializerSharedCache; }
1456+
1457+
bool getDeserializerWasReset() const { return _deserializerWasReset; }
1458+
// Called externally by a compilation thread that is resetting the JITServer AOT deserializer
1459+
void setDeserializerWasReset() { _deserializerWasReset = true; }
1460+
// Called by the current compilation thread at the beginning of a remote compilation to clear the _deserializerWasReset flag
1461+
void clearDeserializerWasReset() { _deserializerWasReset = false; }
14561462
#endif /* defined(J9VM_OPT_JITSERVER) */
14571463

14581464
const char *getByteCodeName(uint8_t opcode);
@@ -1556,6 +1562,10 @@ class TR_J9VMBase : public TR_FrontEnd
15561562

15571563
flags32_t _flags;
15581564

1565+
#if defined(J9VM_OPT_JITSERVER)
1566+
// A flag notifying this thread that the JITServer AOT deserializer was reset.
1567+
bool _deserializerWasReset;
1568+
#endif // defined(J9VM_OPT_JITSERVER)
15591569
};
15601570

15611571
class TR_J9VM : public TR_J9VMBase

0 commit comments

Comments
 (0)