From ebruneton at free.fr Sat Sep 8 14:13:52 2018 From: ebruneton at free.fr (ebruneton at free.fr) Date: Sat, 8 Sep 2018 16:13:52 +0200 (CEST) Subject: jdis produces invalid output on large method, that jasm can't parse In-Reply-To: <1201676747.1065671551.1536415952401.JavaMail.root@zimbra73-e12.priv.proxad.net> Message-ID: <1966092327.1065683054.1536416032370.JavaMail.root@zimbra73-e12.priv.proxad.net> When running jdis on https://gitlab.ow2.org/asm/asm/blob/master/asm-test/src/main/resources/jdk3/LargeMethod.class, an 'iinc_w 263;' is produced, with the second iinc argument missing. Also, two 'endtry' and 'catch' are missing after this iinc_w. The result cannot be parsed by jasm. From Leonid.Kuskov at Oracle.com Tue Sep 11 20:40:13 2018 From: Leonid.Kuskov at Oracle.com (Leonid Kuskov) Date: Tue, 11 Sep 2018 13:40:13 -0700 Subject: RFR: CODETOOLS-7902316: jdis ignores exception_table entries and uses a wrong format for iinc_w instruction Message-ID: 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 From alexandre.iline at oracle.com Fri Sep 14 18:26:35 2018 From: alexandre.iline at oracle.com (Alexandre (Shura) Iline) Date: Fri, 14 Sep 2018 11:26:35 -0700 Subject: RFR: CODETOOLS-7902316: jdis ignores exception_table entries and uses a wrong format for iinc_w instruction In-Reply-To: References: Message-ID: Looks good, Leonid. Shura > On Sep 11, 2018, at 1:40 PM, Leonid Kuskov 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 > > From alexandre.iline at oracle.com Mon Sep 24 21:30:42 2018 From: alexandre.iline at oracle.com (alexandre.iline at oracle.com) Date: Mon, 24 Sep 2018 21:30:42 +0000 Subject: hg: code-tools/asmtools: 3 new changesets Message-ID: <201809242130.w8OLUgKq020193@aojmv0008.oracle.com> Changeset: 9092900a27ad Author: lkuskov Date: 2018-09-24 13:04 -0700 URL: http://hg.openjdk.java.net/code-tools/asmtools/rev/9092900a27ad CODETOOLS-7902316 jdis ignores exception_table entries and uses a wrong format for iinc_w instruction ! src/org/openjdk/asmtools/jdis/CodeData.java ! src/org/openjdk/asmtools/jdis/TrapData.java Changeset: 5d0dc302199d Author: lkuskov Date: 2018-09-24 13:14 -0700 URL: http://hg.openjdk.java.net/code-tools/asmtools/rev/5d0dc302199d CODETOOLS-7902323 jdis writes a minor_version item that has all 16 bits set as -1 ! src/org/openjdk/asmtools/jdis/ClassData.java Changeset: ace7df328bb1 Author: lkuskov Date: 2018-09-24 14:22 -0700 URL: http://hg.openjdk.java.net/code-tools/asmtools/rev/ace7df328bb1 Added tag 7.0-b06 for changeset 5d0dc302199d ! .hgtags