8272343: Remove MetaspaceClosure::FLAG_MASK
Reviewed-by: ccheung, minqi
This commit is contained in:
parent
fecefb8541
commit
32048536e9
@ -115,20 +115,16 @@ public:
|
|||||||
_builder(builder), _dumped_obj(dumped_obj), _start_idx(start_idx) {}
|
_builder(builder), _dumped_obj(dumped_obj), _start_idx(start_idx) {}
|
||||||
|
|
||||||
bool do_bit(BitMap::idx_t bit_offset) {
|
bool do_bit(BitMap::idx_t bit_offset) {
|
||||||
uintx FLAG_MASK = 0x03; // See comments around MetaspaceClosure::FLAG_MASK
|
|
||||||
size_t field_offset = size_t(bit_offset - _start_idx) * sizeof(address);
|
size_t field_offset = size_t(bit_offset - _start_idx) * sizeof(address);
|
||||||
address* ptr_loc = (address*)(_dumped_obj + field_offset);
|
address* ptr_loc = (address*)(_dumped_obj + field_offset);
|
||||||
|
|
||||||
uintx old_p_and_bits = (uintx)(*ptr_loc);
|
address old_p = *ptr_loc;
|
||||||
uintx flag_bits = (old_p_and_bits & FLAG_MASK);
|
|
||||||
address old_p = (address)(old_p_and_bits & (~FLAG_MASK));
|
|
||||||
address new_p = _builder->get_dumped_addr(old_p);
|
address new_p = _builder->get_dumped_addr(old_p);
|
||||||
uintx new_p_and_bits = ((uintx)new_p) | flag_bits;
|
|
||||||
|
|
||||||
log_trace(cds)("Ref: [" PTR_FORMAT "] -> " PTR_FORMAT " => " PTR_FORMAT,
|
log_trace(cds)("Ref: [" PTR_FORMAT "] -> " PTR_FORMAT " => " PTR_FORMAT,
|
||||||
p2i(ptr_loc), p2i(old_p), p2i(new_p));
|
p2i(ptr_loc), p2i(old_p), p2i(new_p));
|
||||||
|
|
||||||
ArchivePtrMarker::set_and_mark_pointer(ptr_loc, (address)(new_p_and_bits));
|
ArchivePtrMarker::set_and_mark_pointer(ptr_loc, new_p);
|
||||||
return true; // keep iterating the bitmap
|
return true; // keep iterating the bitmap
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -29,9 +29,7 @@
|
|||||||
void MetaspaceClosure::Ref::update(address new_loc) const {
|
void MetaspaceClosure::Ref::update(address new_loc) const {
|
||||||
log_trace(cds)("Ref: [" PTR_FORMAT "] -> " PTR_FORMAT " => " PTR_FORMAT,
|
log_trace(cds)("Ref: [" PTR_FORMAT "] -> " PTR_FORMAT " => " PTR_FORMAT,
|
||||||
p2i(mpp()), p2i(obj()), p2i(new_loc));
|
p2i(mpp()), p2i(obj()), p2i(new_loc));
|
||||||
uintx p = (uintx)new_loc;
|
*addr() = new_loc;
|
||||||
p |= flag_bits(); // Make sure the flag bits are copied to the new pointer.
|
|
||||||
*(address*)mpp() = (address)p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceClosure::push_impl(MetaspaceClosure::Ref* ref) {
|
void MetaspaceClosure::push_impl(MetaspaceClosure::Ref* ref) {
|
||||||
|
@ -128,10 +128,7 @@ public:
|
|||||||
virtual ~Ref() {}
|
virtual ~Ref() {}
|
||||||
|
|
||||||
address obj() const {
|
address obj() const {
|
||||||
// In some rare cases we store some flags in the lowest 2 bits of a
|
return *addr();
|
||||||
// MetaspaceObj pointer. Unmask these when manipulating the pointer.
|
|
||||||
uintx p = (uintx)*mpp();
|
|
||||||
return (address)(p & (~FLAG_MASK));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
address* addr() const {
|
address* addr() const {
|
||||||
@ -147,14 +144,6 @@ public:
|
|||||||
void* user_data() { return _user_data; }
|
void* user_data() { return _user_data; }
|
||||||
void set_next(Ref* n) { _next = n; }
|
void set_next(Ref* n) { _next = n; }
|
||||||
Ref* next() const { return _next; }
|
Ref* next() const { return _next; }
|
||||||
|
|
||||||
private:
|
|
||||||
static const uintx FLAG_MASK = 0x03;
|
|
||||||
|
|
||||||
int flag_bits() const {
|
|
||||||
uintx p = (uintx)*mpp();
|
|
||||||
return (int)(p & FLAG_MASK);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user