Talk:Java bytecode

From Wikipedia, the free encyclopedia

This is the talk page for discussing improvements to the Java bytecode article.

Article policies

Contents

[edit] "Historical reasons"

Does anyone know why Opcode 0xba is 'left unused for historical reasons'? It's really bugging me, and I would love to know. Perhaps someone who knows someone who works at Sun could find out, cos no one else seems to know. —Preceding unsigned comment added by 134.7.248.13 (talk • contribs) 07:55, 31 May 2006

I think I have an answer for that, but it's just a wild guess: Java class files have a four-byte signature at the beginning of the file - 0xCAFEBABE. If you look at each of the bytecode listings for the four bytes in the file signature, you get the following:
  • 0xCA - breakpoint (stops execution)
  • 0xFE - impdep1 (invalid in a class file)
  • 0xBA - (reserved for historical reasons)
  • 0xBE - arraylength
Every other opcode either prevents execution or is invalid. Perhaps 0xBA is reserved so that if, for some bizarre reason, the JVM tried executing the file without reading the header, the program would break immediately. Diego Argueta 19:50, 23 December 2007

[edit] Listing

I really don't think it's necessary to list al jvm bytecodes on this page. A small example would be much more interesting to the reader. This has absolutely no value. Wouter Lievens 14:04, 12 June 2006 (UTC)

I second that opinion.. I'd remove it but I dont know any good small exmple that would replace it. Highwind 21:19, 13 November 2006 (UTC)
I think the table is nice and clarifying, but it probably has a limited audience. It agree looks a bit plain and verbose. Perhaps they shouldn't be listed alphabetically, but in categories (e.g., mathematical operations). A lot could also be said about the choice of the instructions; how all instructions are explicitly typed (unlike in CIL), how this is redundant when you need to verify it anyway, and how there is no instruction to add two bytes for example. - Chip Zero 14:18, 13 January 2007 (UTC)
I don't agree with you, guys. I didn't knew anything about Java bytecode, only very little about .class structure (what is the constant pool). Today I needed to understand how it works, I went to wikipedia, read through the table, and now I understand how java works, the complete table was perfect for me. I'm sure such table is A MUST to the article. This is not a paper encyclopedia, you are not limited in size. It'd be better, of course, to restructure the table, grouping instructions by areas. And maybe collapse similiar instructions, different only by data types, to single rows. SPGremlin 20:12, 21 September 2007
I found the table very helpful and I use it very often as a quick reference for java bytecode. IMHO this article is for limited audience either way and java bytecode instructions are essential part of java bytecode so the table belongs here; however it should be reformatted and listed by categories (maybe even moved to "main" article Java bytecode instructions or similar). Miko3k 14:25, 27 September 2007 (UTC)
Wikipedia articles are not mean to be used as technical documentation. The whole section should be removed entirely if it cannot be rewritten as a descriptive piece of prose with a broader audience than engineers looking to implement a JVM. Chris Cunningham (talk) 15:07, 21 December 2007 (UTC)
Actually, I don't think this would be too helpful if you'd actually want to implement a JVM. It may be of some use if you want to create your own JVM-like VM, but other than that it's much more useful if you want to generate bytecode, like for a compiler. But other than the compiler audience, it should be interesting to anyone who wants to learn a little more about what's going on under the hood. So even though I agree that it should be rewritten (see above), I think in its current form it's still a useful contribution to the encyclopedia. – Chip Zero 21:34, 22 December 2007 (UTC)
I also found the table helpful in understanding how Java bytecode works. Perhaps we can reach a compromise--the bytecode table can me cleaned up a little bit and moved to a different location, and reduced to a reference on the main page. - Diego Argueta 19:39, 23 December 2007
I believe that this is an excelent reference for a JVM or someone who generates bytecodes. I've done both for embedded systems and a domain spicific language using this reference. Wikipedia may not be inteded as a technical reference, but it is made to be a general reference, and it is certianly useful as a technical reference in many fields. I doubt anyone would find this article useful by itself without the bytecodes listed, but with them, it makes a nice, complete reference. —Preceding unsigned comment added by 64.236.240.190 (talk) 12:20, 28 March 2008 (UTC)
I don't think that removing the list is a good idea. There is no way you can understand how the bytecode works if you do not know what different codes do, so this list must be here. And I have no idea how one can provide a small example wtithout describing even a small number of codes. I strongly disagree that the table should be removed. - HotXRock 08:27, 5 April 2008 (UTC)
As far as I see, most users disagree with the suggestion, so I took the liberty of removing the template. - HotXRock 10:04, 19 April 2008 (UTC)
It isn't a vote. This information is of staggeringly little use except as technical documentation, and the people expressing a desire to keep it don't seem to disagree - therefore, it's a matter of punting it to a more appropriate forum, which is WikiBooks. Chris Cunningham (not at work) - talk 22:55, 6 June 2008 (UTC)

[edit] Jython does not compile Python to Java bytecode

"Jython, compiles from Python to Java bytecode", this is wrong, Jython appears to be a Python interpreter written in Java. Have corrected. —Preceding unsigned comment added by 81.7.34.73 (talk • contribs) 23:55, 7 August 2006

[edit] int/reference comparison

if_acmpeq  a5      branch if reference comparison succeeds
if_acmpne       a6      branch if int comparison succeeds

i think the second one does not fit, should be:

if_acmpne  a6      branch if reference comparison fails

--Kunobert 12:13, 11 October 2006 (UTC)