JDK-8140685 : Fix backtrace building to not rely on constant pool merging
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-10-28
  • Updated: 2021-07-05
  • Resolved: 2017-02-01
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 10
10 b21Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The java backtrace that we create for exceptions has now mirror, method-id, version, bci and cpref.  The cpref (constant pool index of the Method name) is dependent on constant pool merging during redefinition, since the cpref doesn't change with new versions of the Klass.

Rather than saving the cpref, save the Symbol* instead. This Symbol* is stored in the constant pool for the class also.  Because of constant pool merging the Symbol* will always be in the constant pool, without constant pool merging it will also be in the constant pool but not necessarily at the same offset.  In the case of private or static (final) methods that can be deleted, the symbol can be added to the new unmerged constant pool.

This change removes the requirement that the Method name's constant pool index remain at the same offset in the constant pool.

The refcounting for Symbols* is done when the JVM_CONSTANT_Utf8 entry is added to the constant pool, and decremented when the constant pool is deallocated, either when the class is redefined or when the class is unloaded.  The mirror in the backtrace keeps the class from being unloaded.  The latest version of the class then has the Symbol* in it with a positive refcount.