RFR(L) 8227745: Enable Escape Analysis for better performance when debugging
richard.reingruber at sap.com
Tue Jul 16 17:23:15 UTC 2019
// repost including hotspot-compiler-dev at openjdk.java.net
Please review this implementation for the RFE to enable escape analysis when debugging.
In short the JVMTI implementation is changed to revert EA based optimizations
just before objects escape through JVMTI. At runtime there is no escape
information for each object in scope. Instead each scope is annotated, if
non-escaping objects exist and if some are passed as parameters. If a JVMTI
agent accesses a reference on stack, then the owning compiled frame C is
deoptimized, if any non-escaping object is in scope. Scalar replaced objects are
reallocated on the heap and objects with eliminated locking are relocked. This
is called "deoptimizing objects" for short.
If the agent accesses a reference in a callee frame of C and C is passing any
non-escaping object as argument then C and its objects are deoptimized as well.
Deoptimized objects are kept as deferred updates (preexisting
JavaThread::_deferred_locals_updates). Either all objects of a compiled frame
are deoptimized or none. It is annotated at the corresponding deferred updates
if it happened already in order to avoid doing it twice.
There is preexisting code to deoptimize objects when deoptimizing a compiled
frame. The code was extended to be able to deoptimize objects of a frame that is
not the top frame and to let another thread than the owning thread do it.
More information about the hotspot-runtime-dev