RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index [v5]

Chen Liang liach at openjdk.org
Wed Jul 17 14:17:52 UTC 2024


On Tue, 16 Jul 2024 03:10:29 GMT, Chen Liang <liach at openjdk.org> wrote:

>> The `@Stable` on the `index` field is incorrect, as stable only avoids inlining `0`. On a strategic view, this index field should just become final so that `Name` becomes eligible for value class migration once valhalla comes. This patch makes the `index` field final and updates the usages correspondingly.
>
> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update src/java.base/share/classes/java/lang/invoke/LambdaForm.java
>   
>   Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>

Another interesting aspect is the management of Name's index is purely up to LambdaForm itself: users who supply Names never have to set the index, but they know the indices will be valid once they get the Names from LF. I still think we can change it final so that we can just migrate it to be value classes, and by then whether we reallocate Name shouldn't matter any more.

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

PR Comment: https://git.openjdk.org/jdk/pull/20178#issuecomment-2233436802


More information about the core-libs-dev mailing list