Home > Java > javaTutorial > body text

What is the concept of JVM instruction system in java

WBOY
Release: 2023-05-03 19:01:11
forward
789 people have browsed it

1. Instruction system description

The JVM instruction system is very similar to other computer instruction systems. At the same time, Java instructions also include two parts: opcode and operand. The opcode is an 8-bit binary number followed by an operand whose length is determined as needed. The operation code is used to specify the nature of the instruction operation (here we explain it in the form of assembly symbols). For example, iload means loading an integer from memory, anewarray means allocating space for a new array, and iand means the "AND" of two integers. ,ret represents process control, returned from a call to a method. When the length exceeds 8 bits, the operand is divided into multiple bytes for storage. For this situation, the JVM adopts the "bigendian" encoding method, that is, the high bits are located in the low bytes. This situation is the same as the encoding method used by Motorola and RISCCPU, but different from the "littleendian" encoding method used by Intel, that is, the low-order bits store the low-order bytes.

The java command system is designed for implementing the Java language. It contains instructions for calling methods and monitoring multi-priority systems. The length of the 8-bit opcodes in the JVM brings the JVM to a maximum of 256 instructions, and now more than 160 instructions are used.

2. Commonly used registers

All CPUs contain a register group that is used to save system status and information required by the processor. When a virtual machine defines more registers, more information can be obtained from them without accessing the stack or memory, which helps improve running speed. However, if the number of registers in the virtual machine exceeds the number of actual CPUs, then a large amount of processor time will be spent simulating the registers with conventional memory when implementing the virtual machine, which will actually reduce the efficiency of the virtual machine. For this, the JVM only sets the 4 most commonly used registers. They are:

(1) pc program counter

(2) optop operand stack top pointer

(3) frame current execution environment pointer

(4) vars points to the pointer to the first local variable in the current execution environment

All registers are 32 bits. pc is used to record the execution of the program. optop, frame and vars are used to record pointers to the Java stack area.

What are the basic data types of java

The basic data types of Java are divided into:

1. Integer type, used to represent the data type of integer.

2. Floating point type, a data type used to represent decimals.

3. Character type. The keyword of character type is "char".

4. Boolean type is the basic data type that represents logical values.

The above is the detailed content of What is the concept of JVM instruction system in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!