8278568: Consolidate filler objects
Reviewed-by: tschatzl, mli, ayang
This commit is contained in:
parent
6412d57a0a
commit
abab1738a7
src/hotspot/share
@ -29,8 +29,6 @@
|
||||
#include "memory/universe.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
|
||||
size_t PSPromotionLAB::filler_header_size;
|
||||
|
||||
// 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
|
||||
@ -45,10 +43,6 @@ void PSPromotionLAB::initialize(MemRegion lab) {
|
||||
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) {
|
||||
@ -56,8 +50,8 @@ void PSPromotionLAB::initialize(MemRegion lab) {
|
||||
}
|
||||
|
||||
// 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;
|
||||
assert(lab.word_size() >= CollectedHeap::min_dummy_object_size(), "lab is too small");
|
||||
end = end - CollectedHeap::min_dummy_object_size();
|
||||
set_end(end);
|
||||
|
||||
_state = needs_flush;
|
||||
@ -81,20 +75,8 @@ void PSPromotionLAB::flush() {
|
||||
|
||||
// PLAB's never allocate the last aligned_header_size
|
||||
// so they can always fill with an array.
|
||||
HeapWord* tlab_end = end() + filler_header_size;
|
||||
typeArrayOop filler_oop = (typeArrayOop) cast_to_oop(top());
|
||||
filler_oop->set_mark(markWord::prototype());
|
||||
filler_oop->set_klass(Universe::intArrayKlassObj());
|
||||
const size_t array_length =
|
||||
pointer_delta(tlab_end, top()) - typeArrayOopDesc::header_size(T_INT);
|
||||
assert( (array_length * (HeapWordSize/sizeof(jint))) < (size_t)max_jint, "array too big in PSPromotionLAB");
|
||||
filler_oop->set_length((int)(array_length * (HeapWordSize/sizeof(jint))));
|
||||
|
||||
#ifdef ASSERT
|
||||
// Note that we actually DO NOT want to use the aligned header size!
|
||||
HeapWord* elt_words = cast_from_oop<HeapWord*>(filler_oop) + typeArrayOopDesc::header_size(T_INT);
|
||||
Copy::fill_to_words(elt_words, array_length, 0xDEAABABE);
|
||||
#endif
|
||||
HeapWord* tlab_end = end() + CollectedHeap::min_dummy_object_size();
|
||||
CollectedHeap::fill_with_object(top(), tlab_end, trueInDebug);
|
||||
|
||||
set_bottom(NULL);
|
||||
set_end(NULL);
|
||||
|
@ -39,8 +39,6 @@ class ObjectStartArray;
|
||||
|
||||
class PSPromotionLAB : public CHeapObj<mtGC> {
|
||||
protected:
|
||||
static size_t filler_header_size;
|
||||
|
||||
enum LabState {
|
||||
needs_flush,
|
||||
flushed,
|
||||
|
@ -493,10 +493,6 @@ void CollectedHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool
|
||||
CollectedHeap::fill_with_object(start, end, zap);
|
||||
}
|
||||
|
||||
size_t CollectedHeap::min_dummy_object_size() const {
|
||||
return oopDesc::header_size();
|
||||
}
|
||||
|
||||
size_t CollectedHeap::tlab_alloc_reserve() const {
|
||||
size_t min_size = min_dummy_object_size();
|
||||
return min_size > (size_t)MinObjAlignment ? align_object_size(min_size) : 0;
|
||||
|
@ -289,7 +289,10 @@ class CollectedHeap : public CHeapObj<mtInternal> {
|
||||
}
|
||||
|
||||
virtual void fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap);
|
||||
virtual size_t min_dummy_object_size() const;
|
||||
static constexpr size_t min_dummy_object_size() {
|
||||
return oopDesc::header_size();
|
||||
}
|
||||
|
||||
size_t tlab_alloc_reserve() const;
|
||||
|
||||
// Some heaps may offer a contiguous region for shared non-blocking
|
||||
|
@ -730,38 +730,6 @@ HeapWord* ContiguousSpace::par_allocate(size_t size) {
|
||||
return par_allocate_impl(size);
|
||||
}
|
||||
|
||||
void ContiguousSpace::allocate_temporary_filler(int factor) {
|
||||
// allocate temporary type array decreasing free size with factor 'factor'
|
||||
assert(factor >= 0, "just checking");
|
||||
size_t size = pointer_delta(end(), top());
|
||||
|
||||
// if space is full, return
|
||||
if (size == 0) return;
|
||||
|
||||
if (factor > 0) {
|
||||
size -= size/factor;
|
||||
}
|
||||
size = align_object_size(size);
|
||||
|
||||
const size_t array_header_size = typeArrayOopDesc::header_size(T_INT);
|
||||
if (size >= align_object_size(array_header_size)) {
|
||||
size_t length = (size - array_header_size) * (HeapWordSize / sizeof(jint));
|
||||
// allocate uninitialized int array
|
||||
typeArrayOop t = (typeArrayOop) cast_to_oop(allocate(size));
|
||||
assert(t != NULL, "allocation should succeed");
|
||||
t->set_mark(markWord::prototype());
|
||||
t->set_klass(Universe::intArrayKlassObj());
|
||||
t->set_length((int)length);
|
||||
} else {
|
||||
assert(size == CollectedHeap::min_fill_size(),
|
||||
"size for smallest fake object doesn't match");
|
||||
instanceOop obj = (instanceOop) cast_to_oop(allocate(size));
|
||||
obj->set_mark(markWord::prototype());
|
||||
obj->set_klass_gap(0);
|
||||
obj->set_klass(vmClasses::Object_klass());
|
||||
}
|
||||
}
|
||||
|
||||
void OffsetTableContigSpace::initialize_threshold() {
|
||||
_offsets.initialize_threshold();
|
||||
}
|
||||
|
@ -532,10 +532,6 @@ class ContiguousSpace: public CompactibleSpace {
|
||||
|
||||
// Debugging
|
||||
virtual void verify() const;
|
||||
|
||||
// Used to increase collection frequency. "factor" of 0 means entire
|
||||
// space.
|
||||
void allocate_temporary_filler(int factor);
|
||||
};
|
||||
|
||||
|
||||
|
@ -96,7 +96,7 @@ class oopDesc {
|
||||
static inline void set_klass_gap(HeapWord* mem, int z);
|
||||
|
||||
// size of object header, aligned to platform wordSize
|
||||
static int header_size() { return sizeof(oopDesc)/HeapWordSize; }
|
||||
static constexpr int header_size() { return sizeof(oopDesc)/HeapWordSize; }
|
||||
|
||||
// Returns whether this is an instance of k or an instance of a subclass of k
|
||||
inline bool is_a(Klass* k) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user