JDK-8007320 : NPG: move method annotations
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-01-31
  • Updated: 2014-06-26
  • Resolved: 2013-02-11
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 8 Other
8Fixed hs25Fixed
Related Reports
Relates :  
Relates :  
Description
This is related to 8003419.   The annotations are allocated in Metaspace during class file parsing and pointers to them are carried around through the parser.   In order to clean these up, you'd have to have collect these pointers somewhere so they can be cleaned up if the parse fails.

Instead, attach method annotations to the constMethod so that they can be cleaned up if/when the ConstMethod is cleaned up.

If any annotations exists for any method, an Array<u1> is created for that method, but it's put into an Array<Array<u1>*> (an array of these arrays) where there's an entry for each method in the klass, so the other methods would have a pointer allocated for it whether needed or not.   There are 3 of these array of arrays in the type Annotations, and an Annotations* object for type annotations, which are so far created infrequently.

The fix is to move the 4 types of method annotations to embedded pointers in the ConstMethod if they are needed and add a flag to indicate whether they are present.   You could embed the annotations directly, but the length has to be pulled out as an 'int' from unaligned storage, and the bit math is getting to be too fragile without a redesign.

The real purpose of this change is to make the annotations allocated in Metaspace easier to find and clean up if class file parsing fails.