On Tue, 16 Jul 2024 00:39:19 GMT, ExE Boss <d...@openjdk.org> wrote: >> Chen Liang has updated the pull request incrementally with four additional >> commits since the last revision: >> >> - Make LambdaForm.Name index final >> - Revert "8335922: Incorrect stable usage of LambdaForm$Name.index" >> >> This reverts commit 7d111ba3655c4c282399a4793e2cf5d91618432f. >> - Revert "We have sufficient space in short, use +1 offset" >> >> This reverts commit 0743c5f924fa07ea13f8545604f870091fa8d23a. >> - Revert "Encapsulate offsetIndex, share computation result" >> >> This reverts commit db805834d7117e5752bebcbd671afa6c85ff2cf0. > > src/java.base/share/classes/java/lang/invoke/LambdaForm.java line 1388: > >> 1386: Name withIndex(int i) { >> 1387: return new Name(i, type, function, arguments, constraint); >> 1388: } > > Maybe also do what `Name::withConstraint(Object)` does? > Suggestion: > > Name withIndex(int i) { > if (i == this.index) return this; > return new Name(i, type, function, arguments, constraint); > }
Sure, initIndex and newIndex reuses same index object too. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20178#discussion_r1678694062