Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change realTimeGC option as per compilation #8895

Merged
merged 1 commit into from Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/compiler/arm/codegen/J9ARMEvaluator.cpp
Expand Up @@ -932,7 +932,7 @@ static void genHeapAlloc(TR::CodeGenerator *cg,
TR::LabelSymbol *callLabel,
int32_t allocSize)
{
if (TR::Options::getCmdLineOptions()->realTimeGC())
if (cg->comp()->getOptions()->realTimeGC())
{
TR_ASSERT(0, "genHeapAlloc() not supported for RT");
return;
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/arm/codegen/J9TreeEvaluator.cpp
Expand Up @@ -346,7 +346,7 @@ void J9::ARM::TreeEvaluator::genWrtbarForArrayCopy(TR::Node *node, TR::Register
}
else if (cardMarkIsNeeded)
{
if (!TR::Options::getCmdLineOptions()->realTimeGC())
if (!comp->getOptions()->realTimeGC())
{
TR::Register *temp1Reg = cg->allocateRegister();
TR::Register *temp2Reg = cg->allocateRegister();
Expand Down
9 changes: 5 additions & 4 deletions runtime/compiler/control/HookedByTheJit.cpp
Expand Up @@ -6800,13 +6800,14 @@ static void jitReleaseCodeStackWalk(OMR_VMThread *omrVMThread, condYieldFromGCFu
bool yieldHappened = false;
bool doStackWalkForThread = true;

bool isRealTimeGC = TR::Options::getCmdLineOptions()->realTimeGC();
do
{
J9VMThread *thread = vmThread;
yieldHappened = false;
do
{
if (TR::Options::getCmdLineOptions()->realTimeGC() && !TR::Options::getCmdLineOptions()->getOption(TR_DisableIncrementalCCR))
if (isRealTimeGC && !TR::Options::getCmdLineOptions()->getOption(TR_DisableIncrementalCCR))
doStackWalkForThread = (thread->dropFlags & 0x1) ? false : true;

if (doStackWalkForThread)
Expand All @@ -6818,7 +6819,7 @@ static void jitReleaseCodeStackWalk(OMR_VMThread *omrVMThread, condYieldFromGCFu
walkState.walkThread = thread;
vmThread->javaVM->walkStackFrames(vmThread, &walkState);

if (TR::Options::getCmdLineOptions()->realTimeGC() && !TR::Options::getCmdLineOptions()->getOption(TR_DisableIncrementalCCR))
if (isRealTimeGC && !TR::Options::getCmdLineOptions()->getOption(TR_DisableIncrementalCCR))
{
thread->dropFlags |= 0x1;
yieldHappened = condYield(omrVMThread, J9_GC_METRONOME_UTILIZATION_COMPONENT_JIT);
Expand Down Expand Up @@ -6884,7 +6885,7 @@ static void jitReleaseCodeStackWalk(OMR_VMThread *omrVMThread, condYieldFromGCFu
OMR::FaintCacheBlock *next = cursor->_next;
jitReleaseCodeCollectMetaData(jitConfig, vmThread, metaData, cursor);
cursor = next;
if (TR::Options::getCmdLineOptions()->realTimeGC() && !TR::Options::getCmdLineOptions()->getOption(TR_DisableIncrementalCCR))
if (isRealTimeGC && !TR::Options::getCmdLineOptions()->getOption(TR_DisableIncrementalCCR))
condYieldCounter += condYield(omrVMThread, J9_GC_METRONOME_UTILIZATION_COMPONENT_JIT);

continue;
Expand All @@ -6904,7 +6905,7 @@ static void jitReleaseCodeStackWalk(OMR_VMThread *omrVMThread, condYieldFromGCFu
cursor->_isStillLive = false;
}

if (TR::Options::getCmdLineOptions()->realTimeGC() && !TR::Options::getCmdLineOptions()->getOption(TR_DisableIncrementalCCR))
if (isRealTimeGC && !TR::Options::getCmdLineOptions()->getOption(TR_DisableIncrementalCCR))
{ //clear flags
J9VMThread *thr = vmThread;
do
Expand Down
12 changes: 12 additions & 0 deletions runtime/compiler/control/JITClientCompilationThread.cpp
Expand Up @@ -1120,6 +1120,18 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes
client->write(response, fe->getROMMethodFromRAMMethod(std::get<0>(recv)));
}
break;
case MessageType::VM_getCellSizeForSizeClass:
{
auto recv = client->getRecvData<uintptr_t>();
client->write(response, fe->getCellSizeForSizeClass(std::get<0>(recv)));
}
break;
case MessageType::VM_getObjectSizeClass:
{
auto recv = client->getRecvData<uintptr_t>();
client->write(response, fe->getObjectSizeClass(std::get<0>(recv)));
}
break;
case MessageType::mirrorResolvedJ9Method:
{
// allocate a new TR_ResolvedJ9Method on the heap, to be used as a mirror for performing actions which are only
Expand Down
5 changes: 3 additions & 2 deletions runtime/compiler/env/J9VMEnv.cpp
Expand Up @@ -170,7 +170,9 @@ acquireVMaccessIfNeededInner(J9VMThread *vmThread, TR_YesNoMaybe isCompThread)
heldMonitor, TR_J9VMBase::get(jitConfig, NULL)->getJ9MonitorName((J9ThreadMonitor*)heldMonitor->getVMMonitor()));
#endif // #if defined(DEBUG) || defined(PROD_WITH_ASSUMES)

if (TR::Options::getCmdLineOptions()->realTimeGC())
TR::Compilation *comp = compInfoPT->getCompilation();
if ((comp && comp->getOptions()->realTimeGC()) ||
TR::Options::getCmdLineOptions()->realTimeGC())
compInfoPT->waitForGCCycleMonitor(false); // used only for real-time

acquireVMAccessNoSuspend(vmThread); // blocking. Will wait for the entire GC
Expand All @@ -189,7 +191,6 @@ acquireVMaccessIfNeededInner(J9VMThread *vmThread, TR_YesNoMaybe isCompThread)
//TR::MonitorTable::get()->readReleaseClassUnloadMonitor(0); // Main code should do it.
// releaseVMAccess(vmThread);

TR::Compilation *comp = compInfoPT->getCompilation();
if (comp)
{
comp->failCompilation<TR::CompilationInterrupted>("Compilation interrupted by GC unloading classes");
Expand Down
13 changes: 7 additions & 6 deletions runtime/compiler/env/VMJ9.cpp
Expand Up @@ -338,7 +338,9 @@ bool acquireVMaccessIfNeeded(J9VMThread *vmThread, TR_YesNoMaybe isCompThread)
heldMonitor, TR_J9VMBase::get(jitConfig, NULL)->getJ9MonitorName((J9ThreadMonitor*)heldMonitor->getVMMonitor()));
#endif // #if defined(DEBUG) || defined(PROD_WITH_ASSUMES)

if (TR::Options::getCmdLineOptions()->realTimeGC())
TR::Compilation *comp = compInfoPT->getCompilation();
if ((comp && comp->getOptions()->realTimeGC()) ||
TR::Options::getCmdLineOptions()->realTimeGC())
compInfoPT->waitForGCCycleMonitor(false); // used only for real-time

acquireVMAccessNoSuspend(vmThread); // blocking. Will wait for the entire GC
Expand All @@ -356,7 +358,6 @@ bool acquireVMaccessIfNeeded(J9VMThread *vmThread, TR_YesNoMaybe isCompThread)
//TR::MonitorTable::get()->readReleaseClassUnloadMonitor(0); // Main code should do it.
// releaseVMAccess(vmThread);

TR::Compilation *comp = compInfoPT->getCompilation();
if (comp)
{
comp->failCompilation<TR::CompilationInterrupted>("Compilation interrupted by GC unloading classes");
Expand Down Expand Up @@ -3683,7 +3684,7 @@ TR_J9VMBase::compilationShouldBeInterrupted(TR::Compilation * comp, TR_CallingCo
{
releaseVMAccess(vmThread());

if (!compilingOnApplicationThread && TR::Options::getCmdLineOptions()->realTimeGC())
if (!compilingOnApplicationThread && comp->getOptions()->realTimeGC())
{
// no compilation on application thread
TR_ASSERT(_compInfoPT, "Missing compilation info per thread.");
Expand All @@ -3699,7 +3700,7 @@ TR_J9VMBase::compilationShouldBeInterrupted(TR::Compilation * comp, TR_CallingCo
if (!comp->getOption(TR_DisableNoVMAccess))
{
bool exitClassUnloadMonitor = persistentMemory(_jitConfig)->getPersistentInfo()->GCwillBlockOnClassUnloadMonitor();
if (TR::Options::getCmdLineOptions()->realTimeGC())
if (comp->getOptions()->realTimeGC())
{
#if defined (J9VM_GC_REALTIME)
J9JavaVM *vm = _jitConfig->javaVM;
Expand All @@ -3724,7 +3725,7 @@ TR_J9VMBase::compilationShouldBeInterrupted(TR::Compilation * comp, TR_CallingCo
#endif
//--- GC CAN INTERVENE HERE ---
TR_ASSERT((vmThread()->publicFlags & J9_PUBLIC_FLAGS_VM_ACCESS) == 0, "comp thread must not have vm access");
if (!compilingOnApplicationThread && TR::Options::getCmdLineOptions()->realTimeGC())
if (!compilingOnApplicationThread && comp->getOptions()->realTimeGC())
{
// no compilation on application thread
TR_ASSERT(_compInfoPT, "Missing compilation info per thread.");
Expand Down Expand Up @@ -4220,7 +4221,7 @@ TR_J9VMBase::initializeLocalObjectFlags(TR::Compilation * comp, TR::Node * alloc
int32_t initValue = TR::Compiler->cls.romClassOf(ramClass)->instanceShape;
#endif

if (!TR::Options::getCmdLineOptions()->realTimeGC())
if (!comp->getOptions()->realTimeGC())
a7ehuo marked this conversation as resolved.
Show resolved Hide resolved
{
initValue |= vmThread()->allocateThreadLocalHeap.objectFlags;
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/env/VMJ9.h
Expand Up @@ -628,7 +628,7 @@ class TR_J9VMBase : public TR_FrontEnd
uintptr_t getMaxObjectSizeForSizeClass();
uintptr_t thisThreadAllocationCacheCurrentOffset(uintptr_t);
uintptr_t thisThreadAllocationCacheTopOffset(uintptr_t);
uintptr_t getCellSizeForSizeClass(uintptr_t);
virtual uintptr_t getCellSizeForSizeClass(uintptr_t);
virtual uintptr_t getObjectSizeClass(uintptr_t);

uintptr_t thisThreadMonitorCacheOffset();
Expand Down
22 changes: 22 additions & 0 deletions runtime/compiler/env/VMJ9Server.cpp
Expand Up @@ -1805,6 +1805,28 @@ TR_J9ServerVM::getInvokeExactThunkHelperAddress(TR::Compilation *comp, TR::Symbo
return helper;
}

UDATA
TR_J9ServerVM::getCellSizeForSizeClass(uintptr_t sizeClass)
{
#if defined(J9VM_GC_REALTIME)
JITServer::ServerStream *stream = _compInfoPT->getMethodBeingCompiled()->_stream;
stream->write(JITServer::MessageType::VM_getCellSizeForSizeClass, sizeClass);
return std::get<0>(stream->read<UDATA>());
#endif
return 0;
}

UDATA
TR_J9ServerVM::getObjectSizeClass(uintptr_t objectSize)
{
#if defined(J9VM_GC_REALTIME)
JITServer::ServerStream *stream = _compInfoPT->getMethodBeingCompiled()->_stream;
stream->write(JITServer::MessageType::VM_getObjectSizeClass, objectSize);
return std::get<0>(stream->read<UDATA>());
#endif
return 0;
}

bool
TR_J9SharedCacheServerVM::isClassLibraryMethod(TR_OpaqueMethodBlock *method, bool vettedForAOT)
{
Expand Down
3 changes: 3 additions & 0 deletions runtime/compiler/env/VMJ9Server.hpp
Expand Up @@ -188,6 +188,9 @@ class TR_J9ServerVM: public TR_J9VM
virtual bool getReportByteCodeInfoAtCatchBlock() override;
virtual void *getInvokeExactThunkHelperAddress(TR::Compilation *comp, TR::SymbolReference *glueSymRef, TR::DataType dataType) override;

virtual uintptr_t getCellSizeForSizeClass(uintptr_t) override;
virtual uintptr_t getObjectSizeClass(uintptr_t) override;

private:
bool instanceOfOrCheckCastHelper(J9Class *instanceClass, J9Class* castClass, bool cacheUpdate);

Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/net/CommunicationStream.hpp
Expand Up @@ -89,7 +89,7 @@ class CommunicationStream
ClientMessage _cMsg;

static const uint8_t MAJOR_NUMBER = 1;
static const uint16_t MINOR_NUMBER = 0;
static const uint16_t MINOR_NUMBER = 1;
static const uint8_t PATCH_NUMBER = 0;
static uint32_t CONFIGURATION_FLAGS;

Expand Down
2 changes: 2 additions & 0 deletions runtime/compiler/net/MessageTypes.hpp
Expand Up @@ -201,6 +201,8 @@ enum MessageType : uint16_t
VM_getJ2IThunk = 307,
VM_needsInvokeExactJ2IThunk = 308,
VM_instanceOfOrCheckCastNoCacheUpdate = 309,
VM_getCellSizeForSizeClass = 310,
VM_getObjectSizeClass = 311,

// For static TR::CompilationInfo methods
CompInfo_isCompiled = 400,
Expand Down
14 changes: 7 additions & 7 deletions runtime/compiler/p/codegen/J9PPCSnippet.cpp
Expand Up @@ -1255,12 +1255,12 @@ void TR::createCCPreLoadedCode(uint8_t *CCPreLoadedCodeBase, uint8_t *CCPreLoade
{
/* If you modify this make sure you update CCPreLoadedCodeSize above as well */

if (TR::Options::getCmdLineOptions()->realTimeGC())
return;

// We temporarily clobber the first and append instructions so we can use high level codegen to generate pre-loaded code
// So save the original values here and restore them when done
TR::Compilation *comp = cg->comp();
if (comp->getOptions()->realTimeGC())
return;

TR::Instruction *curFirst = cg->getFirstInstruction();
TR::Instruction *curAppend = cg->getAppendInstruction();
uint8_t *curBinaryBufferStart = cg->getBinaryBufferStart();
Expand Down Expand Up @@ -1315,7 +1315,7 @@ uint8_t *TR::PPCAllocPrefetchSnippet::emitSnippetBody()
getSnippetLabel()->setCodeLocation(buffer);
TR::InstOpCode opcode;

if (TR::Options::getCmdLineOptions()->realTimeGC())
if (comp->getOptions()->realTimeGC())
return NULL;

TR_ASSERT((uintptr_t)((cg()->getCodeCache())->getCCPreLoadedCodeAddress(TR_AllocPrefetch, cg())) != 0xDEADBEEF,
Expand Down Expand Up @@ -1347,7 +1347,7 @@ TR::PPCAllocPrefetchSnippet::print(TR::FILE *pOutFile, TR_Debug * debug)
uint32_t TR::PPCAllocPrefetchSnippet::getLength(int32_t estimatedCodeStart)
{

if (TR::Options::getCmdLineOptions()->realTimeGC())
if (cg()->comp()->getOptions()->realTimeGC())
return 0;

return PPC_INSTRUCTION_LENGTH;
Expand All @@ -1368,7 +1368,7 @@ uint8_t *TR::PPCNonZeroAllocPrefetchSnippet::emitSnippetBody()
getSnippetLabel()->setCodeLocation(buffer);
TR::InstOpCode opcode;

if (TR::Options::getCmdLineOptions()->realTimeGC())
if (comp->getOptions()->realTimeGC())
return NULL;

TR_ASSERT((uintptr_t)((cg()->getCodeCache())->getCCPreLoadedCodeAddress(TR_NonZeroAllocPrefetch, cg())) != 0xDEADBEEF,
Expand Down Expand Up @@ -1400,7 +1400,7 @@ TR::PPCNonZeroAllocPrefetchSnippet::print(TR::FILE *pOutFile, TR_Debug * debug)
uint32_t TR::PPCNonZeroAllocPrefetchSnippet::getLength(int32_t estimatedCodeStart)
{

if (TR::Options::getCmdLineOptions()->realTimeGC())
if (cg()->comp()->getOptions()->realTimeGC())
return 0;

return PPC_INSTRUCTION_LENGTH;
Expand Down