RFR(XXS): 8229437: assert(is_aligned(ref, HeapWordSize)) failed: invariant

Markus Gronlund markus.gronlund at oracle.com
Wed Aug 14 09:41:45 UTC 2019


Greetings,

Please review this small change set.

Bug: https://bugs.openjdk.java.net/browse/JDK-822943 
Webrev: http://cr.openjdk.java.net/~mgronlun/8229437/webrev01/

Summary:
Refactoring as part of https://bugs.openjdk.java.net/browse/JDK-8214542 copied the alignment assertion to the target delegates do_root() member function. But this is too strong since encoded narrowOop* references also forwards into the same do_root() member function. 

The alignment assertions are (still) done inside the RootSetClosure before references are forwarded to delegates. Therefore we are not weakening validity checks by this change set.

Thanks
Markus

diff -r 807d192fb7dd -r 97a842e42b38 src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp
--- a/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp  Wed Aug 14 00:18:00 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/chains/bfsClosure.cpp  Wed Aug 14 11:20:25 2019 +0200
@@ -230,8 +230,6 @@

 void BFSClosure::do_root(const oop* ref) {
   assert(ref != NULL, "invariant");
-  assert(is_aligned(ref, HeapWordSize), "invariant");
-  assert(*ref != NULL, "invariant");
   if (!_edge_queue->is_full()) {
     _edge_queue->add(NULL, ref);
   }
diff -r 807d192fb7dd -r 97a842e42b38 src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp
--- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp  Wed Aug 14 00:18:00 2019 -0400
+++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp  Wed Aug 14 11:20:25 2019 +0200
@@ -178,8 +178,7 @@

 void DFSClosure::do_root(const oop* ref) {
   assert(ref != NULL, "invariant");
-  assert(is_aligned(ref, HeapWordSize), "invariant");
-  const oop pointee = *ref;
+  const oop pointee = UnifiedOop::dereference(ref);
   assert(pointee != NULL, "invariant");
   closure_impl(ref, pointee);
 }


More information about the hotspot-jfr-dev mailing list