RFR: 8353565: Javac throws "inconsistent stack types at join point" exception [v2]
Jan Lahoda
jlahoda at openjdk.org
Tue Apr 15 17:45:28 UTC 2025
On Mon, 14 Apr 2025 23:34:26 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java line 1814:
>>
>>> 1812: types.isSubtype(t, tother) ? tother :
>>> 1813: types.isSubtype(tother, t) ? t :
>>> 1814: commonSuperClass(t, tother);
>>
>> Are the `isSubtype()` or `t==tother` checks above still necessary? Like do those fast paths not exist in `types::lub`?
>
> Just checked, lub is a varargs call and is slow. However, I think the fast path merge logic `t==tother? ... ` should be in `commonSuperClass`.
The `isSubtype` serve two purposes - they handle `null`/`BOT` type (which, I think, `lub` normally does not handle), and they are cheaper to run.
I've moved them into `commonSuperClass`, as suggested, here:
https://github.com/openjdk/jdk/pull/24617/commits/bb08b490108556553e55b0361f57c99b91a3f89c
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24617#discussion_r2045154006
More information about the compiler-dev
mailing list