Anonymous value classes

forax at univ-mlv.fr forax at univ-mlv.fr
Sat Jun 4 09:33:51 UTC 2022


> From: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
> To: "Brian Goetz" <brian.goetz at oracle.com>, "Remi Forax" <forax at univ-mlv.fr>
> Cc: "daniel smith" <daniel.smith at oracle.com>, "valhalla-spec-experts"
> <valhalla-spec-experts at openjdk.java.net>
> Sent: Friday, June 3, 2022 8:18:44 PM
> Subject: Re: Anonymous value classes

> And `var` ?

> (but I agree this feels a niche)
in conjunction of anything like a VarHandle, a MethodHandle, a lambda, string concatenation, etc. 

Anyway, Brian spins it as we do not get full-flattening and that may be correct, but half-flattening (flattening on stack) is as important, 
there is a lot of libraries that have APIs using interfaces that are implemented by anonymous classes, the collection API is one of them, fluent loggers (anything fluent in fact) is another, and those will benefit to have better than escape analysis performance. 

For half-flattening, being monomorphic and a value-based class at a callsite is enough for the JITs, you do not have to have the precise concrete class name mentioned. 

> Maurizio
Rémi 

> On 03/06/2022 18:59, Brian Goetz wrote:

>> On 6/3/2022 1:39 PM, Remi Forax wrote:

>>>> From: "Brian Goetz" [ mailto:brian.goetz at oracle.com | <brian.goetz at oracle.com> ]
>>>> To: "daniel smith" [ mailto:daniel.smith at oracle.com | <daniel.smith at oracle.com>
>>>> ] , "valhalla-spec-experts" [ mailto:valhalla-spec-experts at openjdk.java.net |
>>>> <valhalla-spec-experts at openjdk.java.net> ]
>>>> Sent: Friday, June 3, 2022 6:21:26 PM
>>>> Subject: Re: Anonymous value classes

>>>> There is no chance to get any calling-convention optimization here, since the
>>>> concrete class name will not show up in any method descriptor (or preload
>>>> attribute). There is no chance to get any heap flattening here, since the
>>>> concrete class name will not show up in any field descriptor or `newarray`
>>>> operand.
>>> Nope, anonymous classes are anonymous only for Java not in the bytecode, by
>>> example

>> OK, correction: such a vanishingly microscopic chance as to be completely
>> ignorable :)


More information about the valhalla-spec-observers mailing list