On Sat, 21 Nov 2026 03:33:37 GMT, Vladimir Ivanov <[email protected]> wrote:

> You lost me here. How can we fall back to a more conservative result if the 
> previous result was already observed by the compiler?

The result has been computed for `A`, not `C`. The key here is that the 
computation of `C` can contradict the computation of an unrelated class `A`.

> But can we just return an unloaded ciKlass when asked (and possibly 
> proactively mark compilation as failing)? The compiler already has to account 
> for similar situation when handling not-yet-linked bytecodes. Parser inserts 
> an uncommon trap and eagerly prunes the path.

That may be possible. One difficulty is that the `ciInstanceKlass` is created 
at `ci`, not at C2, `ci` does not really care about CHA consistency, only C2 
does. Another difficulty is that there are many places where we may fail but 
`ci` does not expect to fail there. For example, loading the profile of a 
method can fail because it create `ciInstanceKlass` for classes appearing in 
the profile. Previously, I experimented with failing the `ciEnv` when 
encountering CHA inconsistency, but I gave up because `ciEnv` does not expect 
to fail from a call to `ciEnv::get_instance_klass`. So, I changed to the 
current design where `ciEnv` sets `paradoxical_hierarchy` and only C2 checks 
that flag.

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

PR Comment: https://git.openjdk.org/jdk/pull/33753#issuecomment-7057049072

Reply via email to