On Mon, 2 Feb 2026 12:10:48 GMT, Damon Fenacci <[email protected]> wrote:

>> src/hotspot/share/opto/opaquenode.hpp line 150:
>> 
>>> 148:   bool _constant;
>>> 149:  public:
>>> 150:   OpaqueConstantBoolNode(Compile* C, Node* tst, bool constant) : 
>>> Node(nullptr, tst), _constant(constant) {
>> 
>> An alternative would be to have the `constant` be an actual input node 
>> instead of a field. In macro expansion, you could then do 
>> `_igvn.replace_node(n, n->in(2));` instead (maybe define an enum for the 
>> input indices). I don't have a strong opinion on this though and leave it up 
>> to you to decide 🙂
>
> Cool trick! 😃... but now I can't decide between the two 😆 @chhagedorn do you 
> fancy being the tiebreaker?

The old `Opaque4` nodes used to have two data inputs where the second one was 
the replacement. I found it a little harder to view graphs in IGV with one more 
input. You also do not need to worry about trying to understand what the second 
input means. So, I would rather have a field if I may break the tie but both 
options are fine :-)

When going with a field, you could add a

NOT_PRODUCT(void dump_spec(outputStream* st) const);

that prints `#true` or `#false` depending on `_constant` (that could also then 
be shown in IGV with the "Show custom node info").

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2754324868

Reply via email to