RFR: Remove unnecessary write-barrier

Roman Kennke rkennke at redhat.com
Mon Mar 19 13:36:12 UTC 2018


There's no need to do a WB before wrapping something in a handle. Quite
the contrary: it misleads to assume it's safe to use when unwrapping
(which is not the case). Barriers should always be done at the
unwrapping site, or rather, when it's used. Which should generally be
done by the accessors in oop.hpp.

diff --git a/src/hotspot/share/services/threadService.cpp
b/src/hotspot/share/services/threadService.cpp
--- a/src/hotspot/share/services/threadService.cpp
+++ b/src/hotspot/share/services/threadService.cpp
@@ -166,7 +166,6 @@
     // If obj == NULL, then ObjectMonitor is raw which doesn't count.
   }

-  obj = BarrierSet::barrier_set()->write_barrier(obj);
   Handle h(Thread::current(), obj);
   return h;
 }


The only user of this method in the same file doesn't seem to do
anything that requires an extra WB.

Ok?

Roman



More information about the shenandoah-dev mailing list