[lworld] RFR: 8377480: [lworld] incorrect execution due to EA pointer comparison optimization at scalarized call [v2]
Roland Westrelin
roland at openjdk.org
Thu Feb 12 09:31:17 UTC 2026
> EA goes over arguments to a non inlined call and uses
> `BCEscapeAnalyzer` to add edges to the `ConnectionGraph`. With
> valhalla, that code goes over inputs to a `CallNode` using the
> scalarized calling convention and queries `BCEscapeAnalyzer` with the
> index of the argument in the scalarized CC but `BCEscapeAnalyzer` has
> no knowledge of the scalarized CC. So `is_arg_returned()` for instance
> is passed the wrong argument number and EA, as a result, can add
> incorrect edges to the `ConnectionGraph`.
>
> In the test case:
>
>
> static value class MyValue {
> Object o;
>
> MyValue(Object o) {
> this.o = o;
> }
> }
>
> static int test1(Object o) {
> MyValue v = new MyValue(null);
> Object res = notInlined(v, o);
> if (res == null) {
> return 1;
> }
> return 2;
> }
>
> static Object notInlined(MyValue arg1, Object arg2) {
> return arg2;
> }
>
>
> 2nd argument is returned by `notInlined()`. The second argument in the
> scalarized CC in `test1()` is `Myvalue.o`. So EA deduces that the
> return value of `notInlined()` is `v.o` (which is `null`) instead of
> `o` which is non null.
>
> With this EA:
>
> public static void test2() {
> MyValue arg = new MyValue(null);
> MyValue res = notInlined2(arg);
> if (res.o != null) {
> throw new RuntimeException("never taken");
> }
> }
>
> static MyValue notInlined2(MyValue v) {
> return v;
> }
>
>
>
> the fixed logic connects the return of `notInlined2` with `v.o`.
Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
review
-------------
Changes:
- all: https://git.openjdk.org/valhalla/pull/2079/files
- new: https://git.openjdk.org/valhalla/pull/2079/files/f517f1e8..511ab9e2
Webrevs:
- full: https://webrevs.openjdk.org/?repo=valhalla&pr=2079&range=01
- incr: https://webrevs.openjdk.org/?repo=valhalla&pr=2079&range=00-01
Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/valhalla/pull/2079.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2079/head:pull/2079
PR: https://git.openjdk.org/valhalla/pull/2079
More information about the valhalla-dev
mailing list