RFR: 8267321: Use switch expression for VarHandle$AccessMode lookup
Using a switch expression instead of a (read-only) static `HashMap` reduces initialization overhead of `VarHandle$AccessMode`. This gets loaded earlier after JDK-8265079, so it started showing up in a few lambda startup tests. This also obsoletes a jtreg test that only verified that this map was optimally sized. ------------- Commit messages: - Remove obsolete test - Transform AccessMode name map into switch expression Changes: https://git.openjdk.java.net/jdk/pull/4102/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4102&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8267321 Stats: 90 lines in 2 files changed: 31 ins; 56 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/4102.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/4102/head:pull/4102 PR: https://git.openjdk.java.net/jdk/pull/4102
On Tue, 18 May 2021 20:59:49 GMT, Claes Redestad <redestad@openjdk.org> wrote:
Using a switch expression instead of a (read-only) static `HashMap` reduces initialization overhead of `VarHandle$AccessMode`. This gets loaded earlier after JDK-8265079, so it started showing up in a few lambda startup tests.
This also obsoletes a jtreg test that only verified that this map was optimally sized.
LGTM. I assume existing tests verify that all values of the enum are covered by the switch? ------------- Marked as reviewed by jvernee (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/4102
On Wed, 19 May 2021 14:31:48 GMT, Jorn Vernee <jvernee@openjdk.org> wrote:
LGTM. I assume existing tests verify that all values of the enum are covered by the switch?
Thanks! Yes, the method with the switch is called when linking a VH, and the tests should be exhaustive in that regard. ------------- PR: https://git.openjdk.java.net/jdk/pull/4102
On Tue, 18 May 2021 20:59:49 GMT, Claes Redestad <redestad@openjdk.org> wrote:
Using a switch expression instead of a (read-only) static `HashMap` reduces initialization overhead of `VarHandle$AccessMode`. This gets loaded earlier after JDK-8265079, so it started showing up in a few lambda startup tests.
This also obsoletes a jtreg test that only verified that this map was optimally sized.
This pull request has now been integrated. Changeset: 9760dba7 Author: Claes Redestad <redestad@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/9760dba71c07cf7b0df16590b3e84e23ad58... Stats: 90 lines in 2 files changed: 31 ins; 56 del; 3 mod 8267321: Use switch expression for VarHandle$AccessMode lookup Reviewed-by: jvernee ------------- PR: https://git.openjdk.java.net/jdk/pull/4102
participants (2)
-
Claes Redestad
-
Jorn Vernee