简体   繁体   中英

Getting the arguments for the bytecode using Javassist

http://lpaste.net/338173的反汇编代码(使用javap -c)如下所示: http : //lpaste.net/338175 ,在第三列上,有200个参数作为“ sipush”的参数我是从使用javassist的类文件中获得的?

sipush is a bytecode which takes a single two byte argument which is a number to push onto the operand stack. In Javassist, you can iterate over all bytecode of a method via the CodeAttribute that is available from the CtMethod 's MethodInfo . In your case, it would be the first byte code, but you can check that you reached Opcode.SIPUSH . Once you iterated to this instruction you can read the 2 byte argument via the s16bitAt method from the iterator. The method takes a zero-based index. In your case, this makes the argument zero for sipush , returning 200 as a value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM