mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
Improve allocation prefetching. Reviewed-by: kvn
This commit is contained in:
parent
3a358f4cff
commit
413417522f
11 changed files with 73 additions and 104 deletions
|
@ -36,6 +36,7 @@
|
|||
|
||||
// static member initialization
|
||||
size_t ThreadLocalAllocBuffer::_max_size = 0;
|
||||
int ThreadLocalAllocBuffer::_reserve_for_allocation_prefetch = 0;
|
||||
unsigned ThreadLocalAllocBuffer::_target_refills = 0;
|
||||
GlobalTLABStats* ThreadLocalAllocBuffer::_global_stats = NULL;
|
||||
|
||||
|
@ -215,6 +216,23 @@ 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).
|
||||
// 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.
|
||||
|
||||
// +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;
|
||||
|
||||
// During jvm startup, the main (primordial) thread is initialized
|
||||
// before the heap is initialized. So reinitialize it now.
|
||||
guarantee(Thread::current()->is_Java_thread(), "tlab initialization thread not Java thread");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue