小任班长的博客 - The principle of the Ark compiler
type: channel
link: https://cnxiaocheng.top/tag/The-principle-of-the-Ark-compiler/
items: How does the Huawei Ark compiler solve the problem? The principle of the Ark compiler

How does the Huawei Ark compiler solve the problem? The principle of the Ark compiler
type: item
date: 2019-08-11T09:00:00+08:00
description: How does the Huawei Ark compiler solve the problem? The principle of the Ark compilerBefore answering this question, let's take a look at the timeline in which Huawei works for the Ark compiler:In 2009, Huawei started the development of 5G basic technology research and began to create a compilation group. The first batch of researchers at home and abroad joined.In 2013, Huawei launched the self-developed compiler HCC for the field of base stations, and formally proposed the compiler framework.In 2014, many experts at home and abroad joined Huawei and the Ark project was officially launched.In 2016, the Compiler and Programming Language Lab was established.In 2017, the first Java program "HelloWorld" on the Ark compiler runs.One week before the Spring Festival in 2018, the Ark compiler ran through all the backend services of the Android system and successfully ported it to the phone.In April 2019, the Huawei Ark compiler was announced at the domestic conference of the P30 series.So, how is the principle of the Ark compiler implemented?In fact, Huawei's so-called "Ark compiler" is not so much a compiler, it is a compile and run system; the operation of this system requires the cooperation environment and the terminal (that is, smart phone), the purpose is to bypass Android The virtual machine that the App must run on in the operating system, compile the mixed code such as Java/C/C++ into the machine code and run it directly on the mobile phone, completely bid farewell to the Java JNI overhead, and completely bid farewell to the virtual machine's GC memory. The application process caused by the recycling is dropped - thus ultimately achieving the smoothness of the Android operating system.As mentioned above, in this implementation of the Ark compiler, four aspects need to be solved.First: compile Java code directly into machine codeAs far as the current situation is concerned, the problem that Java has to compile into machine code is the dynamic semantics in Java (corr…