javap的一些使用例子

2021年09月15日 阅读数:1
这篇文章主要向大家介绍javap的一些使用例子,主要内容包括基础应用、实用技巧、原理机制等方面,希望对大家有所帮助。
Created by Wang, Jerry on Oct 23, 2016

javap的一些使用例子_javascript
javap的一些使用例子_javascript_02
stack=4, locals=1, args_size=1
Values in bytecode are stored in local variable slots and on the operand stack. Each can have up to 2^16 - 1 slots, but for efficiency reasons, you are required to specify a limit on the stack and locals so that it won’t waste all that space if you aren’t actually using it.
In compiled code, the compiler will automatically calculate this as the minimum that’s actually used in the function. In this case, it is using 4 slots in the operand stack and 1 slot in the local variable table. I am not sure what arg_size is, but I am guessing this is just the total size of parameters (i.e. the number of arguments). At any rate, this doesn’t correspond to any feature of the classfile format, so whatever it is, javap is calculating and inserting it manually.
LineNumberTable: section
The LineNumberTable is one of the optional attributes that holds metadata for debugging purposes. In this case, it specifies which offsets in the bytecode correspond to each line in the original source code. This is useful for printing more informative stack traces and for providing features like single step in the debugger.
Useful list:
https://en.wikipedia.org/wiki/Java_bytecode_instruction_listings
#1: NullableTest
#43 = #14.#15
javap的一些使用例子_Java_03
http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.2
javap的一些使用例子_javascript_04
javap的一些使用例子_javascript_05javascript