Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

And parsing Java virtual machine concepts and data types

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Today, I will talk to you about and analyze the concepts and data types of Java virtual machines, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Are you familiar with the concept of the Java virtual machine? here is a description that the Java virtual machine is an imaginary machine, realized by software simulation on a real computer. The Java virtual machine has its own imaginary hardware, such as processors, stacks, registers, etc., as well as corresponding instruction systems.

What is a Java virtual machine

The Java virtual machine is an imaginary machine, which is realized by software simulation on the actual computer. The Java virtual machine has its own imaginary hardware, such as processors, stacks, registers, etc., as well as corresponding instruction systems.

1. Why use the Java virtual machine?

A very important feature of Java language is its platform independence. The use of Java virtual machine is the key to realize this feature. If a general high-level language is to run on different platforms, it needs to at least be compiled into different object code. After the introduction of Java language virtual machine, Java language does not need to be recompiled when running on different platforms.

The Java virtual machine shields the information related to the specific platform, so that the Java language compiler only needs to generate the object code (bytecode) running on the Java virtual machine and can run on a variety of platforms without modification. When executing the bytecode, the Java virtual machine interprets the bytecode as the execution of machine instructions on the specific platform.

two。 Who needs to know about the Java virtual machine

The Java virtual machine is the basis of the underlying implementation of the Java language, and anyone interested in the Java language should have a general understanding of the Java virtual machine. This helps to understand some of the nature of the Java language, as well as to use the Java language.

For the software personnel who want to implement the Java virtual machine on a specific platform, the compiler writers of the Java language and those who want to implement the Java virtual machine with hardware chips, they must have a deep understanding of the specification of the Java virtual machine.

In addition, if you want to extend the Java language, or compile other languages into Java bytecode, you also need to learn more about the Java virtual machine.

Data types supported by 3.Java virtual Machin

The basic data types that the Java virtual machine supports the Java language are as follows:

The complement of byte://1 byte signed integers

The complement of short://2 byte signed integers

The complement of int://4 byte signed integers

The complement of long://8 byte signed integers

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 checking is done at compile time. The data of the raw data types listed above does not need to be marked with hardware when executed by Java. The bytecode (instruction) that manipulates these raw data types already indicates the data types of operands, such as iadd, ladd, fadd, and dadd instructions, which add two numbers, especially int, long, float, and double.

The virtual machine does not set separate instructions for the boolean (Boolean) type. Boolean data is processed by integer instructions, including integer returns. Boolean arrays are processed with byte arrays.

The virtual machine uses floating-point numbers in IEEE754 format. Older computers that do not support the IEEE format may be very slow when running the Java numerical calculation program.

Other data types supported by virtual machines include:

Object// references returnAddress//4 bytes to the 4 bytes of a Javaobject (object) for use in jsr/ret/jsr-w/ret-w instructions

Note: Java arrays are treated as object.

The specification of virtual machines does not have any special requirements for the internal structure of object. In Sun's implementation, a reference to object is a handle that contains a pair of pointers: one pointer to the object's method table and the other to the object's data.

Programs represented by the bytecode of the Java virtual machine should comply with the type rules. The implementation of the Java virtual machine should refuse to execute bytecode programs that violate the type specification.

The Java virtual machine seems to run only on machines in 32-bit address space due to bytecode definition limitations. But you can create a Java virtual machine that automatically converts bytecode into 64-bit form.

From the data types supported by the Java virtual machine, we can see that Java strictly regulates the internal format of the data type, which makes the interpretation of the data in the implementation of various Java virtual machines the same, thus ensuring the platform independence and portability of Java.

After reading the above, do you have any further understanding of Java virtual machine concepts and data types? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report