Java Virtual machine stack and local method stack

Source: Internet
Author: User

Features of the Java Virtual machine stack

Thread Private

Last in, first out (LIFO) stacks

Storage stack frames, support for Java method invocation, execution, and exit

OutOfMemoryError and Stackoverflowerror exceptions may occur

Features of the Java native method stack

Thread Private

Last in, first out (LIFO) stacks

The function is to support the invocation, execution, and exit of the native method.

OutOfMemoryError and Stackoverflowerror exceptions may occur

Some virtual machines, such as hotspots, merge the Java Virtual machine stack and the local method stack to implement

Concept and characteristics of stack frames

The content stored in the Java Virtual machine stack, which is used to store data and data structures for partial process results, and also to handle dynamic links, method return values, and exception dispatch

A complete stack frame contains: local variable table, operand stack, dynamic connection information, method of normal completion information and method exception completion information

Local variable table concepts and features

Consists of several slots, the length of which is determined by the compilation period

A single slot can store data of type boolean,byte,char,short,float,reference and ReturnAddress, and two slots can store data of a type long or double

Local variable tables are used for inter-method parameter passing, as well as for values that store the underlying data type and references to objects during method execution

Concept and characteristics of the operand stack

is a last-in-first-out stack consisting of several entry, the length of which is determined by the compilation period

A single entry can store values for any data type defined in a Java virtual machine, including the long and double types, but the entry depth of the stored long and double types is 2, and the other types have a depth of 1

During the execution of the method, the stack frame is used to store the calculation parameters and the results of the calculation; When the method is called, the operand stack is also used to prepare the parameters of the calling method and the Receive method to return the result

Java Virtual machine stack and local method stack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.