Structure parsing of JVM--java bytecode

Source: Internet
Author: User

The main structure of the Java bytecode file is divided into several parts:the class file header, the Chang area, the current class description information, the field list, the method list, and the attribute list .

class file Header

The contents of the first four bytes of any class file are CA FE BA be. Java is a kind of coffee, so called coffee baby. This four bytes is used as the checksum for the file. --"4

Next is the version information for the JDK, with two bytes representing the lowest version of the JDK and the highest version of the two-byte jdk. --"4

Constant pool area

Each item in a constant pool consists of two parts: one byte flags his type, then the content, and the content is not the same width. This content first records the position of his real content in another constant pool by two bytes. Called a constant pool entry.

Description information for the class

An access flag for the two-byte flag class. Public Private ... Two bytes flags the position of the class name in the constant pool. Two bytes flag the position of its parent class in the constant pool. The number of interfaces is then marked with two bytes. Next, a constant pool entry for each interface is listed, each of which accounts for two bytes.

Field List

  The number of two-byte fields. Next is the individual properties, which all have the same internal structure (attribute name, property type, number of attached properties, attached property).

Method List

  The number of two-byte methods. Similarly each method describes the internal structure identically.

Next is the description of the method body, the number of attributes, the length, the stack size, the local variables, the code list (the information that describes the actual code snippet).

Where the code list has its own internal structure: stack, local variable, code length, exception list

  

Structure parsing of JVM--java bytecode

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.