Skip to content

Commit

Permalink
Merge pull request #2806 from r30shah/constantDynamicSupportZ
Browse files Browse the repository at this point in the history
IBM Z Codegen changes to support Condy in jdk11
  • Loading branch information
fjeremic committed Sep 12, 2018
2 parents c8b8f0f + 2699193 commit 103895a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
3 changes: 3 additions & 0 deletions runtime/compiler/runtime/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ JIT_HELPER(_interpreterFloatStaticGlue);
JIT_HELPER(_interpreterSyncFloatStaticGlue);
JIT_HELPER(_interpreterDoubleStaticGlue);
JIT_HELPER(_interpreterSyncDoubleStaticGlue);
JIT_HELPER(_jitResolveConstantDynamic);
JIT_HELPER(_nativeStaticHelper);
JIT_HELPER(jitLookupInterfaceMethod);
JIT_HELPER(jitMethodIsNative);
Expand Down Expand Up @@ -1547,6 +1548,7 @@ void initializeCodeRuntimeHelperTable(J9JITConfig *jitConfig, char isSMP)
SET(TR_S390interfaceCallHelper, (void *) _interfaceCallHelper, TR_Helper);
SET(TR_S390interfaceCallHelperSingleDynamicSlot, (void *) _interfaceCallHelperSingleDynamicSlot, TR_Helper);
SET(TR_S390interfaceCallHelperMultiSlots, (void *) _interfaceCallHelperMultiSlots, TR_Helper);
SET(TR_S390jitResolveConstantDynamicGlue, (void *) _jitResolveConstantDynamic, TR_Helper);
SET(TR_S390icallVMprJavaSendVirtual0, (void *) icallVMprJavaSendVirtual0, TR_Helper);
SET(TR_S390icallVMprJavaSendVirtual1, (void *) icallVMprJavaSendVirtual1, TR_Helper);
SET(TR_S390icallVMprJavaSendVirtualJ, (void *) icallVMprJavaSendVirtualJ, TR_Helper);
Expand All @@ -1557,6 +1559,7 @@ void initializeCodeRuntimeHelperTable(J9JITConfig *jitConfig, char isSMP)
SET(TR_S390jitMethodIsSync, (void *) jitMethodIsSync, TR_Helper);
SET(TR_S390jitResolveClass, (void *) jitResolveClass, TR_Helper);
SET(TR_S390jitResolveClassFromStaticField, (void *) jitResolveClassFromStaticField, TR_Helper);
SET(TR_S390jitResolveConstantDynamic, (void *) jitResolveConstantDynamic, TR_Helper);
SET(TR_S390jitResolveField, (void *) jitResolveField, TR_Helper);
SET(TR_S390jitResolveFieldSetter, (void *) jitResolveFieldSetter, TR_Helper);
SET(TR_S390jitResolveInterfaceMethod, (void *) jitResolveInterfaceMethod, TR_Helper);
Expand Down
10 changes: 9 additions & 1 deletion runtime/compiler/z/codegen/J9UnresolvedDataSnippet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ J9::Z::UnresolvedDataSnippet::emitSnippetBody()
{
glueRef = cg()->symRefTab()->findOrCreateRuntimeHelper(TR_interpreterUnresolvedMethodTypeTableEntryGlue, false, false, false);
}
else if (getDataSymbol()->isConstantDynamic())
{
glueRef = cg()->symRefTab()->findOrCreateRuntimeHelper(TR_S390jitResolveConstantDynamicGlue, false, false, false);
}
else // must be static data
{
if (resolveForStore())
Expand Down Expand Up @@ -503,7 +507,10 @@ TR_Debug::print(TR::FILE *pOutFile, TR::UnresolvedDataSnippet * snippet)
{
glueRef = _cg->getSymRef(TR_interpreterUnresolvedMethodTypeTableEntryGlue);
}

else if (snippet->getDataSymbol()->isConstantDynamic())
{
glueRef = _cg->getSymRef(TR_S390jitResolveConstantDynamicGlue);
}
else // the data symbol is static
{
if (snippet->resolveForStore())
Expand All @@ -516,6 +523,7 @@ TR_Debug::print(TR::FILE *pOutFile, TR::UnresolvedDataSnippet * snippet)
}
}


printPrefix(pOutFile, NULL, bufferPos, sizeof(intptrj_t));
trfprintf(pOutFile, "DC \t%s", getName(glueRef));
bufferPos += sizeof(intptrj_t);
Expand Down
42 changes: 41 additions & 1 deletion runtime/compiler/z/runtime/PicBuilder.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define(`ZZ',`**')
define(`ZZ',`##')
')dnl

ZZ Copyright (c) 2000, 2017 IBM Corp. and others
ZZ Copyright (c) 2000, 2018 IBM Corp. and others
ZZ
ZZ This program and the accompanying materials are made
ZZ available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -1702,6 +1702,46 @@ LABEL(L_virtualDispatchExit)

END_FUNC(_virtualUnresolvedHelper,virUH,7)

ZZ ================================================
ZZ PICBuilderRoutine : _jitResolveConstantDynamic
ZZ ================================================
START_FUNC(_jitResolveConstantDynamic,jRCD)

LABEL(_jitResolveConstantDynamicBody)
ZZ Loading arguments for JIT helper
ZZ R1 - Address of Constant Pool
ZZ R2 - CPIndex
ZZ R3 - JIT'd code Return Address
L_GPR r1,eq_cp_inDataSnippet(,r14)
LGF_GPR r2,eq_cpindex_inDataSnippet(,r14)
L_GPR r3,eq_codeRA_inDataSnippet(,r14)

ZZ Following snippet prepares JIT helper call sequence
ZZ which needs r14 to be free which holds address of
ZZ Snippet from where this is called.
ZZ As jitResolveConstantDynamic is called via
ZZ SLOW_PATH_ONLY_HELPER glue, it is guranteed that
ZZ all the registers (volatile and non-volatile) are preserved.
ZZ This allows us to use R0 to preserve R14
LOAD_ADDR_FROM_TOC(rEP,TR_S390jitResolveConstantDynamic)
LR_GPR r0,r14
BASR r14,rEP
LR_GPR r14,r0

ZZ Load the address of literal pool
ZZ Store the return value of helper call which
ZZ is address of resolved constant dynamic
ZZ into the Literal Pool
L_GPR r1,eq_literalPoolAddr_inDataSnippet(r14)
ST_GPR r2,0(,r1)

L_GPR r14,eq_codeRA_inDataSnippet(,r14) # Get mainline RA

ZZ Branch instruction in mainline will be patched here with NOP
LHI r1,HEX(04)
STCY r1,-5(r14)
BR r14 # Return
END_FUNC(_jitResolveConstantDynamic,jRCD,6)

ZZ ===================================================================
ZZ PICBuider routine - _interfaceCallHelper
Expand Down

0 comments on commit 103895a

Please sign in to comment.