8279534: Consolidate and remove oopDesc::klass_gap methods

Reviewed-by: shade, dholmes
This commit is contained in:
Roman Kennke 2022-01-24 11:16:53 +00:00
parent f05ff99654
commit afd2805ef2
3 changed files with 5 additions and 15 deletions

View File

@ -1943,12 +1943,12 @@ run:
Copy::fill_to_words(result + hdr_size, obj_size - hdr_size, 0);
}
oop obj = cast_to_oop(result);
// Initialize header, mirrors MemAllocator.
oopDesc::set_mark(result, markWord::prototype());
oopDesc::set_klass_gap(result, 0);
oopDesc::release_set_klass(result, ik);
// Initialize header
obj->set_mark(markWord::prototype());
obj->set_klass_gap(0);
obj->set_klass(ik);
oop obj = cast_to_oop(result);
// Must prevent reordering of stores for object initialization
// with stores that publish the new object.

View File

@ -91,8 +91,6 @@ class oopDesc {
static inline void release_set_klass(HeapWord* mem, Klass* k);
// For klass field compression
inline int klass_gap() const;
inline void set_klass_gap(int z);
static inline void set_klass_gap(HeapWord* mem, int z);
// size of object header, aligned to platform wordSize

View File

@ -125,20 +125,12 @@ void oopDesc::release_set_klass(HeapWord* mem, Klass* k) {
}
}
int oopDesc::klass_gap() const {
return *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes());
}
void oopDesc::set_klass_gap(HeapWord* mem, int v) {
if (UseCompressedClassPointers) {
*(int*)(((char*)mem) + klass_gap_offset_in_bytes()) = v;
}
}
void oopDesc::set_klass_gap(int v) {
set_klass_gap((HeapWord*)this, v);
}
bool oopDesc::is_a(Klass* k) const {
return klass()->is_subtype_of(k);
}