RFR: 8292153: x86: Represent Registers as values

Vladimir Ivanov vlivanov at openjdk.org
Wed Aug 10 00:55:16 UTC 2022


As of now, Registers of all sorts use pointer-based representation. It's error-prone, because compilers perform implicit conversions between pointers and integral values. Also, it constraints `MacroAssembler` API where it may introduce ambiguity between overloads.

Proposed change hides pointer representation behind value class.

Pointer-based representation is kept to avoid massive migration of users (from `->` to `.`) and to enable incremental migration on per-platform basis (pointer-based representation is assumed in shared code).

Code quality doesn't suffer (and even slightly improves):
  https://godbolt.org/z/d8dGM1eY1

(I noticed one downside: slowdebug builds become slower, because `operator->` isn't inlined there. If it becomes a problem, migrating performance-sensitive places from `->` to `.` should solve the problem.)

Testing: hs-tier1 - hs-tier5

PS: a number of cleanups are incorporated. In particular, I decided to expand all macros from `register.hpp` because IMO they add confusion rather than improve readability.

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

Commit messages:
 - x86: Register class wrappers

Changes: https://git.openjdk.org/jdk/pull/9815/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9815&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8292153
  Stats: 557 lines in 28 files changed: 153 ins; 89 del; 315 mod
  Patch: https://git.openjdk.org/jdk/pull/9815.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9815/head:pull/9815

PR: https://git.openjdk.org/jdk/pull/9815


More information about the shenandoah-dev mailing list