Java bytecode: Difference between revisions

Content deleted Content added
Formatting correction
Line 57:
mov ecx, eax</source>
This code would add two values and move the result to a different ___location. Similar disassembled bytecode might look like this:
<source lang="asm">
<code>
0 iload_1
1 iload_2
2 iadd
3 istore_3</codesource>
Here, the two values to be added are pushed onto the stack, where they are retrieved by the addition instruction, summed, and the result placed back on the stack. The storage instruction then moves the top value of the stack into a variable ___location. The numbers in front of the instructions simply represent the offset of each instruction from the beginning of the method.
This stack-oriented model extends to the object oriented aspects of the language as well. A method call called "getName()", for example, may look like the following: