8224853: CDS address sanitizer errors

Reviewed-by: iklam, dholmes
This commit is contained in:
Nick Gasson 2019-06-04 17:56:16 +08:00
parent c66a7b734b
commit 72daa46d46
4 changed files with 17 additions and 2 deletions

View File

@ -198,7 +198,7 @@ void java_lang_String::compute_offsets() {
#if INCLUDE_CDS
void java_lang_String::serialize_offsets(SerializeClosure* f) {
STRING_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
f->do_u4((u4*)&initialized);
f->do_bool(&initialized);
}
#endif
@ -1566,7 +1566,7 @@ void java_lang_Class::compute_offsets() {
#if INCLUDE_CDS
void java_lang_Class::serialize_offsets(SerializeClosure* f) {
f->do_u4((u4*)&offsets_computed);
f->do_bool(&offsets_computed);
f->do_u4((u4*)&_init_lock_offset);
CLASS_FIELDS_DO(FIELD_SERIALIZE_OFFSET);

View File

@ -322,6 +322,9 @@ public:
// Read/write the 32-bit unsigned integer pointed to by p.
virtual void do_u4(u4* p) = 0;
// Read/write the bool pointed to by p.
virtual void do_bool(bool* p) = 0;
// Read/write the region specified.
virtual void do_region(u_char* start, size_t size) = 0;

View File

@ -1935,6 +1935,11 @@ void ReadClosure::do_u4(u4* p) {
*p = (u4)(uintx(obj));
}
void ReadClosure::do_bool(bool* p) {
intptr_t obj = nextPtr();
*p = (bool)(uintx(obj));
}
void ReadClosure::do_tag(int tag) {
int old_tag;
old_tag = (int)(intptr_t)nextPtr();

View File

@ -125,6 +125,11 @@ public:
do_ptr(&ptr);
}
void do_bool(bool *p) {
void* ptr = (void*)(uintx(*p));
do_ptr(&ptr);
}
void do_tag(int tag) {
_dump_region->append_intptr_t((intptr_t)tag);
}
@ -154,6 +159,8 @@ public:
void do_u4(u4* p);
void do_bool(bool *p);
void do_tag(int tag);
void do_oop(oop *p);