Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Re: java and goto instuction! amazing! (http://www.velocityreviews.com/forums/t125939-re-java-and-goto-instuction-amazing.html)

Tor Iver Wilhelmsen 08-23-2003 09:12 AM

Re: java and goto instuction! amazing!
 
"Amir Pashazadeh" <pasha@abdnet.com> 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).

David Off 08-23-2003 11:08 AM

Re: java and goto instuction! amazing!
 
Tor Iver Wilhelmsen wrote:
> "Amir Pashazadeh" <pasha@abdnet.com> 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.



All times are GMT. The time now is 12:48 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.