[aarch64-port-dev ] RFR(s): AArch64: 8149080: Recoginize disjoint array copy in stub code
Edward Nevill
edward.nevill at gmail.com
Mon Feb 8 08:39:00 UTC 2016
On Sat, 2016-02-06 at 19:52 +0800, Hui Shi wrote:
> Code sequence for backward and forward array copy is almost same except prefetch. Performance test is based on http://cr.openjdk.java.net/~hshi/8149080/testcase/StringConcatTest.java run with "java StringConcatTest 5000". I tried disabling prefetch and compare performance between backward and forward array copy (all
Hi,
How did you disable the prefetch? Did you use -XX:PrefetchCopyIntervalInBytes=0?
There is a bug/feature in vm_version_aarch64.cpp where it does
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 256);
overwriting any previous value, whereas it should do
if (FLAG_IS_DEFAULT(PrefetchCopyIntervalInBytes))
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 256);
> 1. Forward array copy can prefetch dest address needed in next string append.
>
> Most string append/concatenation operations will append chars after early appened char arrays.
> For example, str = str1 + str2 + str3
> 1. when append str1 in forward order, result value array(str.value) will be prefetched beyond str1's length with hardware prefetcher
> 2. when store str2.value into str.value, str.value is already prefetched, less cache miss when copy str2.value into str.value
> If copy in backward order, after copy str1.value into str.value, it's address before str.value[0] get prefetched, this is not useful for next append.
I assume you are talking about automatic hardware prefetching here since the SW implementation does not do any prefetching on the destination? In that case I can see how repeated forward copys may be more efficient for string concatenation.
All the best,
Ed.
More information about the aarch64-port-dev
mailing list