JDK-6516018 : simplify object layout calculations to enable faster reflection
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-01-22
  • Updated: 2013-11-01
  • Resolved: 2007-02-17
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 6 JDK 7 Other
6u4Fixed 7Fixed hs10Fixed
Related Reports
Duplicate :  
Relates :  
We want to intrinsify (open-code) certain reflective operations, notably metadata queries and heap allocation routines in java.lang.reflect.Array and java.lang.Class.  They are used in many components of modern Java-based systems.  In order to do this, some small cleanups and extensions are needed in src/share/vm/oops/.

We will remove these fields, used for ad hoc optimizations:

We will add these fields, which subsume and extend the previous fields with no loss of performance:

The component_mirror and array_klass fields are a bi-directional link between each array klass and the java.lang.Class mirror for the array component type.  They enable optimizable open-coding for the native method java.lang.Class.getComponentType and java.lang.reflect.Array.newInstance.  They work like the pre-existing pair of fields, Klass::java_mirror and java_lang_Class::klass, which are also a bi-directional link.

Relevant comments from klass.hpp:
// The "layout helper" is a combined descriptor of object layout.
// For klasses which are neither instance nor array, the value is zero.
// For instances, layout helper is a positive number, the instance size.
// This size is already passed through align_object_size and scaled to bytes.
// The low order bit is set if instances of this class cannot be
// allocated using the fastpath.
// For arrays, layout helper is a negative number, containing four
// distinct bytes, as follows:
//    MSB:[tag, ebt, hsz, log2(esz)]:LSB
// where:
//    tag is 0x80 if the elements are non-oops, 0xC0 if oops
//    ebt is the BasicType of the elements
//    esz is the element size in bytes
//    hsz is array header size in bytes (i.e., offset of first element)
// This packed word is arranged so as to be quickly unpacked by the
// various fast paths that use the various subfields.

SUGGESTED FIX http://prt-web.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2007/20070202000636.jrose.dolphin-reflection/workspace/webrevs/webrev-2007.02.02/index.html

EVALUATION yes, done