RFR: 8283740: C1: Convert flag TwoOperandLIRForm to a constant on all platforms
Tobias Hartmann
thartmann at openjdk.org
Fri Dec 16 09:38:14 UTC 2022
On Wed, 14 Dec 2022 12:51:58 GMT, Damon Fenacci <duke at openjdk.org> wrote:
> The _TwoOperandLIRForm_ flag (LIR requires src1 and dst to match in binary LIR ops) can be set at runtime but each platform defines a default value that is the only one accepted. Although some platform could theoretically support both, there is no realistic scenario for this.
> The flag is removed in favour of a constant. This is defined as enum and its assigned value is defined in the platform-specific def.
That looks good to me but I think all these platform dependent constants should be converted to `static const` declarations at some point. From what I understand, enums are used here only [for historical reasons](https://stackoverflow.com/questions/899917/why-do-people-use-enums-in-c-as-constants-while-they-can-use-const). Could you file a follow-up RFE to investigate?
And FTR:
Due to bugs in certain (very old) compilers, there is widespread use of enums and avoidance of in-class initialization of static integral constant members. Compilers having such bugs are no longer supported. Except where an enum is semantically appropriate, new code should use integral constants.
https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md
-------------
Marked as reviewed by thartmann (Reviewer).
PR: https://git.openjdk.org/jdk/pull/11671
More information about the hotspot-dev
mailing list