Skip to content

Commit

Permalink
Merge pull request #11429 from mpirvu/JITServerSeqNoFix-0.24
Browse files Browse the repository at this point in the history
(0.24.0) Fix bug related to sequencing scheme in JITServer
  • Loading branch information
ymanton committed Dec 10, 2020
2 parents 50b72ee + 65001a7 commit 66016a2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion runtime/compiler/control/CompilationRuntime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ class CompilationInfo
TR::Monitor *getclassesCachedAtServerMonitor() const { return _classesCachedAtServerMonitor; }
TR::Monitor *getSequencingMonitor() const { return _sequencingMonitor; }
uint32_t getCompReqSeqNo() const { return _compReqSeqNo; }
uint32_t incCompReqSeqNo() { return _compReqSeqNo++; }
uint32_t incCompReqSeqNo() { return ++_compReqSeqNo; }
uint32_t getLastCriticalSeqNo() const { return _lastCriticalCompReqSeqNo; }
void setLastCriticalSeqNo(uint32_t seqNo) { _lastCriticalCompReqSeqNo = seqNo; }

Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/control/JITServerCompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ TR::CompilationInfoPerThreadRemote::processEntry(TR_MethodToBeCompiled &entry, J
// Obtain monitor RAII style because creating a new hastable entry may throw bad_alloc
OMR::CriticalSection compilationMonitorLock(compInfo->getCompilationMonitor());
compInfo->getClientSessionHT()->purgeOldDataIfNeeded(); // Try to purge old data
if (!(clientSession = compInfo->getClientSessionHT()->findOrCreateClientSession(clientId, seqNo, &sessionDataWasEmpty)))
if (!(clientSession = compInfo->getClientSessionHT()->findOrCreateClientSession(clientId, criticalSeqNo, &sessionDataWasEmpty)))
throw std::bad_alloc();

setClientData(clientSession); // Cache the session data into CompilationInfoPerThreadRemote object
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/runtime/JITClientSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


ClientSessionData::ClientSessionData(uint64_t clientUID, uint32_t seqNo) :
_clientUID(clientUID), _expectedSeqNo(seqNo), _maxReceivedSeqNo(seqNo), _lastProcessedCriticalSeqNo(seqNo),
_clientUID(clientUID), _maxReceivedSeqNo(seqNo), _lastProcessedCriticalSeqNo(seqNo),
_OOSequenceEntryList(NULL), _chTable(NULL),
_romClassMap(decltype(_romClassMap)::allocator_type(TR::Compiler->persistentAllocator())),
_J9MethodMap(decltype(_J9MethodMap)::allocator_type(TR::Compiler->persistentAllocator())),
Expand Down Expand Up @@ -749,7 +749,7 @@ ClientSessionHT::~ClientSessionHT()
// If the clientUID does not already exist in the HT, insert a new blank entry.
// Must have compilation monitor in hand when calling this function.
// Side effects: _inUse is incremented on the ClientSessionData
// _expectedSeqNo is populated if a new ClientSessionData is created
// _lastProcessedCriticalSeqNo is populated if a new ClientSessionData is created
// timeOflastAccess is updated with curent time.
ClientSessionData *
ClientSessionHT::findOrCreateClientSession(uint64_t clientUID, uint32_t seqNo, bool *newSessionWasCreated)
Expand Down
5 changes: 1 addition & 4 deletions runtime/compiler/runtime/JITClientSession.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,6 @@ class ClientSessionData
TR_MethodToBeCompiled *getOOSequenceEntryList() const { return _OOSequenceEntryList; }
void setOOSequenceEntryList(TR_MethodToBeCompiled *m) { _OOSequenceEntryList = m; }
TR_MethodToBeCompiled *notifyAndDetachFirstWaitingThread();
uint32_t getExpectedSeqNo() const { return _expectedSeqNo; }
void setExpectedSeqNo(uint32_t seqNo) { _expectedSeqNo = seqNo; }
uint32_t getLastProcessedCriticalSeqNo() const { return _lastProcessedCriticalSeqNo; }
void setLastProcessedCriticalSeqNo(uint32_t seqNo) { _lastProcessedCriticalSeqNo = seqNo; }
uint32_t getMaxReceivedSeqNo() const { return _maxReceivedSeqNo; }
Expand Down Expand Up @@ -474,14 +472,13 @@ class ClientSessionData
TR::Monitor *_romMapMonitor;
TR::Monitor *_classMapMonitor;
TR::Monitor *_classChainDataMapMonitor;
// The following monitor is used to protect access to _expectedSeqNo and
// The following monitor is used to protect access to _lastProcessedCriticalSeqNo and
// the list of out-of-sequence compilation requests (_OOSequenceEntryList)
TR::Monitor *_sequencingMonitor;
TR::Monitor *_constantPoolMapMonitor;
// Compilation requests that arrived out-of-sequence wait in
// _OOSequenceEntryList for their turn to be processed
TR_MethodToBeCompiled *_OOSequenceEntryList;
uint32_t _expectedSeqNo; // used for ordering compilation requests from the same client
uint32_t _maxReceivedSeqNo; // the largest seqNo received from this client

uint32_t _lastProcessedCriticalSeqNo; // highest seqNo processed request carrying info that needs to be applied in order
Expand Down

0 comments on commit 66016a2

Please sign in to comment.