Skip to content

Commit

Permalink
Merge pull request #7568 from a7ehuo/system-arraycopy-revert-PR7534
Browse files Browse the repository at this point in the history
Revert "Merge pull request #7534"
  • Loading branch information
0xdaryl authored Dec 3, 2024
2 parents cd5ca19 + 4a3f4f3 commit 82df57f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 5 additions & 5 deletions compiler/control/OMROptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1497,11 +1497,11 @@ class OMR_EXTENSIBLE Options
_edoRecompSizeThreshold = 0;
_edoRecompSizeThresholdInStartupMode = 0;
_catchBlockCounterThreshold = 0;
_arraycopyRepMovsByteArrayThreshold = 0;
_arraycopyRepMovsCharArrayThreshold = 0;
_arraycopyRepMovsIntArrayThreshold = 0;
_arraycopyRepMovsLongArrayThreshold = 0;
_arraycopyRepMovsReferenceArrayThreshold = 0;
_arraycopyRepMovsByteArrayThreshold = 32;
_arraycopyRepMovsCharArrayThreshold = 32;
_arraycopyRepMovsIntArrayThreshold = 32;
_arraycopyRepMovsLongArrayThreshold = 32;
_arraycopyRepMovsReferenceArrayThreshold = 32;

memset(_options, 0, sizeof(_options));
memset(_disabledOptimizations, false, sizeof(_disabledOptimizations));
Expand Down
14 changes: 5 additions & 9 deletions compiler/x/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2743,7 +2743,7 @@ static bool enablePrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS(uint8_t elemen

bool disableEnhancement = false;

threshold = 64;
threshold = 32;

switch (elementSize)
{
Expand All @@ -2752,10 +2752,8 @@ static bool enablePrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS(uint8_t elemen
disableEnhancement = disable64BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS
|| cg->comp()->getOption(TR_Disable64BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS);

threshold = cg->comp()->target().cpu.supportsFeature(OMR_FEATURE_X86_AVX512F) ? 128 : 64;

int32_t newThreshold = cg->comp()->getOptions()->getArraycopyRepMovsLongArrayThreshold();
if ((newThreshold == 32) || (newThreshold == 64) || (newThreshold == 128))
if ((threshold < newThreshold) && ((newThreshold == 64) || (newThreshold == 128)))
{
// If the CPU doesn't support AVX512, reduce the threshold to 64 bytes
threshold = ((newThreshold == 128) && !cg->comp()->target().cpu.supportsFeature(OMR_FEATURE_X86_AVX512F)) ? 64 : newThreshold;
Expand All @@ -2767,10 +2765,8 @@ static bool enablePrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS(uint8_t elemen
disableEnhancement = disable32BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS
|| cg->comp()->getOption(TR_Disable32BitPrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS);

threshold = cg->comp()->target().cpu.supportsFeature(OMR_FEATURE_X86_AVX512F) ? 128 : 64;

int32_t newThreshold = cg->comp()->getOptions()->getArraycopyRepMovsIntArrayThreshold();
if ((newThreshold == 32) || (newThreshold == 64) || (newThreshold == 128))
if ((threshold < newThreshold) && ((newThreshold == 64) || (newThreshold == 128)))
{
// If the CPU doesn't support AVX512, reduce the threshold to 64 bytes
threshold = ((newThreshold == 128) && !cg->comp()->target().cpu.supportsFeature(OMR_FEATURE_X86_AVX512F)) ? 64 : newThreshold;
Expand All @@ -2785,7 +2781,7 @@ static bool enablePrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS(uint8_t elemen
int32_t newThreshold = cg->comp()->getOptions()->getArraycopyRepMovsCharArrayThreshold();

// Char array enhancement supports only 32 or 64 bytes
threshold = (newThreshold == 32) ? 32 : threshold;
threshold = (newThreshold == 64) ? 64 : threshold;
}
break;
default: // 1 byte
Expand All @@ -2796,7 +2792,7 @@ static bool enablePrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS(uint8_t elemen
int32_t newThreshold = cg->comp()->getOptions()->getArraycopyRepMovsByteArrayThreshold();

// Byte array enhancement supports only 32 or 64 bytes
threshold = (newThreshold == 32) ? 32 : threshold;
threshold = (newThreshold == 64) ? 64 : threshold;
}
break;
}
Expand Down

0 comments on commit 82df57f

Please sign in to comment.