In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail which five elements make up the JVM structure, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Here and you focus on the composition and usage of JVM structure, JVM structure consists of five parts, they are a set of instructions, a set of registers, a stack, a useless unit collection stack (Garbage-collected-heap), a method area.
JVM structure composition
The virtual machine JVM structure consists of five parts: register, stack, waste collection heap, storage area and instruction set. Now we will introduce them one by one.
1. Register (Registers)
Like the registers of other microprocessors, the registers of the JVM mechanism are used to store the current system state. However, due to portability requirements, JVM cannot have too many registers. Otherwise, for any transplant target whose number of registers is less than JVM, it is difficult to simulate high-speed registers with conventional storage. At the same time, JVM is based on Stack, which makes it have fewer registers.
The registers for JVM include the following four:
(1) PC program count register
(2) optop Operand stack top address register.
(3) frame current execution environment address register.
(4) vars local variable header address register.
These registers are all 32 bits long. PC is used to record the steps of program execution, and the rest of the optop,frame,vars are stored in the corresponding address in the JVM stack to quickly obtain the information needed for the current execution.
two。 Stack (Stack)
JVM mechanism is a processor with stack as the basic storage mechanism. The stack is characterized by first in and then out (FILO). For each method of each class, JVM defines a certain stack space, which contains the following three kinds of information:
(1) LocalVariables local variable
This is an array of local variables for each method, and its initial address is stored in the vars register. The length of each array element is 32 bits. If the variable length is more than 32 bits, such as a double-precision floating-point variable or a long integer variable, it occupies 64 bits of the space of the two elements.
(2) ExecutionEnviroment execution environment
Contains the current state of the stack that represents the current method. The information stored is:
The previous method of ◆ activation.
◆ A pointer to the region of local variables.
◆ pointers to the top and bottom of the Operand stack.
The execution environment is the control center of the execution method, providing the necessary information for interpreting execution and recompiling. For example, the interpreter executes JVM's instruction iadd, adds two integers, and divides the execution into several steps. First, the interpreter gets the current execution environment from the register frame. Then, take out the two numbers to add in the pointer to the top of the Operand stack in the current execution environment. * the added results are also sent back to the stack.
(3) OperandStack operation stack
This is an area of 32-bit length that stores the parameters of the JVM instruction.
3. Waste area collection reactor (Garbage-CollectedHeap)
When all classes are instantiated, the storage space obtained is allocated from the collection heap. In addition, this heap is responsible for the recycling of unused space. For portability and security reasons, Java does not give programmers the authority to manage memory space. Therefore, after the compiler requests new object storage space with the new command, the interpreter is responsible for tracking and recording the usage of this piece of memory. When the use is over, the recycled space is sent back to the heap. In Sun's Java and HotJava environment, such "waste collection" runs as background threads, ensuring the efficiency of the system.
4. Storage area (MemoryArea)
The JVM mechanism has two important storage areas, namely the method area (methodarea) and the constant pool area (constantpoolarea).
The method area stores the binary bytecode of each method defined in the class. The constant pool area stores method names, class names, domain names, and string constants.
5. Instruction set (InstructionSet)
An instruction set is a collection of opcodes executed by JVM. The Java compiler is the program that converts the Java source program into JVM: a set of JVM instructions.
JVM instructions consist of an opcode (opcode) with zero, one, or two operands (operand). The length of the Operand is different, taking 8 bits as the basic length, and truncating the combination according to the order of BigEndian when it exceeds 8 bits, that is, the high bits are stored in the low address bytes and the low bits are stored in the high address bytes. The length of the opcode is 8 digits. This limits the maximum number of instruction types to 256 (28). At present, 160 kinds of operation codes have been defined and used, including stack operations, array operations, arithmetic operations, logical operations, data type conversion, control flow operations, breakpoints, exception handling and other rich and detailed content. I won't repeat them here.
On which five elements constitute the JVM structure to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.