This commit is contained in:
Jon Masamitsu 2013-02-04 12:51:25 -08:00
commit e13466742d
6 changed files with 48 additions and 22 deletions

View File

@ -467,7 +467,7 @@ public class ObjectHeap {
liveRegions.add(tlab.start());
liveRegions.add(tlab.start());
liveRegions.add(tlab.top());
liveRegions.add(tlab.end());
liveRegions.add(tlab.hardEnd());
}
}
}

View File

@ -27,6 +27,7 @@ package sun.jvm.hotspot.runtime;
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.types.*;
/** <P> ThreadLocalAllocBuffer: a descriptor for thread-local storage
@ -62,9 +63,22 @@ public class ThreadLocalAllocBuffer extends VMObject {
super(addr);
}
public Address start() { return startField.getValue(addr); }
public Address end() { return endField.getValue(addr); }
public Address top() { return topField.getValue(addr); }
public Address start() { return startField.getValue(addr); }
public Address end() { return endField.getValue(addr); }
public Address top() { return topField.getValue(addr); }
public Address hardEnd() { return end().addOffsetTo(alignmentReserve()); }
private long alignmentReserve() {
return Oop.alignObjectSize(endReserve());
}
private long endReserve() {
long minFillerArraySize = Array.baseOffsetInBytes(BasicType.T_INT);
long reserveForAllocationPrefetch = VM.getVM().getReserveForAllocationPrefetch();
long heapWordSize = VM.getVM().getHeapWordSize();
return Math.max(minFillerArraySize, reserveForAllocationPrefetch * heapWordSize);
}
/** Support for iteration over heap -- not sure how this will
interact with GC in reflective system, but necessary for the

View File

@ -114,6 +114,7 @@ public class VM {
private int invalidOSREntryBCI;
private ReversePtrs revPtrs;
private VMRegImpl vmregImpl;
private int reserveForAllocationPrefetch;
// System.getProperties from debuggee VM
private Properties sysProps;
@ -293,6 +294,10 @@ public class VM {
vmRelease = CStringUtilities.getString(releaseAddr);
Address vmInternalInfoAddr = vmVersion.getAddressField("_s_internal_vm_info_string").getValue();
vmInternalInfo = CStringUtilities.getString(vmInternalInfoAddr);
CIntegerType intType = (CIntegerType) db.lookupType("int");
CIntegerField reserveForAllocationPrefetchField = vmVersion.getCIntegerField("_reserve_for_allocation_prefetch");
reserveForAllocationPrefetch = (int)reserveForAllocationPrefetchField.getCInteger(intType);
} catch (Exception exp) {
throw new RuntimeException("can't determine target's VM version : " + exp.getMessage());
}
@ -778,6 +783,10 @@ public class VM {
return vmInternalInfo;
}
public int getReserveForAllocationPrefetch() {
return reserveForAllocationPrefetch;
}
public boolean isSharingEnabled() {
if (sharingEnabled == null) {
Flag flag = getCommandLineFlag("UseSharedSpaces");

View File

@ -571,19 +571,14 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) :
_sleep_factor = 0.0;
_marking_task_overhead = 1.0;
} else {
if (ConcGCThreads > 0) {
// notice that ConcGCThreads overwrites G1MarkingOverheadPercent
if (!FLAG_IS_DEFAULT(ConcGCThreads) && ConcGCThreads > 0) {
// Note: ConcGCThreads has precedence over G1MarkingOverheadPercent
// if both are set
_parallel_marking_threads = (uint) ConcGCThreads;
_max_parallel_marking_threads = _parallel_marking_threads;
_sleep_factor = 0.0;
_marking_task_overhead = 1.0;
} else if (G1MarkingOverheadPercent > 0) {
// we will calculate the number of parallel marking threads
// based on a target overhead with respect to the soft real-time
// goal
// We will calculate the number of parallel marking threads based
// on a target overhead with respect to the soft real-time goal
double marking_overhead = (double) G1MarkingOverheadPercent / 100.0;
double overall_cm_overhead =
(double) MaxGCPauseMillis * marking_overhead /
@ -596,17 +591,22 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) :
double sleep_factor =
(1.0 - marking_task_overhead) / marking_task_overhead;
_parallel_marking_threads = (uint) marking_thread_num;
_max_parallel_marking_threads = _parallel_marking_threads;
FLAG_SET_ERGO(uintx, ConcGCThreads, (uint) marking_thread_num);
_sleep_factor = sleep_factor;
_marking_task_overhead = marking_task_overhead;
} else {
_parallel_marking_threads = scale_parallel_threads((uint)ParallelGCThreads);
_max_parallel_marking_threads = _parallel_marking_threads;
// Calculate the number of parallel marking threads by scaling
// the number of parallel GC threads.
uint marking_thread_num = scale_parallel_threads((uint) ParallelGCThreads);
FLAG_SET_ERGO(uintx, ConcGCThreads, marking_thread_num);
_sleep_factor = 0.0;
_marking_task_overhead = 1.0;
}
assert(ConcGCThreads > 0, "Should have been set");
_parallel_marking_threads = (uint) ConcGCThreads;
_max_parallel_marking_threads = _parallel_marking_threads;
if (parallel_marking_threads() > 1) {
_cleanup_task_overhead = 1.0;
} else {

View File

@ -1737,10 +1737,10 @@ void SpaceManager::get_initial_chunk_sizes(Metaspace::MetaspaceType type,
*class_chunk_word_size = ClassSmallChunk;
break;
}
assert(chunk_word_size != 0 && class_chunk_word_size != 0,
assert(*chunk_word_size != 0 && *class_chunk_word_size != 0,
err_msg("Initial chunks sizes bad: data " SIZE_FORMAT
" class " SIZE_FORMAT,
chunk_word_size, class_chunk_word_size));
*chunk_word_size, *class_chunk_word_size));
}
size_t SpaceManager::sum_free_in_chunks_in_use() const {
@ -2040,7 +2040,7 @@ SpaceManager::~SpaceManager() {
align_size_up(humongous_chunks->word_size(),
HumongousChunkGranularity),
err_msg("Humongous chunk size is wrong: word size " SIZE_FORMAT
" granularity " SIZE_FORMAT,
" granularity %d",
humongous_chunks->word_size(), HumongousChunkGranularity));
Metachunk* next_humongous_chunks = humongous_chunks->next();
chunk_manager->humongous_dictionary()->return_chunk(humongous_chunks);
@ -2264,7 +2264,8 @@ void SpaceManager::verify_allocation_total() {
}
MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
assert(allocation_total() == sum_used_in_chunks_in_use(),
err_msg("allocation total is not consistent %d vs %d",
err_msg("allocation total is not consistent " SIZE_FORMAT
" vs " SIZE_FORMAT,
allocation_total(), sum_used_in_chunks_in_use()));
}
@ -2578,7 +2579,8 @@ void Metaspace::global_initialize() {
// argument passed in is at the top of the compressed space
void Metaspace::initialize_class_space(ReservedSpace rs) {
// The reserved space size may be bigger because of alignment, esp with UseLargePages
assert(rs.size() >= ClassMetaspaceSize, err_msg("%d != %d", rs.size(), ClassMetaspaceSize));
assert(rs.size() >= ClassMetaspaceSize,
err_msg(SIZE_FORMAT " != " UINTX_FORMAT, rs.size(), ClassMetaspaceSize));
_class_space_list = new VirtualSpaceList(rs);
}

View File

@ -1161,6 +1161,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
static_field(Abstract_VM_Version, _vm_major_version, int) \
static_field(Abstract_VM_Version, _vm_minor_version, int) \
static_field(Abstract_VM_Version, _vm_build_number, int) \
static_field(Abstract_VM_Version, _reserve_for_allocation_prefetch, int) \
\
static_field(JDK_Version, _current, JDK_Version) \
nonstatic_field(JDK_Version, _partially_initialized, bool) \