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

Chen Liang liach at openjdk.org
Mon Oct 14 17:25:22 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
> }

This pull request has now been integrated.

Changeset: bd626442
Author:    Chen Liang <liach at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/bd6264420b9f248999dd8387c25c549b08bd193a
Stats:     9 lines in 1 file changed: 2 ins; 0 del; 7 mod

8341924: Improve error message with structurally malformed Code array

Reviewed-by: asotona

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

PR: https://git.openjdk.org/jdk/pull/21463


More information about the compiler-dev mailing list