I have a (Java) program that does this, although I added the comments
by hand.

Writing a decompiler seemed like a good way to learn jvm. I didn't
originally intend to decompile byte codes, by as usual I got carried away....

Nick

Chris Abbey wrote:

> Nick, what program did you use to generate the listing? or did you build
> it by hand from javap output? -=Chris
>
> At 03:17 PM 7/18/99 +0100, you wrote:
> [...]
> >-----------------------------------------
> >Bytecode from Nathans Hello.java:
> >Code Disassembly:
> >
> >   Addr Op Operands Code
> >   ---- -- -------- ----
> >
> >...............
> >...............
> >   0011 03          iconst_0                    // for( int i = 0; .....
> >   0012 36 04       istore L4                   // (store i)
> >   0014 a7 001b     goto +1b = 002f
> >        try #1
> >   0017 84 0401     iinc L4,1                   // {   i++;
> >   001a 1d          iload_3
> >   001b 99 000b     ifeq +b = 0026              //     if( foobar ) ...
> >   001e bb 0005     new #5 <Class Exception>
> >   0021 59          dup
> >   0022 b7 000b     invokespecial #11 <Method void Exception.<init>()>
> >   0025 bf          athrow                      //     throw ...
> >   0026 1d          iload_3                     //     foobar = foobar &&
> >true;
> >   0027 3e          istore_3
> >        end try #1
> >!   0028 a7 0007     goto +7 = 002f              //     branch around catch
> >        catch #1 (Exception)
> >!   002b 57          pop                         //     start catch clause
> >!   002c a7 0003     goto +3 = 002f              //     end catch clause
> >   002f 15 04       iload L4                    // }
> >   0031 1b          iload_1
> >   0032 a1 ffe5     if_icmplt -1b = 0017        // end for loop 1
> >...............
> >...............
> >   0047 03          iconst_0                   // for( int i = 0; .....
> >   0048 36 07       istore L7                  // (store i)
> >   004a a7 0014     goto +14 = 005e
> >   004d 84 0701     iinc L7,1                  // {   i++;
> >   0050 1d          iload_3
> >   0051 99 000b     ifeq +b = 005c             //     if( foobar ) ...
> >   0054 bb 0005     new #5 <Class Exception>
> >   0057 59          dup
> >   0058 b7 000b     invokespecial #11 <Method void Exception.<init>()>
> >   005b bf          athrow                     //     throw ...
> >   005c 1d          iload_3
> >   005d 3e          istore_3                   //     foobar = foobar &&
> >true;
> >   005e 15 07       iload L7                   // }
> >   0060 1b          iload_1
> >   0061 a1 ffec     if_icmplt -14 = 004d       // end for loop 2
> >...............
>
>   cabbey at home dot net <*> http://members.home.net/cabbey
>            I want a binary interface to the brain!
> Today's opto-mechanical digital interfaces are just too slow!




----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to