7: Java compilation and JIT compilation

Source: Internet
Author: User

When "Compilation" is mentioned in Java, it is naturally easy to think that the Javac compiler will *. compile the java file *. class file process, other front-end compilers, such as the incremental compiler ECJ in Eclipse JDT. Correspondingly, it converts bytecode into machine code during program running. In addition, sometimes it may encounter a Static advance Compiler (AOT, Ahead Of Time Compiler) to directly convert *. java file compilation costs machine code, such as GCJ, Excelsior JET, which we should rarely encounter.


,

In both cases, the compiler uses the entire method as the compilation object, which is also the Standard Compilation Method in the virtual machine. You need to know whether a piece of code or method is hotspot code, whether it needs to trigger instant compilation, and whether it needs

  • The virtual opportunity that uses this method regularly checks the stack top of each thread. If you find that some methods often appear at the top of the stack, the code of this method is "Hotspot code ". The advantage of this method is that it is simple and efficient, and can easily obtain the method call relationship. The disadvantage is that it is difficult to accurately confirm the popularity of a method, hot Spot Detection is easily disturbed by thread congestion or other external factors.
  • The virtual opportunity to use this method creates counters for each method, or even code block, and counts the number of executions of the method. If the number of executions exceeds a certain threshold, it is considered as a "hot method ". This statistical method is more complex. You need to establish and maintain counters for each method, and you cannot directly obtain the call relationship of the method. However, its statistical results are more accurate and rigorous.


 

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.