JDK-8230956 : Should disable Escape Analysis when JVMTI capability can_tag_objects is taken
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,12,13,14
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2019-09-13
  • Updated: 2019-11-26
  • Resolved: 2019-11-26
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 14
14Resolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
JVMTI provides functions to follow references beginning at the roots of the object graph and it
provides functions to iterate all objects on the heap[1][2]. These functions are means to access
objects which are otherwise local to a Java thread. In terms of escape analysis these local objects
escape through these JVMTI functions invalidating optimizations based on escape analysis. Agents are
required to possess the capability can_tag_objects in order to call the mentioned functions.

Example:

- Let J be a JavaThread that calls a compiled method M with a NoEscape instance I of class C that is
  scalar replaced.

- JVMTI agent A uses JVMTI FollowReferences() to iterate the objects in the object graph tagging all
  instances of C.

- A uses GetObjectsWithTags() to retrieve the tagged instances of C.

- Error: I is missing because its allocation was eliminated / scalar replaced.

Currently it is not possible to revert EA based optimizations just before objects escape through
JVMTI therefore escape analysis should be disabled as soon as the JVMTI capability can_tag_objects
is taken.

But this is not sufficient, because there may be compiled frames on stack with EA based
optimizations when a JVMTI agent takes can_tag_objects, and then it does not help to disable escape
analysis or invalidate compiled methods with ea based optimizations. In general it is still an
improvement to do so. JDK-8227745 would be a complete solution to the issue.

[1] https://docs.oracle.com/en/java/javase/11/docs/specs/jvmti.html#Heap
[2] https://docs.oracle.com/en/java/javase/11/docs/specs/jvmti.html#Heap_1_0

Comments
Thank you [~rrich] for confirming. Now closed as duplicate of 8233915.
26-11-2019

I think that would be ok. Should I do it?
26-11-2019

RFR thread - http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-September/035181.html Now do we need to close this JDK-8230956 as duplicate of JDK-8233915?
26-11-2019

http://cr.openjdk.java.net/~rrich/webrevs/2019/8230956/webrev.0/
13-09-2019

This bug was split off JDK-8227745 to make it smaller.
13-09-2019