Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "utilities/copy.hpp"

size_t ThreadLocalAllocBuffer::_max_size = 0;
int ThreadLocalAllocBuffer::_reserve_for_allocation_prefetch = 0;
unsigned int ThreadLocalAllocBuffer::_target_refills = 0;

ThreadLocalAllocBuffer::ThreadLocalAllocBuffer() :
Expand Down Expand Up @@ -225,30 +224,6 @@ void ThreadLocalAllocBuffer::startup_initialization() {
// abort during VM initialization.
_target_refills = MAX2(_target_refills, 2U);

#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.)
//
// Only SPARC-specific BIS instructions are known to fault. (Those
// instructions are generated if AllocatePrefetchStyle==3 and
// 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
if (CompilerConfig::is_c2_or_jvmci_compiler_enabled()) {
int lines = MAX2(AllocatePrefetchLines, AllocateInstancePrefetchLines) + 2;
_reserve_for_allocation_prefetch = (AllocatePrefetchDistance + AllocatePrefetchStepSize * lines) /
(int)HeapWordSize;
}
#endif

// During jvm startup, the main thread is initialized
// before the heap is initialized. So reinitialize it now.
guarantee(Thread::current()->is_Java_thread(), "tlab initialization thread not Java thread");
Expand Down Expand Up @@ -454,8 +429,7 @@ void ThreadLocalAllocStats::publish() {
}

size_t ThreadLocalAllocBuffer::end_reserve() {
size_t reserve_size = CollectedHeap::lab_alignment_reserve();
return MAX2(reserve_size, (size_t)_reserve_for_allocation_prefetch);
return CollectedHeap::lab_alignment_reserve();
}

const HeapWord* ThreadLocalAllocBuffer::start_relaxed() const {
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class ThreadLocalAllocBuffer: public CHeapObj<mtThread> {
size_t _allocated_before_last_gc; // total bytes allocated up until the last gc

static size_t _max_size; // maximum size of any TLAB
static int _reserve_for_allocation_prefetch; // Reserve at the end of the TLAB
static unsigned _target_refills; // expected number of refills between GCs

unsigned _number_of_refills;
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/runtime/vmStructs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@
nonstatic_field(ThreadLocalAllocBuffer, _pf_top, HeapWord*) \
nonstatic_field(ThreadLocalAllocBuffer, _desired_size, size_t) \
nonstatic_field(ThreadLocalAllocBuffer, _refill_waste_limit, size_t) \
static_field(ThreadLocalAllocBuffer, _reserve_for_allocation_prefetch, int) \
static_field(ThreadLocalAllocBuffer, _target_refills, unsigned) \
nonstatic_field(ThreadLocalAllocBuffer, _number_of_refills, unsigned) \
nonstatic_field(ThreadLocalAllocBuffer, _refill_waste, unsigned) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ private long alignmentReserve() {

private long endReserve() {
long labAlignmentReserve = VM.getVM().getLabAlignmentReserve();
long reserveForAllocationPrefetch = VM.getVM().getReserveForAllocationPrefetch();
long heapWordSize = VM.getVM().getHeapWordSize();

return Math.max(labAlignmentReserve, reserveForAllocationPrefetch) * heapWordSize;
return labAlignmentReserve * heapWordSize;
}

/** Support for iteration over heap -- not sure how this will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public class VM {
private int invocationEntryBCI;
private ReversePtrs revPtrs;
private VMRegImpl vmregImpl;
private int reserveForAllocationPrefetch;
private int labAlignmentReserve;

// System.getProperties from debuggee VM
Expand Down Expand Up @@ -447,8 +446,6 @@ private VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian) {
boolType = (CIntegerType) db.lookupType("bool");

Type threadLocalAllocBuffer = db.lookupType("ThreadLocalAllocBuffer");
CIntegerField reserveForAllocationPrefetchField = threadLocalAllocBuffer.getCIntegerField("_reserve_for_allocation_prefetch");
reserveForAllocationPrefetch = (int)reserveForAllocationPrefetchField.getCInteger(intType);

Type collectedHeap = db.lookupType("CollectedHeap");
CIntegerField labAlignmentReserveField = collectedHeap.getCIntegerField("_lab_alignment_reserve");
Expand Down Expand Up @@ -915,10 +912,6 @@ public String getVMInternalInfo() {
return vmInternalInfo;
}

public int getReserveForAllocationPrefetch() {
return reserveForAllocationPrefetch;
}

public int getLabAlignmentReserve() {
return labAlignmentReserve;
}
Expand Down