RFR: 8282722: Regard mapping array in enum switches as stable for constant folding
Joshua Zhu
jzhu at openjdk.java.net
Mon Mar 7 12:02:06 UTC 2022
On Mon, 7 Mar 2022 11:20:52 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
> Fix is checking an integer array field name starting with "$SwitchMap" to be marked as stable if it is decorated with ACC_STATIC | ACC_FINAL attributes. Wandering why is not being honored during constant folding currently.
"static final int[] $SwitchMap$xxx" does not mean elements in the array are immutable. Hence it is necessary to treat mapping array generated in enum switches as stable so that their elements can be constant-folded.
Please do not miss JVM_ACC_SYNTHETIC flag in this change.
"A field marked with the ACC_SYNTHETIC flag indicates that it was generated by a compiler and does not appear in source code."
-------------
PR: https://git.openjdk.java.net/jdk/pull/7721
More information about the hotspot-dev
mailing list