Using a Condy instead of a Constant_Utf8

Remi Forax forax at univ-mlv.fr
Wed Dec 2 10:53:55 UTC 2020


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.

This is related to Lazy static final field [1] 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.

Rémi

[1] https://bugs.openjdk.java.net/browse/JDK-8209964



More information about the valhalla-spec-observers mailing list