RFR: 8256254: Convert vmIntrinsics::ID to enum class

Ioi Lam iklam at openjdk.java.net
Mon Nov 16 22:14:09 UTC 2020


This PR is follows the same style as https://github.com/openjdk/jdk/pull/276, except this time I am converting `vmIntrinsics::ID` to `vmIntrinsicID`:

* Convert `vmIntrinsics::SID` to `enum class` to provide better type safety.
* Also, put this enum class in the top level, so it can be forward-declared. I.e., `enum class vmIntrinsicID : int;`. This avoids excessive inclusion of vmIntrinsics.hpp and vmSymbols.hpp (which were included indirectly by almost every hotspot source files).
  * vmIntrinsics.hpp: was included 805 times, now included 414 times
  * vmSymbols.hpp:  was included 805 times, now include 394 times
  * Note: more #include reduction will be done in [JDK-8256424](https://bugs.openjdk.java.net/browse/JDK-8256424)

Many files are changed, but most of them are minor
* Added missing dependencies of vmSymbols.hpp and/or vmIntrinsics.hpp
* safe conversion between vmIntrinsicID and integer types (see comments around `vmIntrinsics::as_int()`)

Since we have a lot of references like `vmIntrinsics::_invokeGeneric`, I added aliases like

static const vmIntrinsicID vmIntrinsics::_invokeGeneric = vmIntrinsicID::_invokeGeneric

so we don't need to change over a thousand `vmIntrinsics::XXX` to `vmIntrinsicID::XXX`.

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

Commit messages:
 - 8256254: Convert vmIntrinsics::ID to enum class

Changes: https://git.openjdk.java.net/jdk/pull/1237/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1237&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8256254
  Stats: 213 lines in 51 files changed: 91 ins; 16 del; 106 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1237.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1237/head:pull/1237

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


More information about the hotspot-dev mailing list