the structure of the book:
- From a macro point of view, the entire Java technology system, Java and JVM development process, modularity, and JDK compilation
- Explains the automatic memory management of the JVM, including the partitioning principle of the memory area of the virtual machine and the causes of various memory overflow anomalies.
- The execution subsystem of virtual machine is analyzed, including class file structure, virtual machine class loading mechanism and virtual machine bytecode execution engine.
- This paper explains the compiler and code optimization of the program, and expounds the principle of generic type, automatic packing and unpacking, conditional compiling and other grammatical sugars.
- This paper explains the hot spot detection method of virtual machine, the instant compiler of hotspot, compilation trigger condition, and how to observe and analyze JIT compiled data and results from outside the virtual machine.
- This paper discusses the principle of efficient concurrency in Java, including the structure and operation of the JVM memory model, the embodiment of atomicity, visibility and order in the Java memory model, the rule and use of the first occurrence principle, the implementation principle of the thread in the Java language, the implementation of the virtual machine to achieve the efficient concurrency of some of the optimization measures.
The Java Virtual Runtime data area looks like this:
The first one is the program counter:Identify the machine code line number, jump and other operations, only need to modify the program counter can be achieved.
The second is a virtual machine stack:Save the local variable table, if access exceeds the depth of the stack, and does not support dynamic expansion, so reported Stackoverflowerror, most of the current virtual machine support virtual machine stack dynamic expansion, if there is not enough space to save the local variable table is reported OutOfMemoryError.
The third one is the local method stack:The local method stack does not specify the language, usage, and data structure, so a specific virtual machine can implement it freely. Also throws Stackoverflowerror and OutOfMemoryError like the virtual machine stack
The fourth one is the Java heap:Created when the virtual machine is started, with the sole purpose of storing the object instance. Almost all of the object instances are allocated memory here. The Java heap is the primary area of garbage collection management. So the Java heap is also called the "GC" heap (garbage heap). Java heap Refinement, the new generation and the old age. is to better reclaim memory and allocate memory more quickly.
The fifth is a method area:Stores data such as class information, constants, static variables, and instant compiler-compiled code that have been loaded by the virtual machine. Alias Non-heap (not heap)
The first six is the running constant pool:
The seventh one is direct memory
The next section shows the OutOfMemoryError and stackoverflowerror exception Debugger for different data regions.
Deep understanding of Java Virtual Machine learning notes (1)