Re: java and goto instuction! amazing!

Discussion in 'Java' started by Tor Iver Wilhelmsen, Aug 23, 2003.

  1. "Amir Pashazadeh" <> writes:

    > I decompiled a class file (using 3 different decompilers for
    > accurancy), and every time I got the same source code, there is
    > something amazing in it, it has "goto" instruction! how can it be?


    Because VM instruction set is not the same as Java language keywords.

    > does JVM (as executor) supports "goto" instruction, but no standard
    > compiler supports it yet? so a custom compiler can use it?


    The VM uses "goto" to jump around in the same sense x86 uses "jmp".
    You need to have some sort of jumping instruction.

    The "gotos" come from java-the-language loops (for, while) and sundry
    others (break, continue).
    Tor Iver Wilhelmsen, Aug 23, 2003
    #1
    1. Advertising

  2. Tor Iver Wilhelmsen

    David Off Guest

    Tor Iver Wilhelmsen wrote:
    > "Amir Pashazadeh" <> writes:
    >
    >
    >>I decompiled a class file (using 3 different decompilers for
    >>accurancy), and every time I got the same source code, there is
    >>something amazing in it, it has "goto" instruction! how can it be?

    >
    >
    > Because VM instruction set is not the same as Java language keywords.
    >
    >
    >>does JVM (as executor) supports "goto" instruction, but no standard
    >>compiler supports it yet? so a custom compiler can use it?

    >
    >
    > The VM uses "goto" to jump around in the same sense x86 uses "jmp".
    > You need to have some sort of jumping instruction.
    >


    But to answer the original poster's question, you could write a compiler
    that compiled to JVM bytecodes that supported gotos if you want. But
    the language wouldn't be Java.
    David Off, Aug 23, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roedy Green
    Replies:
    1
    Views:
    380
    DiscoStu
    Aug 24, 2003
  2. E.C. Bäck
    Replies:
    0
    Views:
    424
    E.C. Bäck
    Aug 25, 2003
  3. Replies:
    0
    Views:
    392
  4. Mike Painter
    Replies:
    0
    Views:
    418
    Mike Painter
    Nov 2, 2006
  5. nais-saudi
    Replies:
    0
    Views:
    410
    nais-saudi
    Sep 12, 2010
Loading...

Share This Page