JDK-8230677 : Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,12,13,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2019-09-05
  • Updated: 2022-06-27
  • Resolved: 2019-10-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.7-oracleFixed 13.0.4Fixed 14 b18Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The JVMTI functions GetOwnedMonitorInfo() and GetOwnedMonitorStackDepthInfo() can be used to
retrieve objects locked by a thread. In terms of escape analysis those references escape and
optimizations like scalar replacement become invalid.

The runtime currently does not revert optimizations based on escape analysis before objects escape
through JVMTI (try included tests). Therefore escape analysis should be disabled if an agent
requests the capabilities can_get_owned_monitor_info or can_get_owned_monitor_stack_depth_info.

can_get_owned_monitor_info and can_get_owned_monitor_stack_depth_info are both OnLoad capabilities
that cannot be changed once the VM is executing the Java program.

With JDK-8227745 escape analysis can remain enabled.
Comments
Fix request (13u): The change applies cleanly.
28-05-2020

Fix request (11u) I would like to downport this for parity with 11.0.7-oracle. Applies clean.
03-01-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/5185bc8dcbb1 User: rrich Date: 2019-10-09 08:27:51 +0000
09-10-2019

There's an ongoing discussion if JVMTI GetOwnedMonitorInfo() should report eliminated locking. It begins about here [1] in the thread [2] for the webrev I posted [3]. [1] Discussion about visibility of eliminated locking: https://mail.openjdk.java.net/pipermail/serviceability-dev/2019-September/029224.html [2] Full webrev thread: https://mail.openjdk.java.net/pipermail/serviceability-dev/2019-September/029061.html [3] Webrev for this bug: http://cr.openjdk.java.net/~rrich/webrevs/2019/8230677/webrev.0/
23-09-2019

ILW = Escape analysis incorrectly treats objects as non-escaping (although they can be accessed through JVMTI), with JVMTI, disable escape analysis = HLM = P3
06-09-2019

Okay, got it. Thanks for the clarification.
06-09-2019

Hi Tobias, Vladimir Kozlov suggested to do so. He wrote: "I think you should push cases when we should disable EA (ciEnv::jvmti_state_changed()) as separate bug." https://bugs.openjdk.java.net/browse/JDK-8227745?focusedCommentId=14282931&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14282931 Cheers, Richard.
06-09-2019

Why is this still needed with JDK-8227745?
06-09-2019