RFR: 8286190: Add test to verify constant folding for Enum fields

Aleksey Shipilev shade at openjdk.java.net
Thu May 5 13:42:42 UTC 2022


There is the [JDK-8161245](https://bugs.openjdk.java.net/browse/JDK-8161245) to make compilers trust Enum final fields. It was implicitly implemented by [JDK-8234049](https://bugs.openjdk.java.net/browse/JDK-8234049), which added the wildcard trust for everything in java/lang:
  https://github.com/openjdk/jdk/blob/c5a0687f80367a3a284dfd56781c371826264d3b/src/hotspot/share/ci/ciField.cpp#L230

It would be better to have the explicit test that verifies the constant folding of Enum fields indeed happens.

Additional testing:
 - [x] Linux x86_64 fastdebug, new test passes
 - [x] Linux x86_64 release, new test passes
 - [x] Linux x86_32 fastdebug, new test passes

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

Commit messages:
 - Fix

Changes: https://git.openjdk.java.net/jdk/pull/8551/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8551&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8286190
  Stats: 70 lines in 1 file changed: 70 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8551.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8551/head:pull/8551

PR: https://git.openjdk.java.net/jdk/pull/8551


More information about the hotspot-compiler-dev mailing list