RFR: 8256254: Convert vmIntrinsics::ID to enum class [v3]

Ioi Lam iklam at openjdk.java.net
Tue Dec 1 04:38:15 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`.

Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:

 - fixed merge
 - Merge branch 'master' into 8256254-vmintrinsics-id-class-enum
 - @cl4es reviews
 - 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=02
  Stats: 216 lines in 52 files changed: 92 ins; 17 del; 107 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