Java bytecode specification [closed]

2020-05-11 10:44发布

Is there a nice place for learning the JVM bytecode instruction set. The specification perhaps and maybe some tutorials?

I ask because I would like to design a toy language and a compiler for it that generates JVM bytecode.

Thanks for your knowledge and perhaps googling.

9条回答
家丑人穷心不美
2楼-- · 2020-05-11 10:55

The Java Virtual Machine Specification is a good place to start.

See Chapter 4 The class File Format. The updates cover new attributes added since the 2nd edition was made.

查看更多
狗以群分
4楼-- · 2020-05-11 11:05

A little more "graphic" explanation, IBM developer works: Understanding bytecode makes you a better programmer.

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2020-05-11 11:05

A new version of the specification has been released:

The Java Virtual Machine Specification, Java SE 7 Edition

This new addition does exclude the chapter on Java Programming Language Concepts which folks may or may not find useful. See here for that chapter in the Second Edition of the spec.

查看更多
Bombasti
6楼-- · 2020-05-11 11:06

This is a bit more specialized, but here is an on-line presentation on how to optimize generated bytecode for running on the JVM. It was presented at the recent JVM Languages Summit conferences. InfoQ has a collection of presentations from that conference which might be of help to someone wanting to bring up a language on the JVM (or to see what's already been done).

查看更多
仙女界的扛把子
7楼-- · 2020-05-11 11:11

The book Programming for the Java Virtual Machine explains the JVM instruction set and how to write code for it. It also introduces a bytecode assembler called Oolong, which I have not been able to download. You can, however, use Jasmin, the predecessor of Oolong. Essentially, you write a text file with instructions and Jasmin will spit out a .class file. The book was published in 1999, but it is still a good and gentle introduction to the VM.

查看更多
登录 后发表回答