这里主要对JVM作为虚拟机器与真实机器在架构实现方面的差异进行一个比较,以便形成新的认知:

  • Stack-based virtual machine

    The most popular computer architectures such as Intel x86 Architecture and ARM Architecture run based on a register. However, JVM runs based on a stack.

  • Symbolic reference

    All types (class and interface) except for primitive data types are referred to through symbolic reference, instead of through explicit memory address-based reference.

  • Garbage collection

    A class instance is explicitly created by the user code and automatically destroyed by garbage collection.
    Guarantees platform independence by clearly defining the primitive data type: A traditional language such as C/C++ has different int type size according to the platform. The JVM clearly defines the primitive data type to maintain its compatibility and guarantee platform independence.

  • Network byte order

    The Java class file uses the network byte order. To maintain platform independence between the little endian used by Intel x86 Architecture and the big endian used by the RISC Series Architecture, a fixed byte order must be kept. Therefore, JVM uses the network byte order, which is used for network transfer. The network byte order is the big endian.

参考

  1. https://dzone.com/articles/understanding-jvm-internals
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐