RFR: 8276836: Error in javac caused by switch expression without result expressions: Internal error: stack sim error

Guoxiong Li gli at openjdk.java.net
Thu Nov 11 13:54:05 UTC 2021


Hi all,

The method `Gen#visitSwitchExpression` would switch code generation off by using the method `Code#markDead` when it meets the code like `throw new RuntimeException()`. Then the method `Gen#completeBinop` won't generate the expected code and wiil let the left operand stay in the stack without handling it.

This patch pops the left operand from the stack to solve this issue. And the corresponding test is added.

Thanks for taking the time to review.

Best Regards,
-- Guoxiong

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

Commit messages:
 - Error in javac caused by switch expression without result expressions: Internal error: stack sim error

Changes: https://git.openjdk.java.net/jdk/pull/6350/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6350&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8276836
  Stats: 59 lines in 2 files changed: 59 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6350.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6350/head:pull/6350

PR: https://git.openjdk.java.net/jdk/pull/6350


More information about the compiler-dev mailing list