RFR: 8356328: Some C2 IR nodes miss size_of() function [v5]
Aleksey Shipilev
shade at openjdk.org
Mon May 19 09:36:00 UTC 2025
On Fri, 16 May 2025 05:12:38 GMT, kuaiwei <duke at openjdk.org> wrote:
>> I wrote a test to check if every C2 IR node has correct size_of() function. And I found some of them are missed. They added new fields and not add size_of() to reflect new size. In linux, it does not cause issue so far, because gcc allocate more space for alignment and can keep these additional `bool` flags. But it will report failure on windows. And if anyone modified base class, it will cause problem.
>>
>> PS, My test is in https://github.com/openjdk/jdk/compare/master...kuaiwei:jdk:test/check_node_size , but it has many hack on IR nodes to make test to run.
>
> kuaiwei has updated the pull request incrementally with one additional commit since the last revision:
>
> Minor change
Post-review comment: Doesn't this mean that super-class `Node::size_of` gives us a wrong answer for any node that has its own fields?
uint Node::size_of() const { return sizeof(*this); }
So, this looks mechanically preventable by making `Node::size_of` pure virtual, and thus _forcing_ subclasses to implement its own `size_of`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25081#issuecomment-2890328747
More information about the hotspot-compiler-dev
mailing list