Schematic diagram of the Java Virtual Machine ---- JVM runtime data zone, virtual machine ---- jvm
JVM Runtime data zone (JVM Runtime Area)In fact, it refers to the division and allocation of computer memory space during JVM running. This article will discuss the JVM runtime data zone through the following topics.
- Topic 1.JVM runtime data ZoneIn what?
- Topic 2.Virtual Machine StackWhat is it?Virtual Machine StackIn what?
- Topic 3.Stack frameWhat is it?Stack frameIn what?
- Topic 4.Method AreaWhat is it?Method AreaIn what?
Topic 1. What is in the JVM runtime data zone?
Topic 2. What is a virtual machine stack? What is in the Virtual Machine stack?
Topic 3. What is the stack frame? What is in stack frames?
Topic 4. What is the method area? What is in the method area?
Author's words
This article is one of the series of "Schematic diagram of Java virtual machines". If you are interested, please follow other articles in this series ~
I think this article is good. Just like it ~~ Your encouragement is a powerful motivation for me to continue sharing my knowledge!
Certificate -----------------------------------------------------------------------------------------------------------------------------------------
This article is from http://blog.csdn.net/luanlouis/. if you need to download it, please note it. Thank you!
How does the jvm Java virtual machine work?
Java Virtual Machine
1. What is a Java Virtual Machine?
A Java virtual machine is an imaginary machine that is simulated by software on an actual computer. The Java Virtual Machine has its own hardware, such as the processor, stack, and register. It also has the corresponding command system.
1. Why should I use a Java Virtual Machine?
A very important feature of Java is its independence from the platform. The use of Java virtual machines is the key to achieving this feature. General advanced languages must at least compile different target codes to run on different platforms. After the Java Virtual Machine is introduced, the Java language does not need to be re-compiled when running on different platforms. Java language usage mode: the Java Virtual Machine shields information related to specific platforms, so that the Java language compiler only needs to generate the target code (bytecode) that runs on the Java Virtual Machine ), it can be run on multiple platforms without modification. When executing the bytecode, the Java Virtual Machine interprets the bytecode as a machine instruction execution on a specific platform.
2. Who needs to know about the Java Virtual Machine?
Java Virtual Machine (VM) is the underlying implementation basis of the Java language. Anyone interested in the Java language should have a general understanding of the Java Virtual Machine. This helps you understand the nature of Java and the use of Java. For software developers who want to implement Java virtual machines on a specific platform, compiler authors of Java language and those who want to implement Java virtual machines using hardware chips, they must have a deep understanding of the specifications of Java virtual machines. In addition, if you want to expand the Java language or compile other languages into the bytecode of the Java language, you also need to have a deep understanding of the Java Virtual Machine.
3. Data Types supported by Java Virtual Machine
Java Virtual Machine supports the following basic data types:
Byte: // complement of a signed integer in 1 byte
Short: // 2byte signed integer Complement
Int: // 4-byte signed integer Complement
Long: // 8-byte signed integer Complement
Float: // 4-byte IEEE754 Single-precision floating point number
Double: // 8-byte IEEE754 double-precision floating point number
Char: // 2-byte unsigned Unicode Character
Almost all Java type checks are completed at compilation. The raw data types listed above do not need to be marked with hardware during Java execution. * The bytecode (Instruction) used for the raw data type has already pointed out * the Data Type of the number. For example, the iadd, ladd, fadd, and dadd commands add the two numbers, its * operation types are int, long, float, and double. The VM does not set separate commands for the boolean type. Boolean data is processed by integer commands, including integer return. Boolean arrays are processed using byte arrays. The VM uses a floating point number in IEEE754 format. Older computers in IEEE format are not supported. It may be very slow when running Java numeric computing programs.
Other data types supported by virtual machines include:
Object // 4-byte reference to a Javaobject
ReturnAddress // 4 bytes for the jsr/ret/jsr-w/ret-w command
Note: Java arrays are processed as objects.
The specifications of virtual machines have no special requirements on the internal structure of objects. In Sun's implementation, an object reference is a handle, which contains a pair of pointers: one pointer points to the object's method table, and the other points to the object's data. Programs represented by bytecode of Java virtual machines should comply with Type rules. Java Virtual Machine implementation should reject the execution of bytecode programs that violate the type regulations. The Java Virtual Machine can only run on 32-bit address space machines due to the bytecode definition restrictions. However, you can create a Java virtual machine, which automatically goes... the remaining full text>
How does a Java virtual machine work?
Set the environment variables classpath and path.
Classpath refers to the path of the class file to be loaded by JVM, and path refers to the path of the JVM toolbox.
When the JVM loads a class, the system allocates a data memory area to the virtual machine. In this memory area, there are three small memory areas.
The heap area stores the objects of this class. The method area stores the type information of the class, including static variables and methods of the class. The stack area stores local variables.
When a class is loaded, JVM first stores all the class type information in the method area. After loading, it locates the main method in the Method Area and starts to execute commands.