On Tue, 20 Jan 2026 09:06:27 GMT, Volkan Yazici <[email protected]> wrote:
>> It is true that they do pretty much the same thing ("avoid" C2 optimisations
>> for checks) but I'd argue they are semantically slightly different: one
>> prevents optimisations where we know the value cannot be null, the other
>> where we know the value is in range. We could actually have only one class
>> (e.g. with a `positive` flag like before) but I'm not sure it would be a
>> cleaner/nicer solution. 🤔
>
> Fair enough — I was just curious.
I was about to ask the same question. It seems like both `OpaqueNotNullNode`
and `OpaqueGuardNode` behave the same apart from eventually folding to a false
or true constant. They might have slightly different reasons for adding them
but AFAIU, they are both intended to keep control and data in sync. Apart from
duplicating most of the logic and comments, an additional challenge with having
both nodes is that we need to special case both nodes at various points in the
code which makes it more complex and raises the question if we could really
observe them both or not (would not be a problem when only having one node
type).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2731057975