Draft JEP Announcement: "Computed Constants"

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Jul 28 16:28:38 UTC 2023


On 28/07/2023 17:25, Maurizio Cimadamore wrote:
>
> On 28/07/2023 17:21, Brian Goetz wrote:
>> (a MH overload factory is entirely reasonable.) 
>
> This was also what I was tinkering with when thinking about Dan's 
> question.

Hit send too fast. There's other avenues to explore to. For instance, 
lambdas that have same signature and captured state might be able to 
share the same class (e.g. by accepting a MH as construction parameter 
and stashing it in a private "trusted" final field). This should deliver 
footprint savings not just for computed constants, but for all 
lambda-heavy APIs (e.g. classfile API, streams). That said, pulling that 
off, and in a way that doesn't break C2 optimizations might be hard (I'd 
suspect that each lambda having its distinct nominal class gives C2 a 
lot of room to speculate).

Maurizio

>
> Maurizio
>


More information about the leyden-dev mailing list