On Fri, 17 Apr 2026 16:44:33 GMT, Quan Anh Mai <[email protected]> wrote:
> Hi, > > The reason for the failure is that, we separately compute the instance type > `type`, which is used in the assert, and the klass type `klass_type`, which > is used for the check cast, so there is a chance during the computation of > `type`, the class has only 1 single concrete subclass, and before the > computation of `klass_type`, another subtype is loaded, leading to > `klass_type` being the supertype of `type`, which triggers the assert. > Computing these 2 in the opposite order likely does not work, either, because > we can have concurrent class unloading. > > As a result, in this PR, I reworked `check_interpreter_type` to receive a > `ciType`, this also helps simplify the implementation, as previously, we > needed to obtain the null restriction and larval-ness of the value > indirectly, while they are readily available in the `ciType` obtained from > `ciTypeFlow`. Trying to keep the assert for every case is cumbersome, and > verifying the type right after the check cast seems unnecessary, so I relaxed > the assert to only verify the correct kind of value. > > Testing: > > - [x] tier1-4,valhalla-comp-stress > > Please take a look and leave your review, thanks a lot. > > --------- > > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). This pull request has now been integrated. Changeset: fab935b4 Author: Quan Anh Mai <[email protected]> URL: https://git.openjdk.org/valhalla/commit/fab935b45668a755083821f1fa8f4a6de39994ad Stats: 72 lines in 2 files changed: 18 ins; 25 del; 29 mod 8374475: [lworld] C2: assert(_gvn.type(l)->higher_equal(type)) failed: must constrain OSR typestate Reviewed-by: thartmann ------------- PR: https://git.openjdk.org/valhalla/pull/2333
