< prev index next > src/hotspot/share/gc/shared/collectedHeap.cpp
Print this page
if (!is_in(object)) {
return false;
}
- if (is_in(object->klass_or_null())) {
- return false;
- }
-
return true;
}
// Memory state functions.
_gc_cause(GCCause::_no_gc),
_gc_lastcause(GCCause::_no_gc)
{
const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT));
const size_t elements_per_word = HeapWordSize / sizeof(jint);
- _filler_array_max_size = align_object_size(filler_array_hdr_size() +
- max_len / elements_per_word);
+ int header_size_in_bytes = arrayOopDesc::base_offset_in_bytes(T_INT);
+ assert(header_size_in_bytes % sizeof(jint) == 0, "must be aligned to int");
+ int header_size_in_ints = header_size_in_bytes / sizeof(jint);
+ _filler_array_max_size = align_object_size((header_size_in_ints + max_len) / elements_per_word);
NOT_PRODUCT(_promotion_failure_alot_count = 0;)
NOT_PRODUCT(_promotion_failure_alot_gc_number = 0;)
if (UsePerfData) {
// header_size + ((sizeof(jint) * max_jint) / HeapWordSize)
// we'll overflow on the multiply, so we do the divide first.
// We actually lose a little by dividing first,
// but that just makes the TLAB somewhat smaller than the biggest array,
// which is fine, since we'll be able to fill that.
- size_t max_int_size = typeArrayOopDesc::header_size(T_INT) +
+ int header_size_in_bytes = typeArrayOopDesc::base_offset_in_bytes(T_INT);
+ assert(header_size_in_bytes % sizeof(jint) == 0, "header size must align to int");
+ size_t max_int_size = header_size_in_bytes / HeapWordSize +
sizeof(jint) *
((juint) max_jint / (size_t) HeapWordSize);
return align_down(max_int_size, MinObjAlignment);
}
- size_t CollectedHeap::filler_array_hdr_size() {
- return align_object_offset(arrayOopDesc::header_size(T_INT)); // align to Long
- }
-
size_t CollectedHeap::filler_array_min_size() {
- return align_object_size(filler_array_hdr_size()); // align to MinObjAlignment
+ int aligned_header_size_words = align_up(arrayOopDesc::base_offset_in_bytes(T_INT), HeapWordSize) / HeapWordSize;
+ return align_object_size(aligned_header_size_words); // align to MinObjAlignment
}
#ifdef ASSERT
void CollectedHeap::fill_args_check(HeapWord* start, size_t words)
{
}
void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap)
{
if (ZapFillerObjects && zap) {
- Copy::fill_to_words(start + filler_array_hdr_size(),
- words - filler_array_hdr_size(), 0XDEAFBABE);
+ int payload_start = align_up(arrayOopDesc::base_offset_in_bytes(T_INT), HeapWordSize) / HeapWordSize;
+ Copy::fill_to_words(start + payload_start,
+ words - payload_start, 0XDEAFBABE);
}
}
#endif // ASSERT
void
CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap)
{
assert(words >= filler_array_min_size(), "too small for an array");
assert(words <= filler_array_max_size(), "too big for a single object");
- const size_t payload_size = words - filler_array_hdr_size();
- const size_t len = payload_size * HeapWordSize / sizeof(jint);
+ const size_t payload_size_bytes = words * HeapWordSize - arrayOopDesc::base_offset_in_bytes(T_INT);
+ assert(payload_size_bytes % sizeof(jint) == 0, "must be int aligned");
+ const size_t len = payload_size_bytes / sizeof(jint);
assert((int)len >= 0, "size too large " SIZE_FORMAT " becomes %d", words, (int)len);
ObjArrayAllocator allocator(Universe::intArrayKlassObj(), words, (int)len, /* do_zero */ false);
allocator.initialize(start);
DEBUG_ONLY(zap_filler_array(start, words, zap);)
< prev index next >