JDK-8297830 : aarch64: Make Address a discriminated union internally
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • CPU: aarch64
  • Submitted: 2022-11-30
  • Updated: 2022-12-05
  • Resolved: 2022-12-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 masterFixed
Related Reports
Relates :  
Relates :  
Description
The aarch64 Address class is effectively a discriminated union.  The _mode member provides the kind.  However, it currently implements this by having all of the members needed for the various kinds, leaving members unrelated to the mode uninitialized or initialized to dummy values.

One problem with this is that under some circumstances this might lead to accessing uninitialized data, such as when copying an Address object (which happens a lot because they are typically passed by value, which might be considered a separate problem).

Another problem is that because unused members are always present, allocation and copying are slower than they might otherwise be.  (This is probably in the noise for performance, and the copy cost would be substantially mitigated by passing Address objects by const reference rather than by value.)

This is blocking a possible approach to resolving JDK-8160404, which triggered gcc warnings about such uninitialized accesses when copying Address objects.

Comments
Changeset: 5a5ced3a Author: Kim Barrett <kbarrett@openjdk.org> Date: 2022-12-01 20:15:14 +0000 URL: https://git.openjdk.org/jdk/commit/5a5ced3a900a81fd0b0757017f4138ce97e2521e
01-12-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11429 Date: 2022-11-30 11:13:35 +0000
30-11-2022