Home >

Computer Programming Is The Process Of Telling You How We Compile The Pages We Visit Every Day.

2019/9/1 8:48:00 321

ComputerProcessPage

Computer programming is the process of telling you how we compile the pages we visit every day.

Machine's awakening of force





This story starts with the language of the computer.

In fact, the earliest words in human civilization are numbers, 500-1000 years earlier than complete ideographic texts.

With the development of human society, social structure began to become complex. Taxation must first collect data on national income, property, payment, arrears, debts, fines, far exceeding the memory system of human brain. So the number was born.

5000 years ago, Sumerian civilizations (6 and 10 were used as the base to express 1, 10, 60, 600, and 3600 by symbols. Today, we still use the number of 6 cardinal numbers, for example, the circle has 360 degrees, and there are 24 hours in a day.

The other is called Andes culture (mainly in today's South America). It uses "knot line" to record figures and to manage financial data such as taxes for hundreds of years or even thousands of years. Even after the Spanish occupation of South America, they managed to manage their new empire in a rather short period of time. This is the earliest language of mankind. Although it can not pass the spoken language or write poetry, the efficiency of bookkeeping and collecting taxes is first-rate. In the eighth Century, Indians invented the number 0-9. This decimal numeric symbol makes data storage and processing efficient. It has become an important milestone in human civilization and laid the foundation of modern mathematics. Later, the Arabs promoted it to the Middle East and Europe, so we call it the "Arabia number". Another binary system, the binary system of "0" and "1", is another important milestone in human civilization, and is widely used in the modern computer field. In addition, the music we like, the movies we love, the pictures we take, are reproduced through this binary number today, including record, storage, dissemination and sharing. Human beings opened the machine civilization through 0 and 1, and the process of scientific revolution was like installing rockets. Why do computers use binary systems? This story goes back to the voyage of the British Empire. As early as in seventeenth Century, the United Kingdom, with its strong economic strength and naval strength, had many colonies and established a global hegemony. The sailing tables used by the fleet are complicated in computation, and the data calculated manually are often wrong. In the past hundred years, a large number of vessels have crashed into the rocks.

Until the first industrial revolution broke out, the British government found Charles Babbage, a mathematician, to correct the sailing table. Babbage developed the "difference machine" through ten years of hard work. Using the mechanical gears in the steam engine age to store data in the calculation process greatly improves the speed and accuracy of the navigation table data.

In the same period, he started another new machine -- the design of the analytical machine. In the process of developing the analytical machine, Babbage thought that multiplication is the repetition of addition, division is subtraction, subtraction can be replaced by addition, so as long as we design an adder. Based on this assumption, a computing machine can only operate with two functions:

1) determine the size of the two numbers.

2) repeated execution of additive calculations.

All operations are converted to the simplest judgment and calculation. 1 represents Yes (open), 0 indicates No (pass), and computer uses 0 and 1 for repeated computation. This is the theoretical basis for the computer to use the "0" and "1" binary languages.

It is worth mentioning that shortly after Babbag invented the analytical machine, British mathematician George Bull published Boolean algebra in 1854, and proposed the two element operation of logic, providing another important theoretical basis for modern electronic computers.

Back to the analytical machine, Babbag borrowed the punched cards used in French textile machines. The hole arrangement on the card controls the shuttle of the textile machine, and can continuously and repeatedly weave various kinds of beautiful patterns of cloth. With the help of Ada Lovelace, the famous poet Byron, Babbag discovered that punched cards can be used not only to record data, but also to control the instructions of machines. With different holes arranged on the card, the machine has different working procedures. This is the software design idea of modern computers.

Basic research and basic education are fundamental to the birth and revitalization of industry. This is why today's UK still has a very wide influence in the field of mathematics and communication.

In 1884, American statistical expert Hermann Hollerith (Herman Hollerith) invented the electric tabulating machine by using the principle of hole card, which was used in the US population statistics. He fixed all items needed to be fixed on a cardboard card and punched the statistical personal information of the residents in corresponding positions to represent "Yes". When the probe of the statistical machine hits the hole in the card, it will turn on the current, and the counting device will advance a scale. Dr He Leli uses the binary principle to efficiently measure the population information of the United States.

The answer card we use today adopts this principle. Dr. He Leli then created the Tabulating Machine Co, the predecessor of the famous IBM company.

In 1935, Alan Turing, the father of the famous modern computer science and the father of artificial intelligence, put forward the famous Turing machine model, which laid a theoretical foundation for the logical working mode of modern computers.

In 1937, Hood Aiken, a famous computer expert of Harvard University in the United States, with the assistance of IBM company, drew on the analysis theory of British mathematician Babbag mentioned above, developed the world's first electromechanical computer type Mark-I in 1944. IBM has sent the computer to Harvard University and has been making great contributions to the development of early computer scientists in 1959.

Another scholar is not so lucky. John Atanasoff, an associate professor of theoretical quantum physics at the Iowa State University, is suffering from the fact that no machine can solve many variables in quantum physics.

Also in 1937, he sought funding from IBM, but was flatly rejected. So he was determined to develop a better computing machine. He used the vacuum transistors that were developing at that time to represent "0" and "1" by electronic pulse. With the help of Clifford Berry, two people developed the world's first electronic computer at the end of 1940, and named it ABC (Atanasoff-Berry Computer) by two names. "Berry"

Btanasoff has opened up a new path for computers and laid an indelible foundation for the architecture of modern computers. HUAWEI today emphasizes the need for multi-path breakthroughs in research and development, perhaps inspired by this.

At the end of 1940, he met JohnW.Mauchly, an American physicist. After understanding and visiting the ABC computer, Mokri, an electrical expert at Moore College of University of Pennsylvania (J.PresperEckert), under the guidance of the Ministry of defense and Dr. von Neumann, successfully developed the world's first general electronic computer ENIAC in 1945.

Although the computer used decimal system, it did not affect its computing power at that time. It greatly shortened the research and development time of the "Manhattan plan" and accelerated the end of World War II.

In June 1945, von Neumann changed the decimal number of ENIAC electronic computer into binary, and put forward the concept of computer internal memory storage program, thus laying the foundation of modern electronic computer theory.

0 and 1 such minimalist language design, like injecting the "force" that has always been growing into computers, brings infinite possibilities. Similar to the IP routing concept in communication field, like "invisible steam engine", it has opened a new great industry with the simplest theoretical framework.

02

The "four pearl" of software Kingdom

In fact, before the birth of the computer, the role of the computer was played by women. These women are called Computers, and most of them are done by hand.

The first paragraph of the world is written by Byron Ada Lovelace, a famous female poet of Babbage, who mentioned above. The program designer has to arrange the program in 010101 forms, punch holes on the paper, and then send them to the machine to read. This reduces quite a lot of work. Writing a card can take a long time and avoid duplication of wheels.

So when programmers began to write these programs on cards, people started building libraries. As time went on, most of the programs gradually came up with some rule manuals to guide writing. But it is still very tedious. After all, writing and memorizing the combinations of 0 and 1 is quite a "heavenly book" for many people.

A legendary figure appeared.

The US Navy's legendary genius, Grace Hopper (Grace Hopper), was sent to Harvard University at the service of the Navy and worked with Dr. Ike, who was responsible for preparing the Mark-II electromechanical computer program funded by the US Department of defense. After the end of World War II, she joined the "Electronic Control Corporation" founded by Ekt and ENAIC, and began her glorious journey to change the world -- opening up a new world of compilers and programming languages.

Grace had an idea when he joined Ekt and the company. She wants to design a program that allows people to write what they want to do with similar grammar in English, and then translate the English into the language that the machine can execute and give it to the machine.

She put this revolutionary idea into practice and invented the world's first compiler A-0. This is the ancestor of the compiler and the ancestor of modern programming languages.

In 1952, Grace and Mo Li Li developed a computer language closer to natural language -- assembly language Flow-Matic. In essence, assembly language uses mnemonic to replace machine language 01010101, which takes a big step, but this language relies heavily on computer hardware. Unlike computers, assembly languages are not interlinked.

Since 1946, IBM has completely transformed the computer market from the tabulating machine, and invested heavily in attracting the world's top computer talents. One of them was John Bex (John W. Backus), a wealthy two generation who came from a stockbrokers' family. She loved mathematics. After joining IBM for three years, she invented a fast programming FORTRAN language. At the same time, he studied the compiler of Flow-Matic invented by Grace, and applied it to FORTRAN compiler.

The advent of FORTRAN has epoch-making significance in the history of computer science. It is the world's first high-level programming language, so that computer language from the original low-level assembly language to everyone understands the realm, the computer is no longer a scientist's patent. The birth of FORTRAN has bred the software industry. Since then, the computer high-level programming language has entered the vigorous development era.

Later, IBM developed the ALGOL high-level language. The John McCarthy, the father of artificial intelligence, released the LISP of artificial intelligence design language. Grace also developed COBOL language on the basis of Flow-Matic assembly language. John Macarthy.

FORTRAN is suitable for scientific computing, ALOGOL is suitable for transaction processing, LISP is suitable for AI computation, COBOL is suitable for business processing. Although these four high-level languages are simpler than assembly language, programming is still difficult for non computer professionals. As a result, two professors from the Dartmouth Institute jointly developed a simpler programming language called BASIC (the full range of symbolic instruction code for beginners).

This is a language that does not need to be compiled. It only needs to be executed by interpreter. The initial Android smartphone software draws on this mechanism. BASIC language is also the founder of Visual Basic language, which is widely used now. It can be used directly in Microsoft Excel's macro.

The development of American programming language is catching up with each other, and other countries are not resigned to it.

In 1963, University of Cambridge launched the CPL language, and later launched a simplified BCPL language.

In 1970, Ken Thompson laboratories (Ken Thompson) and Dennis Ricci (Dennis Ritchie) of Baer laboratories in the United States launched a simpler B language (taking the first letter of BCPL) on the basis of BCPL language, and then simplified the C language (taking BCPL second letters). This is one of the most commonly used programming languages in the world, or even the first big programming language.

After the C language, many famous languages were born, including:

It was officially released in C++:1983. Baer lab is based on C language, so C++ is fully compatible with C language.

Invented in the age of Objective-C:1980. In 1988, Steve Jobs (Steve Jobs) bought the authorization of Objective-C language in NeXT company, and later became the programming language of Apple Corp MAC computer and iPhone mobile phone.

Java:1995 was released in May. In order to solve the problem of cross platform in the process of intellectualization of TV set top boxes and other electronic products, SUN company has developed Java language. But Java needs to use virtual machine mechanism to explain source code and dispatch hardware resources. The basic language used by Android system is Java.

In June of C#:2000, it was released by Microsoft. C# is surprisingly similar to Java, and needs to run with Framework similar to the virtual machine; unlike Java, it supports all platforms while C# only supports Windows and Linux systems.

GO: Google was released in 2009. The GO language is mainly used for server side and cloud computing development.

Released by Apple Corp in Swift:2014, it can be mixed with Objective-C language.

Among them, C/C++ is a compiled language, that is, after the programmer has finished writing the program, it can compile directly into the machine code through the compiler and install it directly on the corresponding hardware device.

Java/C# is a pre compiled language, which means converting the source code (Source Code) into byte code (Byte Code) in the developer environment, then compiling or interpreting the byte code into the machine code that the hardware can understand by running on the device. The process of converting source code into bytecode is called pre compiling.

There are two very important members of the software Kingdom, the operating system and the database. In the 60s of last century, the development of advanced computer languages created fertile ground for the birth of operating systems and databases. In 1970, Baer laboratory B language and C language developer Ken Thompson (Ken Thompson) and Dennis Ricci (Dennis Ritchie) developed the world's first general computer system UNIX. Linux and Mac OS, now familiar, are UNIX like operating systems. Linux can run on servers and other large platforms, such as mainframe computers and supercomputers. The fastest 10 supercomputers in the world are operating systems based on the Linux kernel. The widely used Android operating system on mobile devices is also built on the Linux kernel. With the invention of disk, it is possible to access data from disk randomly. In 1961, the US Ge Corp successfully developed the world's first database management system (DBMS) - IDS (Integrated DataStore integrated data storage). In 1968, IBM developed IBM's first database system, IMS (Information Management System). IBM's thesis theory has made the famous Oracle database. The DB2 produced by IBM and the MS SQLServer database of Microsoft Corp have also become important roles in the database field, and have been widely applied all over the world. Advanced programming languages, compilers, operating systems and databases are known as the "four great pearls" of the software kingdom. The company that contributes the core technology to the software is mainly from Europe and the United States. After years of continuous R & D investment, HUAWEI has finally seen the backs of us giants.

03

If the computer is a car, then the software is like a car's control system. It is the blood of the computer. The compiler is the core gasoline combustion technology in the automobile engine, which turns the software into the power of the computer. Its compilation performance and efficiency directly determine the user experience.

As mentioned above, the earliest compiler is the A-0 compiler invented by Grace granny. The second compiler that is widely used is the FORTRAN compiler matching FORTRAN programming language. At present, the mainstream compiler is mainly composed of the following:

Windows system

Use the CL compiler. It is directly integrated into the developer environment of Visual Studio or Visual C++, and is not generally used alone.

Linux system

Use open source GCC compiler. GCC, founded by the Richard Matthew Stallman (RMS), a free software movement, was founded in the 80s of last century. Richard Matthew Stallman. It originally only processes C language, and subsequent extensions can handle other languages such as C++, Objective-C, Java and so on. GCC is considered the compiler's first choice for cross platform software.

Apple Mac and iOS system

The initial use of the GCC compiler has now been replaced by Clang + LLVM.

Why does Apple Corp need to change the compiler?

Because Apple discovered that the open-source GCC developers simply did not move, they did not want to optimize and improve the GCC code specifically for the requirements of Apple Corp, so Apple directly replaced the compiler backend to LLVM (Low Level Virtual Machine, the underlying virtual machine), and recruited the talented teenager Chris Ratner (Chris Lattner), who invented LLVM in 2003. After entering apple, Chris greatly optimized and improved LLVM to adapt to Objective-C's grammatical change and performance requirements. At the same time, CLang project was launched to replace GCC completely.

Today, GCC + LLVM has been replaced by Clang +LLVM. LLVM is responsible for the backend of the compiler, which is used to process code optimization and cross platform. Clang is responsible for front-end. It only needs to convert program source code into IR (Intermediate Representation, intermediate language) that LLVM can see.

In addition, the Swift language mentioned above is the third important work of Chris, a talented young boy, who contributed to the Apple Corp.

android

Android is mainly developed by pre compiled Java language. The original version runs through virtual machine without compiler, and subsequent versions add JIT and AOT compiler mechanism (the next part will expand in detail).

In addition to the above compiler, there are two famous compilers worth mentioning.

ICC compiler for Intel

The ICC compiler, the full name Intel C++ Compiler, is a C/C++/Fortran compiler set developed by Intel. It is suitable for Linux, Microsoft and Mac OS X operating system, and is widely used in high performance computing, distributed computing and other commercial computing areas.

Open64 compiler introduced by SGI and other companies

SGI (S represents supercomputer, G stands for graphics workstation, I stands for breakthrough insight) the supercomputers produced are mainly used in huge laboratories, using Open64 compiler.

04

Android's four largest gate of life talked about the development of computers and software, and finally came to the point.

The Android system has been from 1 in 2008 to 9 today. Over the past decade, Android has more than 15 large and medium versions. Since 2016, it has been integrated into the underlying innovative technologies such as file systems, artificial intelligence learning, intelligent hardware scheduling and memory management initiated by mobile phone companies such as HUAWEI, and Android mobile experience is no longer the same. Why are there still many people who criticised Android mobile for its lack of iPhone fluency? How does Android's system run? Here are four major Android gates. Solving Android's four vital gates is also the mission of HUAWEI's Ark compiler.

The first gate of life

Java's "virtual machine"

As mentioned earlier, in order to achieve cross platform operation, Java uses virtual machine to dispatch hardware platform resources. In virtual machines, it is also necessary to integrate interpreter or compiler to interpret Java bytecode (intermediate code) into machine understood machine language, or directly compile into 010101 machine code executed directly by machine.

In 2008, when Android 1.0 just released, it used a virtual machine called Dalvik, which integrated an interpreter. Every time users run APP on Android mobile phones, they will wake up the interpreter to explain to Android hardware what APP wants to do. This is equivalent to a press conference. A speaker speaks his native language, and then translates it into a foreign language that a foreign reporter understands. The efficiency is very low and he may not be able to ask a few questions in an hour.

Google realized that this problem seriously dragged the Android mobile rear legs, so through more than a year's efforts, released the 2.2 version in 2010, introduced the JIT (Just in Time, instant compilation) mechanism. JIT is more intelligent. When users run APP on Android phones, they will compile the functions that users often use to 010101 machine codes that can be directly executed by machines, without translating every sentence or sentence. When an unusual function occurs, the interpreter is called to translate.

JIT is smart, but every time you start APP, you need to compile it once and for all. In addition, the Dalvik virtual machine performance is relatively backward, so Google launched the Android 5.0 version in October 2014, replacing the virtual machine from Dalvik to ART (Android Run Time), and replacing the JIT compiler into AOT (Ahead JIT).

This means that when APP is installed on the phone after downloading, it can compile the compiled code into 101010 of the machine's understanding. The code that does not translate well is used to wake the interpreter to translate when the user is using it. The advantage of AOT compared to JIT is that you do not need to compile every time you open APP. However, the disadvantage is that the user installs APP for a long time.

More and more users Tucao why installation of a APP also slow down. So, in 2017, Google made a little improvement in Android 7.0. When it installed, it did not compile the intermediate code. Instead, it compiled part of the code that could be compiled into machine code when the user was idle, and compiled it through the AOT compiler. If AOT hasn't been compiled or compiled, wake up the JIT+ interpreter's two brothers. This mechanism is equivalent to exchanging space with time, which not only shortens the waiting time for users to install APP, but also optimizes the compiler and interpreter in virtual machine to the maximum efficiency.

Many people think that the HUAWEI ark compiler is the ART virtual machine of Android 7.0, which is not true. Whether the compiler or interpreter is just patching on the virtual machine. The virtual machine + compiler + interpreter on the phone itself not only takes up hardware resources, but also fails to maximize the performance of the software. Because of this, the vast majority of mobile phone manufacturers can only make up for the disadvantages of virtual machines by simply and brutally increasing the memory and storage space of Android phones. This is Android's first door of life, and the virtual machine is incongenitally deficient.

Second vital gates

Java's "original sin" -- additional JNI overhead

JNI, the full name Java Native Interface (Java native interface), is used to interact with code such as C/C++.

At present, 95% of TOP applications are developed by using mixed languages such as Java and C/C++. Java and C/C++ belong to two different languages, each with its own usage specification. In order for APP to run normally, it needs to interoperate with each other. This interfaced interface is JNI.

These two codes need to be invoked each other in data access, function invocation, lifecycle maintenance, exception handling, etc. This means that mobile phone hardware resources should be allocated to JNI for scheduling. Not only does it occupy hardware resources, but also the mechanism itself is inefficient.

This is the additional JNI overhead.

Third vital gates

Code optimization space is limited

The compiler of Android virtual machine is limited by mobile phone hardware and code optimization template, and the space of code optimization is limited. The compiler contains three parts. The front-end Front End is mainly responsible for translating the source code into IR (Intermediate Representation, intermediate expression). The Optimizer in the middle is mainly responsible for code optimization, optimizing the IR code that is translated from the front end, and the back end Back End compiles the optimized IR into 101010 machine code.

In order to prevent the ecology from being fragmented, Android has only opened a simple template for compiling code optimization for third parties, with limited space for code optimization.

Fourth vital gates

Java existing memory recovery mechanism is prone to intermittent carton.

When mobile phone memory resources are not enough, Android virtual machine will call GC (Garbage Collection) to block the highway, so that all mobile phones running Java thread "Stop World" are all suspended, waiting for it to recycle memory space, to avoid "traffic flow overload". The GC mechanism can not be precisely controlled and interfered, nor can users be able to remove it. So the poor performance of mobile phones still has intermittent "carton".

Over the past decade, through the continuous optimization of Android system and the continuous increase of memory, Android Mobile has constructed a user experience that is smooth enough.

But Android's four largest gate, like Damour's sword, hung on Android's head. HUAWEI scientists and engineers have been tackling it for ten years, only to rebuild Android.

05

Ten years ark, reinventing Android

Yes, HUAWEI has been preparing for this for ten years. In 2009, HUAWEI launched the basic technology research of 5G, and began to create a compilation group. The first batch of researchers at home and abroad joined.

In 2013, HUAWEI launched the self research compiler HCC for the base station area, and formally put forward the concept of compiler framework. In 2014, many experts from home and abroad joined HUAWEI, and the Ark Project was officially launched. In 2016, the compiler and programming language laboratory was set up. In 2019, the HUAWEI ark compiler was officially published. In the past ten years, every HUAWEI Software Engineer devoted herself to every research. Every progress is worth remembering. In May 2017, the first Java program "Hello World" ran through the ark compiler. In the morning of August 2017, in a laboratory in HUAWEI, the project team had been tackling the problem for 24 hours without interruption, but it never saw the return information of success. In desperation, the engineers printed all the communication data and checked them one by one. After correcting, HUAWEI's Ark ran through the first Android backstage service DiskStatus, which marked the operation of Android's replacement surgery. In the week before the Spring Festival of 2018, the ark compiler ran through all the backstage services of Android system and transplanted it to the mobile phone successfully. That night, everyone gathered in the lab room, waiting for the first boot screen to load the holy moment of success. Second hand tick is like a century, so the screen finally lights up. Cheering, hugging, jumping three feet tall, the project members did not hold back, leaving behind tears of excitement. Next, the project group launched the Beta test for the compilation of mobile phones on the eve of new year's Eve. On the morning of the first day of the lunar new year, the chief architect sent the first New Year message compiled by the compiler.

Happy Spring Festival, great ark!

When the "Ark" appeared in the P30 conference, it exploded in the Chinese software industry. Countless software practitioners from the beginning of doubt, to clarify the truth of the ark after the amazing...... These are tribute to HUAWEI software engineers for ten years like a day, bit by bit.

In fact, ark is no longer a universal translation from a high level language to a machine code in the traditional sense, but also a compilation and operation system.

On the one hand, the ark compiler lost its virtual machine for the first time in the Java field. It is also the first time in the history of software that Java/C/C++ and other mixed codes are compiled into machine code once and directly on the mobile phone, leaving the JNI extra cost of Java as a whole. It also completely bid farewell to the application process dropped by the virtual machine GC memory recovery, which greatly improved the operation fluency. If the latest Android system is harmony, then the Android system compiled by ark is high-speed railway, which is "Renaissance".

HUAWEI mobile directly replaced all backstage services of Android system-server directly through the ark compiler, which is enough to make HUAWEI EMUI faster than other Android systems. According to HUAWEI's official test, the ark compiler enhanced the mobile phone system's fluency by 24%, and the system response performance increased by 44%. Users of the P30 series should have experienced it.

On the other hand, the ark compiler uses space for performance, directly compilers compiler optimization to the developer environment, no longer limited by the hardware resources of the mobile phone, and provides unlimited possibilities for code optimization. In addition, after testing, Sina micro-blog extreme speed version APP was compiled by ark, and the operation fluency increased by 60%. To solve Android's four largest gate, Android, better than Android, surpass iOS, and fully compatible with Android, this is the mission of the HUAWEI ark compiler.

06

Born to destroy the virtual machine ark compiler, from the beginning of the project, is to completely destroy the virtual machine. No one has ever done this in history.

SUN invented the Java language at first, which is to use virtual machine's "universal transfer station" to shield the difference of various hardware and facilitate the same code to run on multiple platforms. So Java is one of the most popular high-level programming languages at present. For so many years, no one has ever been able to get rid of the virtual machine.

How did the ark compiler completely destroy the virtual machine?

The key is to be able to directly compile Java code into 010101 machine code.

This assumption is feasible in theory, but it is too difficult in reality. There have been some attempts in history, such as Android ART virtual machine, which is now popular. These attempts can translate many static semantics in the Java language ahead of time, but most of the dynamic semantics are still uncertain and have to be handed to the virtual machine.

The so-called static semantics can be understood as definite language and meaning, such as "I am Zhang San". The dynamic semantics needs to be understood in context, such as "how much you can wear," and whether you wear more or less, depending on whether it is winter or summer. For example, micro-blog, Jingdong and other APP open screen ads need dynamic semantics. Compiling dynamic semantics just like compiling static semantics, many of them do not think it is possible.

In order to achieve this goal, HUAWEI software engineers are demanding on themselves. This involves a lot of details, from the design of object models to the usage of each bit, the metadata metadata of each object (data describing data), and every compilation optimization design has undergone numerous heated discussions and overcoming. Finally, the ark compiler will solve the two major difficulties of static compilation and dynamic semantics through the two-way support of compilation stage and operation stage: first, design data models; two, how to get dynamic information efficiently at runtime. The ark compiler team basically traversed the dynamic semantics of Java and conducted large-scale data modeling. At the same time, it greatly improves the accuracy of dynamic semantic analysis in compile time, especially when it involves cross language invocation. In addition, HUAWEI designs a dynamic semantic matching mechanism with core patents, which effectively reduces the overhead of runtime dynamic semantics. Because of the breakthrough of these two difficulties, the ark compiler can compile Java code into a language that the machine can execute directly. After the HUAWEI ark compiler's APP, no longer need to compile on the phone, completely bid farewell to the virtual machine, thus bringing a comparable or even beyond the iOS Android experience.

07

Code "Wan Tong Tong"

95% of the Top applications are written in mixed languages like Java/C/C++. The second mission of the ark compiler is to get rid of the JNI overhead caused by mixed language calls.

Based on the deep understanding and extensive research and development of multiple programming languages, the HUAWEI ark compiler team has achieved a unified intermediate expression of IR, which means that the same person can understand the language of the world, so we call this revolutionary breakthrough the code "Wan Guo Tong".

How does the ark compiler use a unified IR to represent all kinds of languages?

IR is used to represent the data structure of code. It is the "protocol and common language" used to transmit information between modules and related tools of the compiler. It is also the carrier of various algorithms for program transformation and compilation optimization. It is the "brain" of the compiler, which directly determines the final effect of the compiler. Its difficulty is the highest.

The HUAWEI ark compiler team has been working on IR for five years, and gradually found out the signal rules of every nerve and every neuron in the brain. On the basis of this, a set of core patents was invented, so that different language codes can be compiled into the same set of machine codes that can be executed directly in the developer environment, so as to eliminate the cost of calling each other in the mixed language.

08

Install the airplane engine for the code.

Besides IR, the compiler has a very important value, that is, code optimization.

The HUAWEI ark compiler directly moved the code optimization from the mobile link to the developer environment, and could move to the cloud in the future. Using the powerful power of the developer environment, we can achieve more advanced and refined optimization algorithm to achieve more powerful optimization effect, and enhance the code optimization in many specific scenarios.

This is equivalent to APP installed in the ark of the aircraft engine, so that your APP running like flying!

It is worth mentioning that developers do not need to change their coding habits using the ark compiler. Developers can develop code optimization algorithms on their own, or code optimization only through the preset algorithm of ark compiler. In the future, HUAWEI will also provide code tuning tools. Developers can choose to adjust the code according to the optimization suggestions of the tool, and cooperate with the ark compiler to achieve better execution results.

It can be imagined that after the vast number of APP developers use the ark compiler, the experience of consumers will reach an unprecedented level. This is an unprecedented blessing for the entire Android ecosystem.

09

Stop World, Android Caton, goodbye.

The fourth mission of the ark is to solve the "Stop World" brought by the GC memory recovery of Android virtual machine.

At present, Android mobile memory resources are not enough, GC directly halt all applications, so occasionally encounter inexplicable Caton.

The ark compiler uses RC (Reference Counting) to retrieve the memory in real time, and uses a special elimination loop algorithm to eliminate the problem of non recoverable objects caused by the mutual referencing of objects, so as to avoid the systematic centering of GC centralized recovery. Compared with GC, the memory recovery of the ark is real-time rather than centralized, and there is no need to suspend the application process. This greatly eliminates Caton.

If we compare the memory recovery to the cleaning room, GC's strategy is to have a hygienist specially, and to see that there are too many rubbish in the room. Please go out and clean up and let everyone come back. The Ark's RC is for everyone to clean up their garbage, clean it up and keep it clean, without affecting normal activities.

The software has a familiar cycle of death, that is, the computer is occupied by computer resources by an infinite cycle of running programs.

This "dead circle" is called "ring reference" in software. In order to avoid the "eat" of mobile phone memory by ring, the ark compiler introduced the alarm mark of annotation to label the basic class ring. Of course, Java programmers can also annotate the rings in business code. After extensive practice, the mechanism of ark can reduce the appearance of most programs.

On the other hand, the ark compiler has introduced an efficient loop recovery mechanism in the running state to allow selective intelligent recovery of the memory footprint of a APP, which is a great improvement to the traditional loop recovery algorithm.

Stop World, Android Caton, goodbye!

It is precisely because the ark achieves unified language representation and complete static compilation of mixed languages that it eliminates the virtual machine, eliminates JNI overhead, and says goodbye to the "intermittent" Catton of GC memory recovery and many other overhead. At the same time, it provides a broader stage for developers to optimize code.


HUAWEI will soon be a comprehensive open source ark compiler, when developers can use the ark compiler as a development tool to open a brand new door for the ecology and experience of mobile applications. The progress of science and technology is inseparable from the dedication of countless scientists and engineers all over the world. Industrial prosperity, opening up is the only way out!

  • Related reading

Entrepreneurial Guidance: What Aspects Of Clothing Shop Decoration Should Be Noticed?

Entrepreneurial path
|
2019/8/27 18:49:00
0

Clothing Store Shop Decoration Design Points!

Entrepreneurial path
|
2019/8/23 17:46:00
0

What 10 Major Misconceptions Should Be Avoided To Locate Women's Brand Franchised Stores?

Entrepreneurial path
|
2019/8/23 17:45:00
0

It's Important To Choose A Location In A Commercial Street.

Entrepreneurial path
|
2019/8/20 18:38:00
0

We Need To Know These Points When We Start Our Business.

Entrepreneurial path
|
2019/8/20 18:33:00
0
Read the next article

Qiao Bi Luo Refused To Admit That Stealing Beauty Pictures Is What Happened? Actually, He Said That The Other Party Had Become A Net Red Because Of Her Heat.

Speaking of Joe Bel, no need to say more about her things, everyone is not familiar with it, it can be said to have broken the bottom line of netizens' understanding of net red. After that, Qiao Bi has been exposed.