Home > Java > javaTutorial > body text

Detailed introduction to JAVA virtual machine (JVM) (4) - class file structure

王林
Release: 2019-08-24 14:43:35
forward
3711 people have browsed it

After talking about automatic memory management, let’s talk about the execution subsystem. The execution subsystem explains how the JVM executes programs.

Detailed introduction to JAVA virtual machine (JVM) (4) - class file structure

Class file overview

In this article we only talk about Class files. Class files are also known as class files or bytecode files. javac compiles the .java file (source code) into a .class file (bytecode), and jvm interprets the .class file into machine code.

Detailed introduction to JAVA virtual machine (JVM) (4) - class file structure

#The Class file contains the Java virtual machine instruction set and symbol table as well as some other auxiliary information. It is a set of binary streams with 8 bytes as the basic unit, without gaps.

Detailed introduction to JAVA virtual machine (JVM) (4) - class file structure

There are two structures for storing data: unsigned numbers and tables.

(1) Unsigned numbers are used to describe numbers, index references, quantitative values ​​or string values ​​encoded in UTF-8. Belongs to the basic data type, with u1, u2, u4, and u8 representing 1 byte, 2 bytes, 4 bytes, and 8 bytes respectively

(2) The table is composed of multiple Symbolic numbers or other tables are used as composite data types composed of data items, ending with "_info".

The characteristics are: in the Class file, which byte represents what, what is the length, and the order are not allowed to change.

Class file components

Detailed introduction to JAVA virtual machine (JVM) (4) - class file structureThe components of Class are clearly listed in the picture above. It is also necessary to emphasize the constant pool: when the virtual machine is running, the corresponding symbol reference needs to be obtained from the constant pool, and then parsed and translated into a specific memory address when the class is created or runtime.

The above is the part about the class file in the JAVA virtual machine that has been compiled for you. For more related questions, please visit the PHP Chinese website: JAVA Video Tutorial

The above is the detailed content of Detailed introduction to JAVA virtual machine (JVM) (4) - class file structure. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
jvm
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template