What's in a CONSTANT_Class?
john.r.rose at oracle.com
Fri Jun 9 02:09:25 UTC 2017
On Jun 8, 2017, at 5:00 PM, Dan Smith <daniel.smith at oracle.com> wrote:
> Some initial notes below attempting to flesh out what our two long-term options look like.
I like both of your sketches.
I think we should also try this variation: CONSTANT_Class is legacy only.
That way folks won't encounter CONSTANT_Class as a False Friend,
as they encounter it in new CP structures.
It is *neither* mainly a file nor mainly a type, but only a legacy abbreviation.
For loading a class file we have CONSTANT_ClassFile and for naming
a class type we have CONSTANT_ClassType (and the other types of 1).
The legacy meaning of CONSTANT_Class is retained, but the preferred
translation of "String.class" is ldc[CONSTANT_ClassType['L',CFS]] where
CFS is CONSTANT_ClassFile[Utf8["java/lang/String]].
An object string field is getfield[CONSTANT_Fieldref[ClassType['L',...],
The stringy type descriptors are tucked away inside C_NameAndType.
I guess it's sufficient to say that the second component of C_NAT
preferentially points at a C_XType (for X in Primitive, Class, Array,
Species) but may also point at legacy Utf8. The Utf8 semantics
could be defined by expansion to hypothetical CP entries (a point
you already made).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the valhalla-spec-experts