RFR: 8341924: Improve error message with structurally malformed Code array

Abdelhak Zaaim duke at openjdk.org
Sat Oct 12 14:42:08 UTC 2024


On Fri, 11 Oct 2024 05:39:20 GMT, Chen Liang <liach at openjdk.org> wrote:

> Patch a tableswitch instruction's low value to be greater than a high value, previously, javap will not print any previous instruction and report problematic address/bci to be 0. This is because the iteration of bound models require first collecting all data into a buffer list. We call the eager `forEach` instead to avoid this problem.
> 
> Before:
> 
> $ javap -c BadSwitch.class
> Compiled from "BadSwitch.java"
> final class BadSwitch {
>   static void work(int);
>     Code:
> Error: error at or after byte 0
> }
> 
> 
> Now:
> 
> $ $localjdk2/bin/javap -c BadSwitch.class
> Compiled from "BadSwitch.java"
> final class BadSwitch {
>   static void work(int);
>     Code:
>        0: iload_0
> Error: error at or after address 1: Invalid tableswitch values low: 9 high: 5
> }

Marked as reviewed by abdelhak-zaaim at github.com (no known OpenJDK username).

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

PR Review: https://git.openjdk.org/jdk/pull/21463#pullrequestreview-2363921436


More information about the compiler-dev mailing list