RFR: 8358801: javac produces class that does not pass verifier.
Chen Liang
liach at openjdk.org
Tue Jun 17 19:25:30 UTC 2025
On Tue, 17 Jun 2025 18:50:50 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java line 763:
>>
>>> 761: //expression:
>>> 762: undefineVariablesInChain(result.falseJumps, limit);
>>> 763: undefineVariablesInChain(result.trueJumps, limit);
>>
>> Should we move this truncation of variables to CondItem itself? I moved the truncation of continue/break to GenContext and found that helpful, maybe we can require an extra int arg for `makeCondItem(int, Chain, Chain)` for the limit?
>
> To me, personally: while doing it here is not perfect (mostly because I would prefer if we didn't have to do this bookkeeping at all), it seems to me like a fairly local property - the let expr starts, and then does its own cleanup. It already calls `code.endScopes(limit);` above this change, so this is basically an extension to that. If we did it at `makeCondItem` time, we would need to pass the limit everywhere `makeCondItem` is called, making it non-local. Many parts of the code would now suddenly have to care whether the node is inside a let expression. That feels to me like increasing complexity.
Sounds reasonable. I asked this because I could see `undefineVariablesInChain` being used elsewhere, such as `GenContext::addCont/addExit`. We should probably update those two sites, as I didn't consider a linked list chain being used in those sites.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25849#discussion_r2153012589
More information about the compiler-dev
mailing list