RFR: 8341924: Improve error message with structurally malformed Code array
Adam Sotona
asotona at openjdk.org
Fri Oct 11 08:01:11 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
> }
Looks good to me.
-------------
Marked as reviewed by asotona (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21463#pullrequestreview-2362194526
More information about the compiler-dev
mailing list