Skip to content

Commit

Permalink
Merge pull request #15095 from bhavanisn/portableSCCfix
Browse files Browse the repository at this point in the history
Fix usage of pTOC with portableSCC code run in P10 container
  • Loading branch information
mpirvu committed May 31, 2022
2 parents 9ecb020 + 3f3eb0f commit 8cc7b5d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion runtime/compiler/compile/J9Compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,9 @@ J9::Compilation::compileRelocatableCode()
bool
J9::Compilation::compilePortableCode()
{
return self()->fej9()->inSnapshotMode();
return (self()->fej9()->inSnapshotMode() ||
(self()->compileRelocatableCode() &&
self()->fej9()->isPortableSCCEnabled()));
}


Expand Down
6 changes: 6 additions & 0 deletions runtime/compiler/env/VMJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8269,6 +8269,12 @@ TR_J9VMBase::isStringCompressionEnabledVM()
return IS_STRING_COMPRESSION_ENABLED_VM(getJ9JITConfig()->javaVM);
}

bool
TR_J9VMBase::isPortableSCCEnabled()
{
return (J9_ARE_ANY_BITS_SET(getJ9JITConfig()->javaVM->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_ENABLE_PORTABLE_SHARED_CACHE));
}

void *
TR_J9VMBase::getInvokeExactThunkHelperAddress(TR::Compilation *comp, TR::SymbolReference *glueSymRef, TR::DataType dataType)
{
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/env/VMJ9.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ class TR_J9VMBase : public TR_FrontEnd
virtual bool supportsGuardMerging() { return true; }
virtual bool canDevirtualizeDispatch() { return true; }
virtual bool doStringPeepholing() { return true; }
virtual bool isPortableSCCEnabled();

/**
* \brief Determine whether resolved direct dispatch is guaranteed.
Expand Down
8 changes: 8 additions & 0 deletions runtime/compiler/env/VMJ9Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,14 @@ TR_J9ServerVM::isForceInline(TR_ResolvedMethod *method)
return static_cast<TR_ResolvedJ9JITServerMethod *>(method)->isForceInline();
}

bool
TR_J9ServerVM::isPortableSCCEnabled()
{
JITServer::ServerStream *stream = _compInfoPT->getMethodBeingCompiled()->_stream;
auto *vmInfo = _compInfoPT->getClientData()->getOrCacheVMInfo(stream);
return J9_ARE_ANY_BITS_SET(vmInfo->_extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_ENABLE_PORTABLE_SHARED_CACHE);
}

bool
TR_J9SharedCacheServerVM::isClassLibraryMethod(TR_OpaqueMethodBlock *method, bool vettedForAOT)
{
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/env/VMJ9Server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class TR_J9ServerVM: public TR_J9VM
virtual bool needRelocationsForPersistentInfoData() override { return true; }
virtual bool needRelocationsForLookupEvaluationData() override { return true; }
virtual bool needRelocationsForCurrentMethodPC() override { return true; }
virtual bool isPortableSCCEnabled() override;
virtual void markHotField(TR::Compilation *, TR::SymbolReference *, TR_OpaqueClassBlock *, bool) override { return; }
virtual bool isClassLibraryMethod(TR_OpaqueMethodBlock *method, bool vettedForAOT) override;
virtual bool isClassLibraryClass(TR_OpaqueClassBlock *clazz) override;
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/p/codegen/PPCPrivateLinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ int32_t J9::Power::PrivateLinkage::buildPrivateLinkageArgs(TR::Node
{
if(comp()->target().isLinux() && comp()->target().is64Bit() && comp()->target().cpu.isLittleEndian())
{
if (!comp()->getOption(TR_DisableTOC))
if (!comp()->getOption(TR_DisableTOC) && !comp()->compilePortableCode())
{
int32_t helperOffset = (callNode->getSymbolReference()->getReferenceNumber() - 1)*sizeof(intptr_t);
generateTrg1MemInstruction(cg(), TR::InstOpCode::Op_load, callNode, dependencies->searchPreConditionRegister(TR::RealRegister::gr12),
Expand Down

0 comments on commit 8cc7b5d

Please sign in to comment.