JDK-7118863 : Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs23
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-12-07
  • Updated: 2012-03-29
  • Resolved: 2012-03-29
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 7 JDK 8 Other
7u4Fixed 8Fixed hs23Fixed
The *Klass::*_offset_in_bytes() functions are used to get the offset to a field in a Klass. All places where they are used, we add something like sizeof(klassOopDesc) to make the offset against the klassOopDesc instead.

For example in opto/memnode.cpp:
 if (tkls->offset() == Klass::access_flags_offset_in_bytes() + (int)sizeof(oopDesc)) {

There's a couple of variants to this:
 instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc)
 Klass::access_flags_offset_in_bytes() + (int)sizeof(oopDesc)
 Klass::secondary_supers_offset_in_bytes() + klassOopDesc::header_size() * HeapWordSize
 Klass::java_mirror_offset_in_bytes() klassOopDesc::klass_part_offset_in_bytes()

The proposal is to move all these size adjustments into the *Klass:*_offset_in_bytes() functions.

EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/069ab3f976d3

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/069ab3f976d3