RFR: 8317697: refactor-encapsulate x86 VM_Version::CpuidInfo [v2]

Jan Kratochvil jkratochvil at openjdk.org
Mon Oct 23 06:30:38 UTC 2023


On Mon, 23 Oct 2023 06:01:36 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Jan Kratochvil has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Make CpuidInfo a class
>>  - Merge branch 'master' into flagsencaps
>>  - 8317697: refactor-encapsulate x86 VM_Version::CpuidInfo
>
> src/hotspot/cpu/x86/vm_version_x86.hpp line 527:
> 
>> 525:   };
>> 526: 
>> 527:   class CpuidInfo : public _CpuidInfo {
> 
> Why not just declare the original `CpuidInfo` as a class instead of extending the struct ???

This way the members are always zero-initialized. Which simplifies existing code

-VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, };
+VM_Version::CpuidInfo VM_Version::_cpuid_info;

And makes it more foolproof - therefore also fixing an existing bug (I haven't been aware of so far) in my code in the [CRaC](https://openjdk.org/projects/crac/) branch.

Although the ` = { 0, }` initialization above was not needed as it is a static member anyway.

That means I should change the name of this patch as it is no longer just a "refactor"-ization. Or should I remove the zero-initialization?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16093#discussion_r1368180078


More information about the hotspot-dev mailing list