Summary
While migrating ObjectMonitor::_object
to OopStorage
, we are also
changing it from an oop to a weak handle. This change will have visible
effects on JVM/TI Heap Callback functions and the heap dump format.
Problem
As a weak handle, the reference in ObjectMonitor
will no longer be
considered a (strong) root so JVMTI_HEAP_REFERENCE_MONITOR
references will no longer be enumerated by JVM/TI Heap Callback
functions.
In addition, HPROF_GC_ROOT_MONITOR_USED
entries will no
longer be emitted in heap dumps.
Please note that the ObjectMonitor
is an implementation detail that is
only associated with an object in certain situations. Contended locking,
Object.wait()
and some hash code situations can cause an ObjectMonitor
to be associated with an object. It is possible in the current VM for no
ObjectMonitors
to be in use at a given point in time which means that the
JVM/TI Heap Callback function would have no JVMTI_HEAP_REFERENCE_MONITOR
references to enumerate and a heap dump would contain no
HPROF_GC_ROOT_MONITOR_USED
entries.
Solution
There is no "solution" as such. The change in the implementation simply results in a change in the observable behaviour.
Specification
No specification changes are planned since other VM implementations may continue to implement the oop in an ObjectMonitor as a (strong) root.
- csr of
-
JDK-8247281 migrate ObjectMonitor::_object to OopStorage
-
- Resolved
-