Learning about Java bytecode and the JVM

人盡茶涼 提交于 2019-12-02 15:40:00

Suggested reading: the JVM spec.

You might also want to play with BCEL - there are other libraries around for manipulating bytecode, but that's probably the best known one.

The Apache BCEL will allow you to analyse and hand craft .class files from bytecode.

javap will allow you to disassemble existing .class files. It's particularly useful for knocking up quick test classes to understand what is really going on underneath the covers.

KitsuneYMG

I learned by reading the ASM tutorial and mucking about with the library itself.

IMHO, ASM is better than BECL.

BCEL is already being used successfully in several projects such as compilers, optimizers, obsfuscators, code generators and analysis tools. Unfortunately there hasn't been much development going on over the past few years. Feel free to help out or you might want to have a look into the ASM project at objectweb. - http://jakarta.apache.org/bcel/

There is only one reliable source for JVM understanding

The Java® Virtual Machine Specification Java SE 7 Edition

http://docs.oracle.com/javase/specs/jvms/se7/html/index.html

Programming for the Java Virtual Machine is a good book for this topic. (Disclosure: I work with the author.)

For understanding Java/the JVM's architecture: read Wikipedia, the specs and the source code.

For understanding how object-orientated code is done on a low level: try and emulate features like inheritance/polymorphism/encapsulation in a lower-level language like C.

In C you can achieve the above through, for example, a combination of function pointers and nested structures.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!