On Thu, 16 Feb 2023 19:35:54 GMT, David M. Lloyd <d...@openjdk.org> wrote:

>> The class generated for lambda proxies is now defined as a hidden class. 
>> This means that the counter, which was used to ensure a unique class name 
>> and avoid clashes, is now redundant. In addition to performing redundant 
>> work, this also impacts build reproducibility for native image generators 
>> which might already have a strategy to cope with hidden classes but cannot 
>> cope with indeterminate definition order for lambda proxy classes.
>> 
>> This solves JDK-8292914 by making lambda proxy names always be stable 
>> without any configuration needed. This would also replace #10024.
>
> David M. Lloyd has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Use a unique index for the dumped lambda class instead of a time stamp

`this_class` in the classbyte is shown in the VM logging 
(`-Xlog:class+nestmates=debug`).  It'd be helpful if it can easily correlate to 
the dumped file.   For example, 3 lambda proxy classes of the same name of 
`this_class` but they are unique hidden classes.


0.058s][info ][class,nestmates] LookupDefineClass: 
jdk/internal/module/DefaultRoots$$Lambda$ - with dynamic nest-host 
jdk.internal.module.DefaultRoots, hidden, strong, with vm annotations
[0.058s][debug][class,nestmates] Dynamic nestmate: 
java.base/jdk.internal.module.DefaultRoots$$Lambda$/0x000000080000a970, 
nest_host jdk.internal.module.DefaultRoots, is hidden
[0.062s][info ][class,nestmates] LookupDefineClass: 
jdk/internal/module/DefaultRoots$$Lambda$ - with dynamic nest-host 
jdk.internal.module.DefaultRoots, hidden, strong, with vm annotations
[0.062s][debug][class,nestmates] Dynamic nestmate: 
java.base/jdk.internal.module.DefaultRoots$$Lambda$/0x000000080000b998, 
nest_host jdk.internal.module.DefaultRoots, is hidden
[0.068s][info ][class,nestmates] LookupDefineClass: 
jdk/internal/module/DefaultRoots$$Lambda$ - with dynamic nest-host 
jdk.internal.module.DefaultRoots, hidden, strong, with vm annotations
[0.068s][debug][class,nestmates] Dynamic nestmate: 
java.base/jdk.internal.module.DefaultRoots$$Lambda$/0x000000080000c0b0, 
nest_host jdk.internal.module.DefaultRoots, is hidden


What about keeping your original idea - the filename matching the hidden class 
name if successfully defined.   If it fails at `defineHiddenClass` time, use 
`lambdaClassName` + counter? 

Also, `test/jdk/java/lang/StackWalker/VerifyStackTrace.java` tests need update 
because of the lambda proxy class name change.

-------------

PR: https://git.openjdk.org/jdk/pull/12579

Reply via email to