RFR: 8283574: Use Klass::_id for type checks in the C++ code

Stefan Karlsson stefank at openjdk.java.net
Wed Mar 23 15:43:00 UTC 2022


We have at least three ways to check the type of a given Klass*:
1) Using the Klass::_id field
2) Using the layout helper
3) Using the InstanceKlass::_kind field

The Klass::_id field was something that was added when we rewrote the oop_oop_iterate dispatch mechanism, but the other mechanisms where left in place.

The current Loom code uses both (2) and (3) every time a the code checks if an object is of type InstanceStackChunkKlass. In the Loom repository I intend to reduce that check to be a single test against the (1) field. To keep the code unified, and simpler, I changed all C++ Klass type checks to use (1).

I propose that we upstream this change to the mainline, to slightly reduce the Loom diff.

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

Commit messages:
 - 8283574: Use Klass::_id for type checks in the C++ code

Changes: https://git.openjdk.java.net/jdk/pull/7922/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7922&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8283574
  Stats: 69 lines in 11 files changed: 4 ins; 29 del; 36 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7922.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7922/head:pull/7922

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


More information about the hotspot-dev mailing list