RFR: CODETOOLS-7902316: jdis ignores exception_table entries and uses a wrong format for iinc_w instruction

Alexandre (Shura) Iline alexandre.iline at oracle.com
Fri Sep 14 18:26:35 UTC 2018


Looks good, Leonid.

Shura

> On Sep 11, 2018, at 1:40 PM, Leonid Kuskov <leonid.kuskov at oracle.com> wrote:
> 
> Bug: https://bugs.openjdk.java.net/browse/CODETOOLS-7902316
> Webrev: http://cr.openjdk.java.net/~lkuskov/7902316/webrev.00
> 
> Trivial fix for "an 'iinc_w 263;' is produced, with the second iinc argument missing.":
> 
> --- a/src/org/openjdk/asmtools/jdis/CodeData.java       Thu May 17 13:34:08 2018 -0700
> +++ b/src/org/openjdk/asmtools/jdis/CodeData.java       Tue Sep 11 13:08:21 2018 -0700
> 
> @@ -422,7 +422,7 @@
>                      mnem = opcode2.parsekey();
>                  }
>                  out.print(mnem + " " + getUShort(pc + 2));
> -                if (opcode2 == Opcode.opc_iinc) {
> +                if (opcode2 == Opcode.opc_iinc_w) {
>                      out.print(", " + getShort(pc + 4));
>                      return 6;
>                  }
> 
> The fix for "Also, two 'endtry' and 'catch' are missing after this iinc_w.":
> 
> asmtools loses start_pc/end_pc item/handler_pc if it exceeds Short.MAX_VALUE
> 
> --- a/src/org/openjdk/asmtools/jdis/TrapData.java       Thu May 17 13:34:08 2018 -0700
> +++ b/src/org/openjdk/asmtools/jdis/TrapData.java       Tue Sep 11 13:08:21 2018 -0700
> 
>  class TrapData {
> 
> -    short start_pc, end_pc, handler_pc, catch_cpx;
>      int num;
> 
> +    // exception_table
> +    int start_pc,       // u2
> +        end_pc,         // u2
> +        handler_pc,     // u2
> +        catch_cpx;      // u2
> +
>      public TrapData(DataInputStream in, int num) throws IOException {
>          this.num = num;
> -        start_pc = in.readShort();
> -        end_pc = in.readShort();
> -        handler_pc = in.readShort();
> -        catch_cpx = in.readShort();
> +        start_pc = in.readUnsignedShort();
> +        end_pc = in.readUnsignedShort();
> +        handler_pc = in.readUnsignedShort();
> +        catch_cpx = in.readUnsignedShort();
> 
> Thanks,
> Leonid
> 
> 



More information about the code-tools-dev mailing list