Hidden classes + class data

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Dec 2 15:50:27 UTC 2019


On 27/11/2019 01:30, Mandy Chung wrote:
>
>
> On 11/26/19 4:55 PM, John Rose wrote:
>> On Nov 26, 2019, at 3:03 PM, forax at univ-mlv.fr wrote:
>>> I wonder if defineHiddenClassWithClassData should not take another 
>>> class as parameter instead of a byte array (using the byte array of 
>>> that class) enabling more sharing of the bytecode and allowing to do 
>>> the  verification only once if defineHiddenClassWithClassData is 
>>> called several times with the same Class.
>> Yes.  I’d like to try this with templates, when we get them, since
>> templates are supposed to share metadata with their species.
>>
>> E.g., for a lambda form of a predefined shape with 2 free variables
>> (a type and a MH), define it as a template with those parameters
>> and inject it as many times as you see distinct combinations of
>> those parameters.
>
> This produces a distinct Class mirror for each hidden class defined 
> from the same metadata (class bytes) with a different class data.
>
> Perhaps we can experiment ClassDefiner builder-like API.   I will 
> explore this.

In the MVT Valhalla prototype we used to have a way to obtain a method 
handle using a 'method builder' (from the bytecode API used there). I 
think it should be possible to do the same, using a 'class builder' - so 
that you can actually define the contents of the class w/o specifying a 
byte array, down to the code attribute level. In other words, there is a 
big overlap with what you call a 'ClassDefiner' builder and the builders 
provided by the bytecode API under exploration, so I think it'd be best 
to try and avoid to solve the same problem twice.

Maurizio

>
> Mandy


More information about the valhalla-dev mailing list