本文整理汇总了C++中MemRegion::word_size方法的典型用法代码示例。如果您正苦于以下问题:C++ MemRegion::word_size方法的具体用法?C++ MemRegion::word_size怎么用?C++ MemRegion::word_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemRegion
的用法示例。
在下文中一共展示了MemRegion::word_size方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fill_region_with_object
void SharedHeap::fill_region_with_object(MemRegion mr) {
// Disable allocation events, since this isn't a "real" allocation.
JVMPIAllocEventDisabler dis;
size_t word_size = mr.word_size();
size_t aligned_array_header_size =
align_object_size(typeArrayOopDesc::header_size(T_INT));
if (word_size >= aligned_array_header_size) {
const size_t array_length =
pointer_delta(mr.end(), mr.start()) -
typeArrayOopDesc::header_size(T_INT);
const size_t array_length_words =
array_length * (HeapWordSize/sizeof(jint));
post_allocation_setup_array(Universe::intArrayKlassObj(),
mr.start(),
mr.word_size(),
(int)array_length_words);
#ifdef ASSERT
HeapWord* elt_words = (mr.start() + typeArrayOopDesc::header_size(T_INT));
Memory::set_words(elt_words, array_length, 0xDEAFBABE);
#endif
} else {
assert(word_size == (size_t)oopDesc::header_size(), "Unaligned?");
post_allocation_setup_obj(SystemDictionary::object_klass(),
mr.start(),
mr.word_size());
}
}
示例2: initialize
// This is the shared initialization code. It sets up the basic pointers,
// and allows enough extra space for a filler object. We call a virtual
// method, "lab_is_valid()" to handle the different asserts the old/young
// labs require.
void PSPromotionLAB::initialize(MemRegion lab) {
assert(lab_is_valid(lab), "Sanity");
HeapWord* bottom = lab.start();
HeapWord* end = lab.end();
set_bottom(bottom);
set_end(end);
set_top(bottom);
// We can be initialized to a zero size!
if (free() > 0) {
if (ZapUnusedHeapArea) {
debug_only(Memory::set_words(top(), free()/HeapWordSize, badHeapWord));
}
// NOTE! We need to allow space for a filler object.
assert(lab.word_size() >= filler_header_size, "lab is too small");
end = end - filler_header_size;
set_end(end);
_state = needs_flush;
} else {
_state = zero_size;
}
assert(this->top() <= this->end(), "pointers out of order");
}
示例3: rs
G1BlockOffsetSharedArray::G1BlockOffsetSharedArray(MemRegion reserved,
size_t init_word_size) :
_reserved(reserved), _end(NULL)
{
size_t size = compute_size(reserved.word_size());
ReservedSpace rs(ReservedSpace::allocation_align_size_up(size));
if (!rs.is_reserved()) {
vm_exit_during_initialization("Could not reserve enough space for heap offset array");
}
if (!_vs.initialize(rs, 0)) {
vm_exit_during_initialization("Could not reserve enough space for heap offset array");
}
_offset_array = (u_char*)_vs.low_boundary();
resize(init_word_size);
if (TraceBlockOffsetTable) {
gclog_or_tty->print_cr("G1BlockOffsetSharedArray::G1BlockOffsetSharedArray: ");
gclog_or_tty->print_cr(" "
" rs.base(): " INTPTR_FORMAT
" rs.size(): " INTPTR_FORMAT
" rs end(): " INTPTR_FORMAT,
rs.base(), rs.size(), rs.base() + rs.size());
gclog_or_tty->print_cr(" "
" _vs.low_boundary(): " INTPTR_FORMAT
" _vs.high_boundary(): " INTPTR_FORMAT,
_vs.low_boundary(),
_vs.high_boundary());
}
}
示例4: initialize
// This is the shared initialization code. It sets up the basic pointers,
// and allows enough extra space for a filler object. We call a virtual
// method, "lab_is_valid()" to handle the different asserts the old/young
// labs require.
void PSPromotionLAB::initialize(MemRegion lab) {
assert(lab_is_valid(lab), "Sanity");
HeapWord* bottom = lab.start();
HeapWord* end = lab.end();
set_bottom(bottom);
set_end(end);
set_top(bottom);
// Initialize after VM starts up because header_size depends on compressed
// oops.
filler_header_size = align_object_size(typeArrayOopDesc::header_size(T_INT));
// We can be initialized to a zero size!
if (free() > 0) {
if (ZapUnusedHeapArea) {
debug_only(Copy::fill_to_words(top(), free()/HeapWordSize, badHeapWord));
}
// NOTE! We need to allow space for a filler object.
assert(lab.word_size() >= filler_header_size, "lab is too small");
end = end - filler_header_size;
set_end(end);
_state = needs_flush;
} else {
_state = zero_size;
}
assert(this->top() <= this->end(), "pointers out of order");
}
示例5: rs
BlockOffsetSharedArray::BlockOffsetSharedArray(MemRegion reserved,
size_t init_word_size):
_reserved(reserved), _end(NULL)
{
size_t size = compute_size(reserved.word_size());
ReservedSpace rs(size);
if (!rs.is_reserved()) {
vm_exit_during_initialization("Could not reserve enough space for heap offset array");
}
MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
if (!_vs.initialize(rs, 0)) {
vm_exit_during_initialization("Could not reserve enough space for heap offset array");
}
_offset_array = (u_char*)_vs.low_boundary();
resize(init_word_size);
if (TraceBlockOffsetTable) {
gclog_or_tty->print_cr("BlockOffsetSharedArray::BlockOffsetSharedArray: ");
gclog_or_tty->print_cr(" "
" rs.base(): " INTPTR_FORMAT
" rs.size(): " INTPTR_FORMAT
" rs end(): " INTPTR_FORMAT,
rs.base(), rs.size(), rs.base() + rs.size());
gclog_or_tty->print_cr(" "
" _vs.low_boundary(): " INTPTR_FORMAT
" _vs.high_boundary(): " INTPTR_FORMAT,
_vs.low_boundary(),
_vs.high_boundary());
}
}
示例6: mangle_region
// Simply mangle the MemRegion mr.
void SpaceMangler::mangle_region(MemRegion mr) {
assert(ZapUnusedHeapArea, "Mangling should not be in use");
#ifdef ASSERT
if(TraceZapUnusedHeapArea) {
gclog_or_tty->print("Mangling [" PTR_FORMAT " to " PTR_FORMAT ")", p2i(mr.start()), p2i(mr.end()));
}
Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord);
if(TraceZapUnusedHeapArea) {
gclog_or_tty->print_cr(" done");
}
#endif
}
示例7: bits_required
inline ParMarkBitMap::idx_t
ParMarkBitMap::bits_required(MemRegion covered_region)
{
return bits_required(covered_region.word_size());
}
示例8: mangle_region
void ContiguousSpace::mangle_region(MemRegion mr) {
debug_only(Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord));
}