RFR: 8260368: [PPC64] GC interface needs enhancement to support GCs with load barriers
Niklas Radomski
github.com+9200663+quaffel at openjdk.java.net
Mon Feb 1 20:15:40 UTC 2021
On Mon, 1 Feb 2021 19:48:21 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
>> Hi Roman,
>> enum type works. We only don't want to use C++11 features like enum class or typed enums because we will probably backport this change to 11u.
>
> IOW, can we write MacroAssembler::RuntimeInvocationPreservationLevel instead of unsigned int there or not? I believe this should be possible (even though it'll still only be treated by the compiler as an int)
Yes, that should be totally fine.
As a site note: The compiler's behavior isn't well-defined, though. It could be `unsigned int`, `int`, or any other integral type that can represent the enumerators (that is not bigger than `unsigned int`). I'm not a huge fan of _potentially_ using signed integers for enum and/or flag-like parameters, but as an enum _does_ increase the code's readability and ultimately the developer experience by a lot, we should probably use that instead. Typed enums would have been perfect here, but Martin has already pointed out why that isn't an option.
The true reason why I didn't use an enum in the first place, however, is a different one: I originally intended to implement a flag-like mechanism. As it turns out, that is an absolute overkill as the different preservation levels are incremental. Since then, I haven't touched the types, so yeah...
TL;DR: Good catch, will change it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2302
More information about the hotspot-dev
mailing list