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 customer 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
// 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.
Posted Date : 2007-01-22 19:35:48.0