changeset 56633:92eec0732eed

8224853: CDS address sanitizer errors Reviewed-by: iklam, dholmes
author ngasson
date Tue, 04 Jun 2019 17:56:16 +0800
parents f74f0d3033a9
children 6502d6a92fe2
files src/hotspot/share/classfile/javaClasses.cpp src/hotspot/share/memory/iterator.hpp src/hotspot/share/memory/metaspaceShared.cpp src/hotspot/share/memory/metaspaceShared.hpp
diffstat 4 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/javaClasses.cpp	Wed Jun 05 22:19:09 2019 -0700
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Tue Jun 04 17:56:16 2019 +0800
@@ -198,7 +198,7 @@
 #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 @@
 
 #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);
--- a/src/hotspot/share/memory/iterator.hpp	Wed Jun 05 22:19:09 2019 -0700
+++ b/src/hotspot/share/memory/iterator.hpp	Tue Jun 04 17:56:16 2019 +0800
@@ -322,6 +322,9 @@
   // 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;
 
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Wed Jun 05 22:19:09 2019 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Tue Jun 04 17:56:16 2019 +0800
@@ -1935,6 +1935,11 @@
   *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();
--- a/src/hotspot/share/memory/metaspaceShared.hpp	Wed Jun 05 22:19:09 2019 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.hpp	Tue Jun 04 17:56:16 2019 +0800
@@ -125,6 +125,11 @@
     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 @@
 
   void do_u4(u4* p);
 
+  void do_bool(bool *p);
+
   void do_tag(int tag);
 
   void do_oop(oop *p);