Talk:Java bytecode

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Java (Rated Start-class, High-importance)
WikiProject icon This article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.
 

"Historical reasons"[edit]

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 (talkcontribs) 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
It is now used for the invokedynamic instuction. Nxavar (talk) 17:23, 28 April 2014 (UTC)

Listing[edit]

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)
I do agree that the bytecodes listing is of very limited benefit for most people but it does give an idea a much deeper understanding of how the JVM actually executes a Java program. Java bytecode is what the JVM runs and seeing the form that your programs are compiled into gives the programmer a better idea of exactly what he/she is doing. This is necessary information to anyone hoping to learn more of the technical side of Java but perhaps another location for this listing would be better. Perhaps another wikipedia entry or another wiki* site. 66.68.214.241 (talk) 07:30, 29 September 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)

Does Jython compile to Java bytecode or not?[edit]

"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 (talkcontribs) 23:55, 7 August 2006

You may want to check (or correct!) the Jython article. But so it states, that Jython compiles to bytecode. EnTerr (talk) 20:33, 29 July 2008 (UTC)

int/reference comparison[edit]

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)

Transwiki[edit]

I've transferred the questionable table of bytecode values to b:Java Programming/Byte Code, which is a much more appropriate home for such reference material than a descriptive article. Chris Cunningham (not at work) - talk 09:50, 31 July 2008 (UTC)

Well, it's good to know that at least it's not going into the eternal oblivion known as the Transwiki namespace, like other articles did before it. There seem to be some editors over at its new home, even if most Wikipedians never come there. Anyway, there's a bit of a gap in the present article now. It may need some sort of illustration of what these "instruction" things are the article speaks of. It should probably also tell something about how they're based on a stack machine model, explicitly typed, etc. – Chip Zero 09:42, 2 August 2008 (UTC)
Yeah, that's exactly the kind of content the article needs. Chris Cunningham (not at work) - talk 11:33, 2 August 2008 (UTC)
I think no one look at wikibooks and this is right place to keep the table. If you think table is too long then make it dynamic. For example you can make it expendable when someone click on A (to show instruction starting from A) etc. --- 91.19.170.160 (talk) 22:41, 24 August 2008 (UTC)
You haven't provided a rationale for why this is the right place. As purely textbook material, it is definitely not appropriate here. I've removing it again. We have a link to Wikibooks, so I don't see why "no one look" there. Chris Cunningham (not at work) - talk 12:41, 30 August 2008 (UTC)
Look, there is a page X86 instruction listings, there are such pages as this: MIPS architecture or this: PDP-11. All of them have instruction listings. And they should, because no one can have a conception of platform possibilies without seeing available instruction listings. Now if one wants to compare possibilities of java bytecode with the possibilities of x86 instruction set, it is impossible to do. What information from the article exactly will allow one to understand what is the difference in the architetures of Java bytecode and Common Language Runtime, for example? The answer is nothing, because there is now almost no information about the concept of Java bytecode and how it is differs from others. And I don't see, how you can properly explain it without providing a code list. This is my rationale for inclusion.
Now let us look at yours. Tell us, please, where do you see here: Wikipedia:What Wikipedia is not prohibition to use technical information? There is no instruction manual in the article, implementation of a JVM is way more complex than simply reading a brief table describing what each code does. Or you seriously think that this table is able to substitute reading of Java Virtual Machine Specification? So here is what I wanna say: if you want to make the article more available to the public, do it, but do not simply ruin it by removing any infomation, viltal for the understanding of the subject, this doesn't make the article any better. HotXRock 19:11, 2 September 2008 (UTC)
Firstly, let's not argue that the existence of other things proves the need for the existence of this thing. Secondly, I don't see how including an instruction listing does clarify the subject, because it is opaque and useless to almost all our readers. A piece of prose explaining the difference (possibly even with choice examples) would be vastly more useful. Thirdly, technical documentation such as a lookup table of bytecode output is exactly the sort of thing included in a technical manual, which is specifically mentioned in the guideline in question. I'm ignoring the ruinance statement, which isn't productive. Chris Cunningham (not at work) - talk 00:18, 3 September 2008 (UTC)
Well, it is said that "Wikipedia article should not read like a how-to style manual of instructions, advice (legal, medical, or otherwise) or suggestions, or contain how-tos". Yes, such listing of codes could be in instruction manual, and then what? There is no prohibition to use such kind of information, the article itself shouldn't become "a how-to style manual of instructions". I don't think that there is any instruction in this table at all. This information may be useful (and nothing more) if you want to implement a JVM, and what's wrong with that? By the way, technically speaking there is no such table in the specification, there's a multi-page list of codes with lengthy descriptions, which is far less rather useless for those who want to have a basic understanding of the code set.
And speaking of basic understanding, how do you suppose to understand conception of bytecode possibilities without seeing the list? Well, if you want to simplify table and turn it into prose, it is possible, but I think that the table is much clearer than just plain text. For example, it helped me very much about one or two years ago. If you say that it doesn't help to understand the subject, the table could be a separate article, but since this article is very short, I don't think that's a good idea. And finally: how do you assume that audience won't find it useful? If one is familiar with Java and principles of assembler code and wishes to understand how bytecode works, but doesn't want to uncover specific details of JVM operation, this table would be exactly what he needs. —Preceding unsigned comment added by HotXRock (talkcontribs) 08:39, 3 September 2008 (UTC)
Anyone who wants to try simplifying the information in the table and converting it to prose is welcome to try; it's still held in the page history. I don't believe that it provides any real informational value, and in its current form is wholly unsuitable for an encyclopedia article (as opposed to a textbook), which means for now it belongs at Wikibooks. Please see WP:USEFUL for an explanation of why Wikipedia does not simply keep any random information around because someone might find it useful. Chris Cunningham (not at work) - talk 11:27, 3 September 2008 (UTC)
You still haven't explained why it is "wholly unsuitable". Don't just state something with no supporting arguments, I have already explained why your previous arguments are inappropirate. In WP:USEFUL I read the following: "Usefulness is a subjective judgment and should be avoided in deletion debates unless it supports a cogent argument". I also think you should read section WP:IDONTLIKEIT. By the way, now you say that someone might find this information useful, so you agree that the table can be of any use for reader after all? HotXRock 15:26, 3 September 2008 (UTC) —Preceding unsigned comment added by HotXRock (talkcontribs)
It is prescriptive. It is opaque. It is of very little value in a comparative sense. It is very large, and thus its presence is detrimental to the readability of the article. And you're the one who says that it is useful; I'm just pointing out that whether the section "could be of use to someone" is of no relevance to the question of its inclusion. Chris Cunningham (not at work) - talk 16:39, 3 September 2008 (UTC)
What exactly does this table prescript? There are no instructions in this table. Opaque is just someone's point of view, it is very subjective, because the audience of Wikipedia is large. If the table is so large that it makes difficult to read the article, then the appropirate action would be splitting into two articles, it is not a reason for deletion. If you point out that usefullness is of no relevance, why are you still continuing to discuss article's obscurity and comparative value yourself? HotXRock (talk) 16:51, 3 September 2008 (UTC)
"Prescriptive" in the sense of "taking the form of a manual or textbook", rather than "advice" so to speak. The material is a lookup table, and has little except educational value (and the purpose of Wikipedia is to describe, rather than teach). It is not "subjective" to point out that the vast majority of readers will take nothing from this table. If you'd like to split it to its own article then be my guest, but I very much doubt that such an article will last very long. Chris Cunningham (not at work) - talk 08:20, 4 September 2008 (UTC)
You seem to distort the rules of Wikipedia to prove your point. Read carefully this section. It is said not just manual, but "how-to style manual of instructions". You haven't answered my question, where do you see instructions in this table? By the way, you could consider description of virtually anything that can be made by a man a manual. For example, you could say that description of a brick (a rectangular block of clay) is an instruction on how to make bricks. I see that you don't understand the difference between description and prescription, but it is crucial to our argument. I should remind that you said yourself right in your previous post that usefullness is of no relvenace, so stop arguing about the value of the table. Every description has educational value (and thus entire Wikipedia does). Please, cite help pages, prove your point of view proceeding form the style manuals and not from your own assumptions. HotXRock (talk) 09:45, 4 September 2008 (UTC)
I'm not getting into a wikilawyering debate about this. In my opinion the information is of no value to the article except as a list of textbook data (note that having value to an article is not the same as being "useful to readers"), this issue has been raised before, and moving it to Wikibooks (which is not the same as just deleting it) was the right call here. People shouldn't be coming to Wikipedia for reference material like this. We aren't here to teach people how to program. Chris Cunningham (not at work) - talk 11:14, 4 September 2008 (UTC)
Well, first of all let's remember that it is you who stated that such information is inappropirate to include in Wikipedia according to the policies. I have already explained to you why you are mistaken, so please, be polite in the discussion. It comes again to the value of the table. Different users including myself have explained why this table has its value to the article. Your suggestions on the vast majority of readers can't be verified anyway, there is no hard statistics on the people reading this article and on their skills. So let's seek a compromise over this article. If you consider the article too big, I suggest creating a new article "List of Java byte codes" and adding a link here. HotXRock (talk) 12:23, 4 September 2008 (UTC)

Compressed Stack Map Frame[edit]

Can anyone explain the concept of compressed frame instructions? —Preceding unsigned comment added by 121.246.75.150 (talk) 12:42, 7 May 2009 (UTC)

External Links[edit]

Oct. 23, 2012: Every single one of the links in "External Links" is dead or changed to irrelevance. Newbie here, so not sure what the proper editing to do is, though probably not just deleting them all outright. 149.32.192.34 (talk) 12:01, 23 October 2012 (UTC) mjw