From 50c5fb834b62344ff91ea278fafd178eb5fb4dd4 Mon Sep 17 00:00:00 2001 From: Zoltan Majo Date: Tue, 24 May 2016 09:07:22 +0200 Subject: [PATCH] 8157560: Reserve space for allocation prefetch only in builds that support allocation prefetching Create the reserved area only in C2-enabled builds. Reviewed-by: kvn, thartmann --- .../src/share/vm/gc/shared/threadLocalAllocBuffer.cpp | 9 +++++++-- .../OptionsValidation/TestOptionsWithRanges.java | 8 -------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp index a9fb53f48bb..0df1ba020a2 100644 --- a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp +++ b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp @@ -216,8 +216,10 @@ void ThreadLocalAllocBuffer::startup_initialization() { _global_stats = new GlobalTLABStats(); - // Need extra space at the end of TLAB, otherwise prefetching - // instructions will fault (due to accessing memory outside of heap). +#ifdef COMPILER2 + // If the C2 compiler is present, extra space is needed at the end of + // TLABs, otherwise prefetching instructions generated by the C2 + // compiler 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 accommodate both types of allocations.) @@ -227,11 +229,14 @@ void ThreadLocalAllocBuffer::startup_initialization() { // AllocatePrefetchInstr==1). To be on the safe side, however, // extra space is reserved for all combinations of // AllocatePrefetchStyle and AllocatePrefetchInstr. + // + // If the C2 compiler is not present, no space is reserved. // +1 for rounding up to next cache line, +1 to be safe int lines = MAX2(AllocatePrefetchLines, AllocateInstancePrefetchLines) + 2; _reserve_for_allocation_prefetch = (AllocatePrefetchDistance + AllocatePrefetchStepSize * lines) / (int)HeapWordSize; +#endif // During jvm startup, the main (primordial) thread is initialized // before the heap is initialized. So reinitialize it now. diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java index 7da0e14c225..890ac26463d 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java @@ -89,14 +89,6 @@ public class TestOptionsWithRanges { */ excludeTestMaxRange("CICompilerCount"); - /* - * JDK-8156679 - * Temporarily exclude from range testing as the range is not - * valid for all platforms - */ - excludeTestRange("AllocatePrefetchLines"); - excludeTestRange("AllocateInstancePrefetchLines"); - /* * JDK-8136766 * Temporarily remove ThreadStackSize from testing because Windows can set it to 0