Using a Condy instead of a Constant_Utf8
daniel.smith at oracle.com
Wed Dec 2 15:35:06 UTC 2020
> On Dec 2, 2020, at 3:53 AM, Remi Forax <forax at univ-mlv.fr> wrote:
> Using a condy that returns a String instead of a method descriptor in the bytecode ?
> I'm currently trying to remove the uses of Unsafe.defineAnonymousClass to use Lookup.defineHiddenClass instead.
> There is one case where i dynamically patch a method descriptor so I can select how many arguments will be sent to a closure,
> i.e. in the bytecode i put all arguments on the stack but because i've patched the callee descriptor, only some of them will be used.
> I see defineAnonymousClass has a way to push data to a template class file and defineHiddenClass has a way to pull the data from the template class file.
> But i can not currently pull data that will be used by a NameAndType info because the descriptor_index has to be a Constant_Utf8 index and can not be a condy with a String as descriptor.
The trouble I see with changing NameAndType is that verification needs a static string. At that stage, it's too early to be resolving condys.
> This is related to Lazy static final field  and also to class templating in general because it equivalent to seeing all the template holes as condy even if it"s less efficient because you need to duplicate the whole constant pool.
Lazy static fields, if I understand the proposal correctly, use a condy to determine the _value_ of the field, but not its _type_. Linkage behavior is unchanged.
Similarly, our preferred story for templating right now is to use normal Utf8 strings for descriptors, and give each species different side-channel type information, computed via condy. This side information is needed fairly early, but verification is entirely descriptor-string-based.
More information about the valhalla-spec-observers