8153292: AllocateInstancePrefetchLines>AllocatePrefetchLines can trigger out-of-heap prefetching
authorzmajo
Thu, 21 Apr 2016 09:21:48 +0200
changeset 38054 3a22f46fb514
parent 38053 e6efb2c54538
child 38056 033ebbb3746e
8153292: AllocateInstancePrefetchLines>AllocatePrefetchLines can trigger out-of-heap prefetching Summary: Set the size of the reserved TLAB area to the MAX of both flags. Reviewed-by: kvn, thartmann
hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Wed Apr 20 20:40:46 2016 +0300
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu Apr 21 09:21:48 2016 +0200
@@ -112,11 +112,14 @@
         FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
       }
       if (AllocatePrefetchInstr == 1) {
-        // Need a space at the end of TLAB for BIS since it
-        // will fault when accessing memory outside of heap.
+        // Need extra space at the end of TLAB for BIS, otherwise prefetching
+        // instructions will fault (due to accessing memory outside of heap).
+        // The amount of space is the max of the number of lines to
+        // prefetch for array and for instance allocations. (Extra space must be
+        // reserved to accomodate both types of allocations.)
 
         // +1 for rounding up to next cache line, +1 to be safe
-        int lines = AllocatePrefetchLines + 2;
+        int lines = MAX2(AllocatePrefetchLines, AllocateInstancePrefetchLines) + 2;
         int step_size = AllocatePrefetchStepSize;
         int distance = AllocatePrefetchDistance;
         _reserve_for_allocation_prefetch = (distance + step_size*lines)/(int)HeapWordSize;