Skip to content

Commit

Permalink
Merge pull request #7391 from rmnattas/off-heap-unsafeMod
Browse files Browse the repository at this point in the history
Add offHeapCopyMemory in VP DelayedTransformations
  • Loading branch information
vijaysun-omr authored Jun 24, 2024
2 parents d8253e6 + 5242df1 commit df33ce1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions compiler/optimizer/OMRValuePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7264,6 +7264,22 @@ void OMR::ValuePropagation::doDelayedTransformations()
}
_scalarizedArrayCopies.deleteAll();

#if defined(J9_PROJECT_SPECIFIC) && defined(OMR_GC_SPARSE_HEAP_ALLOCATION)
// Transform Unsafe.copyMemory in OffHeap
if (TR::Compiler->om.isOffHeapAllocationEnabled())
{
ListIterator<TR_TreeTopNodePair> copyMemoryIt(&_offHeapCopyMemory);
TR_TreeTopNodePair *copyMemoryPair;
for (copyMemoryPair = copyMemoryIt.getFirst();
copyMemoryPair; copyMemoryPair = copyMemoryIt.getNext())
{
if (performTransformation(comp(), "O^O Call arraycopy instead of Unsafe.copyMemory: %p\n", copyMemoryPair->_node))
TR::TransformUtil::transformUnsafeCopyMemorytoArrayCopyForOffHeap(self()->comp(), copyMemoryPair->_treetop, copyMemoryPair->_node);
}
_offHeapCopyMemory.deleteAll();
}
#endif

// NOTE: the array copy spine checks are processed before the reference, realtime, and
// unknown arraycopies because it refactors the CFG at a higher (outer) level
// than the others. To simplify the CFG it should be run first.
Expand Down
1 change: 1 addition & 0 deletions compiler/optimizer/OMRValuePropagation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ class ValuePropagation : public TR::Optimization
List<TR_ArrayCopySpineCheck> _arrayCopySpineCheck;
List<TR::TreeTop> _multiLeafCallsToInline;
List<TR_TreeTopNodePair> _scalarizedArrayCopies;
List<TR_TreeTopNodePair> _offHeapCopyMemory;
List<TR::TreeTop> _converterCalls;
List<TR::TreeTop> _objectCloneCalls;
List<TR::TreeTop> _arrayCloneCalls;
Expand Down
1 change: 1 addition & 0 deletions compiler/optimizer/ValuePropagationCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ OMR::ValuePropagation::ValuePropagation(TR::OptimizationManager *manager)
_javaLangClassGetComponentTypeCalls(trMemory()),
_unknownTypeArrayCopyTrees(trMemory()),
_scalarizedArrayCopies(trMemory()),
_offHeapCopyMemory(trMemory()),
_predictedThrows(trMemory()),
_prexClasses(trMemory()),
_prexMethods(trMemory()),
Expand Down

0 comments on commit df33ce1

Please sign in to comment.