Convert vmSymbols::SID to enum class to provide better type safety.
Also implement proper enumerators for this type of enums to avoid code like this (which might get out of bounds if you're not careful):
for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
vm_symbol_index[index] = (SID)index;
}
The new iteration style is:
for (vmSymbolID index : vmSymbolsIterator()) {
vm_symbol_index[as_int(index)] = index;
}
Also, implement type-safe casting from ints to SIDs, and vice versa.
Also implement proper enumerators for this type of enums to avoid code like this (which might get out of bounds if you're not careful):
for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
vm_symbol_index[index] = (SID)index;
}
The new iteration style is:
for (vmSymbolID index : vmSymbolsIterator()) {
vm_symbol_index[as_int(index)] = index;
}
Also, implement type-safe casting from ints to SIDs, and vice versa.
- relates to
-
JDK-8243066 move VM_INTRINSICS_DO into its own vmIntrinsics.hpp file
- Resolved
-
JDK-8247938 Change various JVM enums like LinkInfo::AccessCheck and Klass::DefaultsLookupMode to enum class
- Resolved
-
JDK-8256254 Convert vmIntrinsics::ID to enum class
- Resolved
-
JDK-8254733 HotSpot Style Guide should permit using range-based for loops
- Resolved
-
JDK-8257912 Convert enum iteration to use range-based for loops
- Resolved
(2 links to)