Valhalla EG minutes 6/21/17

Paul Sandoz paul.sandoz at oracle.com
Fri Jul 7 00:37:57 UTC 2017


> On 6 Jul 2017, at 15:58, John Rose <john.r.rose at oracle.com> wrote:
> 
> On Jul 6, 2017, at 1:02 PM, Paul Sandoz <paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>> wrote:
>> 
>> In terms of what we have today we could easily do:
>> 
>>  // lookup must have private access to the lookup class, which becomes the “host” class
>>  Class<?> defineAnonymousClass(byte[] data)
>> 
>> is that ending gaining too much?
> 
> Sure, that's OK, or else an 'isAnonymous' optional argument.
> The difficult part here is specifying exactly what is a "host class".
> 

Agreed, that’s the tricky bit.


>> That still leaves the possibility of another method in the future say:
>> 
>>  Class<?> defineClass(boolean isAnon, byte[] data, Object constant)
>> 
>> That’s a little fuzzy since it’s not clear to me how the generated class locates the constant (synthetic static final field of known name? substitute the last entry in the CP if appropriately defined in the class bytes as substitutable?).
> 
> On Jul 6, 2017, at 1:12 PM, Remi Forax <forax at univ-mlv.fr <mailto:forax at univ-mlv.fr>> wrote:
>> 
>> Lookup.getConstant() with a private Lookup ?
> 
> Exactly, an ad hoc API point like that.  Would fit nicely with a BSM and
> CONSTANT_ConstantDynamic and ldc.  Or a private static final and
> code in <clinit>.

I like that.

Perhaps those associated constants could be squirrelled away in a ClassValue, and any class could participate and receive an ad-hoc constant.


> 
> If you need several of them, a Map<String,Object> would be your
> friend.  This doesn't need to be baked into the Lookup API, just a
> design pattern, supported nicely by a slightly different BSM.
> 

And there could be a condy for extracting a value for a given key from the Map constant.

Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/valhalla-spec-experts/attachments/20170706/cbb9d778/attachment.html>


More information about the valhalla-spec-experts mailing list