Skip to content

Commit

Permalink
x86-64: Inline small array copy size for int and long arrays
Browse files Browse the repository at this point in the history
(1)
Inline small array copy size without using `rep movs`
for int array and long array
  - If AVX-512 is supported and copy size <= 128 bytes,
    the inlined copy sequence is used.
  - If AVX is supported, the threshold for inlined sequence
    is 64 bytes instead.
  - The enhancement for 32 bit and 64 bit arrays will be reused
    in the downstream OpenJ9 project for reference arrays.

(2)
Refactor char array enhancement implementation to support
both `rep movsw` and `rep movsd` if the copysize is greater
than the supported enhancement threshold.

(3)
Add the following options to disable the enhancement
  - `disableArrayCopyIntArrayInlineSmallSizeWithoutREPMOVS`:
    disable the enhancement for int array

  - `disableArrayCopyLongArrayInlineSmallSizeWithoutREPMOVS`:
    disable the enhancement for long array

  - `disableArrayCopyReferenceArrayInlineSmallSizeWithoutREPMOVS`:
    disable the enhancement for reference array, which will be
    implemented in downstream project OpenJ9.

Signed-off-by: Annabelle Huo <Annabelle.Huo@ibm.com>
  • Loading branch information
a7ehuo committed Jun 6, 2024
1 parent 398030f commit 2a2e130
Show file tree
Hide file tree
Showing 4 changed files with 493 additions and 81 deletions.
3 changes: 3 additions & 0 deletions compiler/control/OMROptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ TR::OptionTable OMR::Options::_jitOptions[] = {
{"disableAOTWarmRunThroughputImprovement", "O\tdisable change iprofiler entry choosing heuristic to improve aot warm run throughput", SET_OPTION_BIT(TR_DisableAOTWarmRunThroughputImprovement), "F"},
{"disableArrayCopyByteArrayInlineSmallSizeWithoutREPMOVS", "O\tdisable array copy optimizations enhancement for 8 bit primitive array", SET_OPTION_BIT(TR_Disable8BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS), "F"},
{"disableArrayCopyCharArrayInlineSmallSizeWithoutREPMOVS", "O\tdisable array copy optimizations enhancement for 16 bit primitive array", SET_OPTION_BIT(TR_Disable16BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS), "F"},
{"disableArrayCopyIntArrayInlineSmallSizeWithoutREPMOVS", "O\tdisable array copy optimizations enhancement for 32 bit primitive array", SET_OPTION_BIT(TR_Disable32BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS), "F"},
{"disableArrayCopyLongArrayInlineSmallSizeWithoutREPMOVS", "O\tdisable array copy optimizations enhancement for 64 bit primitive array", SET_OPTION_BIT(TR_Disable64BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS), "F"},
{"disableArrayCopyOpts", "O\tdisable array copy optimizations", SET_OPTION_BIT(TR_DisableArrayCopyOpts), "F"},
{"disableArrayCopyReferenceArrayInlineSmallSizeWithoutREPMOVS", "O\tdisable array copy optimizations enhancement for reference array", SET_OPTION_BIT(TR_DisableReferenceArrayCopyInlineSmallSizeWithoutREPMOVS), "F"},
{"disableArraySetOpts", "O\tdisable array set optimizations", SET_OPTION_BIT(TR_DisableArraySetOpts), "F"},
{"disableArraySetStoreElimination", "O\tdisable arrayset store elimination", SET_OPTION_BIT(TR_DisableArraysetStoreElimination), "F"},
{"disableArrayStoreCheckOpts", "O\tdisable array store check optimizations",SET_OPTION_BIT(TR_DisableArrayStoreCheckOpts), "F"},
Expand Down
6 changes: 3 additions & 3 deletions compiler/control/OMROptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,20 +344,20 @@ enum TR_CompilationOptions
TR_DisablePeephole = 0x00200000 + 8,
TR_NoOptServer = 0x00400000 + 8,
TR_DisableDLTrecompilationPrevention = 0x00800000 + 8,
// Available = 0x01000000 + 8,
TR_Disable32BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS = 0x01000000 + 8,
TR_DisablePeekAOTResolutions = 0x02000000 + 8,
TR_UseFlattenedArrayElementRuntimeHelpers = 0x04000000 + 8,
TR_UseFlattenedFieldRuntimeHelpers = 0x08000000 + 8,
TR_DisableLiveRangeSplitter = 0x10000000 + 8,
TR_DisableHalfSlotSpills = 0x20000000 + 8,
TR_DisableMHInlineWithoutPeeking = 0x40000000 + 8,
// Available = 0x80000000 + 8,
TR_Disable64BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS = 0x80000000 + 8,


// Option word 9
//
TR_SplitWarmAndColdBlocks = 0x00000020 + 9,
// Available = 0x00000040 + 9,
TR_DisableReferenceArrayCopyInlineSmallSizeWithoutREPMOVS = 0x00000040 + 9,
TR_DisableTLHPrefetch = 0x00000080 + 9,
TR_DisableJProfilerThread = 0x00000100 + 9,
TR_DisableIProfilerThread = 0x00000200 + 9,
Expand Down
Loading

0 comments on commit 2a2e130

Please sign in to comment.