RFR: 8149365: memory copy does not prefetch on backwards copy

Edward Nevill edward.nevill at gmail.com
Mon Feb 8 14:37:26 UTC 2016


The following webrev


adds support for prefetch on backwards copies (previously prefetch was only done on forwards copies).

It also fixes a 'feature' where the command line option -XX:PrefetchCopyIntervalInBytes=N is ignored and the value 256 always used instead.

I have benchmarked it using the following test progam


Which allows you to test memory copies of different sizes from a start size to an end size in step units. The test does both backwards and forwards copies.


java ArrayCopyTest <iters> <start> <end> <step>

I have generated the results obtained before and after the above patch on 4 different partners HW (A,B,C,D) and a summary of the results is available at


For partner A I tested 3 ranges

0-64 bytes in units of 1
0-512 bytes in units of 8
0-4096 bytes in units of 64

The latter 2 clearly show the benefit of prefetching on backwards copies.

For partners B, C & D, I only tested 0-4096 bytes in units of 64. I also tested B, C & D with -XX:PrefetchCopyIntervalInBytes=0. On these 3 partners disabling prefetch seemed to have no effect indicating that either prefetch is not implemented, or it implements automatic hardware prefetch.

A summary of the results is that it improves performance significantly on partner A and has no effect on partners B,C & D.

OK to push?


More information about the hotspot-compiler-dev mailing list