Skip to content

Commit

Permalink
Software Concurrent Scavenge Support on Power
Browse files Browse the repository at this point in the history
Sets OMR_GC_CONCURRENT_SCAVENGER in the configure files to enable
concurrent scavenge.

Modifies mminit.cpp to be able to set softwareRangeCheckReadBarrier to
true to enable software based concurrent scavenge.

Implemented irdbarEvaluator and ardbarEvaluator which are used to handle
loads that might need to call out to the readbarrier under Concurrent
Scavenge GC policy.

Updated VMinlineCompareAndSwapObject to be aware of the possiblity of
calling out to the read barrier under Concurrent Scavenge GC policy.

Implemented a new version of arraycopyEvaluator for reference array copies
that calls out to the referenceArrayCopy if current scavenge is currently
happening.

Added jitReadBarrier and jitReferenceArrayCopy as helpers to call out to
J9ReadBarrier and referenceArrayCopy.

Updated thisThreadGetConcurrentScavengeActiveByteAddressOffset and
thisThreadGetEvacuateBaseAddressOffset to recognize Power as well as X86.

Updated insertPrefetchIfNecessary to recognize the irdbari opcode.

Updated copyright dates on modified files.

TM is current not compatible with read barriers. This change will disable
TM if read barriers are needed.

Issue: eclipse-openj9#3421
Signed-off-by: jimmyk <jimmyk@ca.ibm.com>
  • Loading branch information
IBMJimmyk committed Feb 8, 2019
1 parent 9b95547 commit 1c5de22
Show file tree
Hide file tree
Showing 10 changed files with 1,589 additions and 15 deletions.
59 changes: 58 additions & 1 deletion runtime/codert_vm/pnathelp.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dnl Copyright (c) 2017, 2018 IBM Corp. and others
dnl Copyright (c) 2017, 2019 IBM Corp. and others
dnl
dnl This program and the accompanying materials are made available under
dnl the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -852,6 +852,63 @@ START_PROC(jitFillOSRBufferReturn)
CINTERP(J9TR_bcloop_exit_interpreter, 0)
END_PROC(jitFillOSRBufferReturn)

dnl Expects r3 to already contain the vmThread.
dnl Expects r4 to already contain the address being loaded from.
START_PROC(jitReadBarrier)
ifdef({OMR_GC_CONCURRENT_SCAVENGER},{
staddr r0,JIT_GPR_SAVE_SLOT(0)
SAVE_LR
SAVE_JIT_GOT_REGISTERS
INIT_JIT_TOC
SWITCH_TO_C_STACK
SAVE_C_VOLATILE_REGS

laddr r5,J9TR_VMThread_javaVM(J9VMTHREAD)
laddr r5,J9TR_JavaVM_memoryManagerFunctions(r5)
laddr FUNC_PTR,J9TR_J9MemoryManagerFunctions_J9ReadBarrier(r5)
CALL_INDIRECT

RESTORE_C_VOLATILE_REGS
RESTORE_JIT_GOT_REGISTERS
RESTORE_LR
SWITCH_TO_JAVA_STACK
laddr r0,JIT_GPR_SAVE_SLOT(0)
blr
},{
dnl jitReadBarrier is not supported if OMR_GC_CONCURRENT_SCAVENGER is not set
trap
})
END_PROC(jitReadBarrier)

dnl Expects r3 to already contain vmThread.
dnl Expects r4 to already contain srcObj.
dnl Expects r5 to already contain dstObj.
dnl Expects r6 to already contain srcAddr.
dnl Expects r7 to already contain dstAddr.
dnl Expects r8 to already contain length.
START_PROC(jitReferenceArrayCopy)
staddr r0,JIT_GPR_SAVE_SLOT(0)
SAVE_LR
SAVE_JIT_GOT_REGISTERS
INIT_JIT_TOC
SWITCH_TO_C_STACK
SAVE_ALL_REGS

laddr r9,J9TR_VMThread_javaVM(J9VMTHREAD)
laddr r9,J9TR_JavaVM_memoryManagerFunctions(r9)
laddr FUNC_PTR,J9TR_J9MemoryManagerFunctions_referenceArrayCopy(r9)
CALL_INDIRECT
staddr r3,J9TR_VMThread_returnValue(J9VMTHREAD)

RESTORE_ALL_REGS
RESTORE_JIT_GOT_REGISTERS
RESTORE_LR
SWITCH_TO_JAVA_STACK
laddr r0,JIT_GPR_SAVE_SLOT(0)
laddr r3,J9TR_VMThread_returnValue(J9VMTHREAD)
blr
END_PROC(jitReferenceArrayCopy)

ifdef({ASM_J9VM_ENV_DATA64},{

BEGIN_RETURN_POINT(jitExitInterpreterJ)
Expand Down
8 changes: 4 additions & 4 deletions runtime/compiler/env/VMJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1920,11 +1920,11 @@ UDATA TR_J9VMBase::thisThreadGetConcurrentScavengeActiveByteAddressOffset()
UDATA TR_J9VMBase::thisThreadGetEvacuateBaseAddressOffset()
{
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
#if defined(J9VM_GC_COMPRESSED_POINTERS) && defined(TR_TARGET_X86)
#if defined(J9VM_GC_COMPRESSED_POINTERS) && !defined(TR_TARGET_S390)
return offsetof(J9VMThread, readBarrierRangeCheckBaseCompressed);
#else
return offsetof(J9VMThread, readBarrierRangeCheckBase);
#endif /* defined(J9VM_GC_COMPRESSED_POINTERS) && defined(TR_TARGET_X86) */
#endif /* defined(J9VM_GC_COMPRESSED_POINTERS) && !defined(TR_TARGET_S390) */
#else /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
TR_ASSERT(0,"Field readBarrierRangeCheckBase does not exists in J9VMThread.");
return 0;
Expand All @@ -1937,11 +1937,11 @@ UDATA TR_J9VMBase::thisThreadGetEvacuateBaseAddressOffset()
UDATA TR_J9VMBase::thisThreadGetEvacuateTopAddressOffset()
{
#if defined(OMR_GC_CONCURRENT_SCAVENGER)
#if defined(J9VM_GC_COMPRESSED_POINTERS) && defined(TR_TARGET_X86)
#if defined(J9VM_GC_COMPRESSED_POINTERS) && !defined(TR_TARGET_S390)
return offsetof(J9VMThread, readBarrierRangeCheckTopCompressed);
#else
return offsetof(J9VMThread, readBarrierRangeCheckTop);
#endif /* defined(J9VM_GC_COMPRESSED_POINTERS) && defined(TR_TARGET_X86) */
#endif /* defined(J9VM_GC_COMPRESSED_POINTERS) && !defined(TR_TARGET_S390) */
#else /* defined(OMR_GC_CONCURRENT_SCAVENGER) */
TR_ASSERT(0,"Field readBarrierRangeCheckTop does not exists in J9VMThread.");
return 0;
Expand Down
5 changes: 4 additions & 1 deletion runtime/compiler/p/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,10 @@ J9::Power::CodeGenerator::insertPrefetchIfNecessary(TR::Node *node, TR::Register
}

if (node->getOpCodeValue() == TR::aloadi ||
(TR::Compiler->target.is64Bit() && comp()->useCompressedPointers() && node->getOpCodeValue() == TR::iloadi && comp()->getMethodHotness() >= hot))
(TR::Compiler->target.is64Bit() &&
comp()->useCompressedPointers() &&
(node->getOpCodeValue() == TR::iloadi || node->getOpCodeValue() == TR::irdbari) &&
comp()->getMethodHotness() >= hot))
{
TR::Node *firstChild = node->getFirstChild();
optDisabled = disableIteratorPrefetch;
Expand Down
Loading

0 comments on commit 1c5de22

Please sign in to comment.