Deep understanding of Java Virtual Machine-Chapter 10-early (compilation phase) optimization, deep understanding of virtual machines

Source: Internet
Author: User

Deep understanding of Java Virtual Machine-Chapter 10-early (compilation phase) optimization, deep understanding of virtual machines

Chapter 2 early (compilation period) Optimization

 

Javac compilation process:

1. parsing and filling the symbol table process

Lexical and syntax analysis converts the source code to a Token set. For example, the code "int a = B + 2" contains six tags: int a = B + 2

Fill symbol table

2. annotation Processor

3. Semantic Analysis and bytecode generation

The annotation check includes whether a variable has been declared before use, whether the data type between the variable and the value assignment can match, and an important action is called constant folding.

Data and control flow analysis further verifies the context logic of the program, it can check whether the program's local variables are assigned a value before use, whether each path of the method has a return value, and whether all the checked exceptions are correctly handled.

Syntactic sugar generics, variable length parameters, automatic packing/unpacking, etc.

The generic type in java only exists in the program source code. It is replaced with the original native type in the compiled bytecode, and the forced type conversion code is inserted in the corresponding place.

Bytecode generation

 

Related Article

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.