X hits on this document

360 views

0 shares

0 downloads

0 comments

30 / 120

Table 5.1. Source listing for ListArguments.java.

01: 02: 03: 04:

package info.reversingproject.listarguments;

public class ListArguments { public static void main(String[] arguments){

05: 06: 07:

for (int i = 0; i < arguments.length; i++) System.out.println("Argument[" + i + "]:" + arguments[i]); } {

08: 09:

}

}

Bytecode is stored in a binary format that is not human-readable and therefore

must be “disassembled” in order to be read. Recall that the result of disassembling

machine code is assembly language that can be converted back into machine code using

an assembler; unfortunately, the same does not hold for disassembling Java bytecode.

Sun Microsystem's Java Development Toolkit (JDK) comes with javap a command-line

tool for disassembling Java bytecode; to say that javap “disassembles” bytecode is a bit

of a misnomer since the output of javap is unstructured text which cannot be converted

back into bytecode. The output of javap is nonetheless useful as a debugging and

performance tuning aid since one can see which JVM instructions are generated from

high-level Java language statements.

Table 5.2 lists the Java bytecode for the main method of ListArguments class;

notice that the fully qualified name of each method invoked by the bytecode is preserved.

It may seem curious that while ListArguments.java contains no references to the class

java.lang.StringBuilder, there are many references to it in the bytecode; this is because

the use of the “+” operator to concatenate strings is a convenience offered by the Java

language that has no direct representation in bytecode. To perform the concatenation, the

22

Document info
Document views360
Page views361
Page last viewedThu Dec 08 02:54:27 UTC 2016
Pages120
Paragraphs2913
Words25794

Comments