fbpx
Wikipedia

Ahead-of-time compilation

In computer science, ahead-of-time compilation (AOT compilation) is the act of compiling an (often) higher-level programming language into an (often) lower-level language before execution of a program, usually at build-time, to reduce the amount of work needed to be performed at run time.

Most often, It is associated with the act of compiling a higher-level programming language such as C or C++, or an intermediate representation such as Java bytecode or .NET Framework Common Intermediate Language (CIL) code, into a native (system-dependent) machine code so that the resulting binary file can execute natively, just like a standard native compiler. When being used in this specific context, it's often seen as an opposite of just-in-time (JIT) compiling.

Speaking more generally, the target languages of an AOT compilation are not necessarily specific to native machine code but are defined rather arbitrarily. Some academic papers use this word to mean the act of compiling the Java bytecode to C[1] or the timing when optimization pipeline are performed.[2] An academic project[3] uses this word to mean the act of pre-compiling JavaScript to a machine-dependent optimized IR for V8 (JavaScript engine)[4] and to a machine independent bytecode for JavaScriptCore.[5] Some industrial language implementations (e.g. Clojure[6] and Hermes JavaScript engine[7]) use this word to mean the act of pre-compiling the source language to VM specific bytecode. Angular (web framework) uses this word to mean converting its HTML template and TypeScript to JavaScript.[8]

In fact, since all static compilation are technically performed ahead of time, this particular wording are often used to emphasize some kind of performance advantages from the act of such pre-compiling. The act of compiling Java to Java bytecode is hence rarely referred to as AOT since it's usually a requirement, not an optimization.

Reduced runtime overhead

Some programming languages with a managed code runtime that can be compiled to an intermediate representation, use just-in-time (JIT) compiling. This, briefly, compiles intermediate code into machine code for a native run while the intermediate code is executing, which may slow an application's performance. Ahead-of-time compiling eliminates the need for this step by occurring before execution rather than during execution.

Ahead-of-time compiling for dynamically typed languages to native machine code or other static VM bytecode is possible in a limited number of cases only.[citation needed] For example, the High Performance Erlang Project (HiPE) AOT compiler for the language Erlang can do this because of advanced static type reconstruction techniques and type speculations.

In most situations with fully AOT compiled programs and libraries, it is possible to remove part of a runtime environment, thus saving disk space, memory, battery life, and startup times (no JIT warmup phase), etc. Because of this, it can be useful in embedded or mobile devices.

Performance trade-offs

AOT compilers can perform complex and advanced code optimizations, which in most cases of JITing will be considered much too costly. In contrast, AOT usually cannot perform some optimizations possible in JIT, like runtime profile-guided optimization (PGO), pseudo-constant propagation, or indirect-virtual function inlining. AOT must compile to a target architecture, while a JIT can compile the code to make the best use of the actual CPU it is running on, even years after the software has been released.

Further, JIT compilers can speculatively optimize hot code by making assumptions on the code. The generated code can be deoptimized if a speculative assumption later proves wrong. Such operation slows the performance of the running software until code is optimized again by adaptive optimization. An AOT compiler cannot make such assumptions and needs to infer as much information as possible at compile time. It needs to resort to less specialized code because it cannot know what types will go through a method. Such problems can be alleviated by profile-guided optimizations. But even in this case, the generated code cannot be adapted dynamically to the changing runtime profile as a JIT compiler would do.

Storage trade-offs

See also

References

  1. ^ Jung, Dong-Heon; Park, Jong Kuk; Bae, Sung-Hwan; Lee, Jaemok; Moon, Soo-Mook (2006-10-22). "Efficient exception handling in Java bytecode-to-c ahead-of-time compiler for smbedded systems". Proceedings of the 6th ACM & IEEE International Conference on Embedded Software. EMSOFT '06. Seoul, Korea: Association for Computing Machinery: 188–194. doi:10.1145/1176887.1176915. ISBN 978-1-59593-542-7. S2CID 15591457.
  2. ^ Chambers, Craig (2002-01-14). "Staged compilation". Proceedings of the 2002 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation. PEPM '02. Portland, Oregon: Association for Computing Machinery: 1–8. doi:10.1145/503032.503045. ISBN 978-1-58113-455-1. S2CID 18546907.
  3. ^ Zhuykov, R.; Sharygin, E. (2017-01-01). "Ahead-of-time compilation of JavaScript programs". Programming and Computer Software. 43 (1): 51–59. doi:10.1134/S036176881701008X. ISSN 1608-3261. S2CID 2338849.
  4. ^ ispras/v8-aotc, Ivannikov Institute for System Programming of the Russian Academy of Sciences, 2021-01-30, retrieved 2021-03-17
  5. ^ ispras/webkit-aotc, Ivannikov Institute for System Programming of the Russian Academy of Sciences, 2021-01-30, retrieved 2021-03-17
  6. ^ "Clojure - Ahead-of-time Compilation and Class Generation". clojure.org. Retrieved 2021-03-17.
  7. ^ "Hermes: A new open source JavaScript engine optimized for mobile apps". Facebook Engineering. 2019-07-12. Retrieved 2021-03-17.
  8. ^ "Angular". angular.io. Retrieved 2021-03-17.

External links

  • Speed: NGen Revs Up Your Performance with Powerful New Features – MSDN Magazine, April 2005
  • Mono AOT
  • AOT compilation of asm.js
  • Real-time Java, Part 2: Comparing compilation techniques – IBM developerWorks, April 2007
  • Improving Swing Performance: JIT vs AOT Compilation – LinuxWorld Magazine, November 2004 2008-06-12 at the Wayback Machine

ahead, time, compilation, this, article, includes, list, general, references, lacks, sufficient, corresponding, inline, citations, please, help, improve, this, article, introducing, more, precise, citations, february, 2014, learn, when, remove, this, template,. This article includes a list of general references but it lacks sufficient corresponding inline citations Please help to improve this article by introducing more precise citations February 2014 Learn how and when to remove this template message In computer science ahead of time compilation AOT compilation is the act of compiling an often higher level programming language into an often lower level language before execution of a program usually at build time to reduce the amount of work needed to be performed at run time Most often It is associated with the act of compiling a higher level programming language such as C or C or an intermediate representation such as Java bytecode or NET Framework Common Intermediate Language CIL code into a native system dependent machine code so that the resulting binary file can execute natively just like a standard native compiler When being used in this specific context it s often seen as an opposite of just in time JIT compiling Speaking more generally the target languages of an AOT compilation are not necessarily specific to native machine code but are defined rather arbitrarily Some academic papers use this word to mean the act of compiling the Java bytecode to C 1 or the timing when optimization pipeline are performed 2 An academic project 3 uses this word to mean the act of pre compiling JavaScript to a machine dependent optimized IR for V8 JavaScript engine 4 and to a machine independent bytecode for JavaScriptCore 5 Some industrial language implementations e g Clojure 6 and Hermes JavaScript engine 7 use this word to mean the act of pre compiling the source language to VM specific bytecode Angular web framework uses this word to mean converting its HTML template and TypeScript to JavaScript 8 In fact since all static compilation are technically performed ahead of time this particular wording are often used to emphasize some kind of performance advantages from the act of such pre compiling The act of compiling Java to Java bytecode is hence rarely referred to as AOT since it s usually a requirement not an optimization Contents 1 Reduced runtime overhead 2 Performance trade offs 3 Storage trade offs 4 See also 5 References 6 External linksReduced runtime overhead EditSome programming languages with a managed code runtime that can be compiled to an intermediate representation use just in time JIT compiling This briefly compiles intermediate code into machine code for a native run while the intermediate code is executing which may slow an application s performance Ahead of time compiling eliminates the need for this step by occurring before execution rather than during execution Ahead of time compiling for dynamically typed languages to native machine code or other static VM bytecode is possible in a limited number of cases only citation needed For example the High Performance Erlang Project HiPE AOT compiler for the language Erlang can do this because of advanced static type reconstruction techniques and type speculations In most situations with fully AOT compiled programs and libraries it is possible to remove part of a runtime environment thus saving disk space memory battery life and startup times no JIT warmup phase etc Because of this it can be useful in embedded or mobile devices Performance trade offs EditAOT compilers can perform complex and advanced code optimizations which in most cases of JITing will be considered much too costly In contrast AOT usually cannot perform some optimizations possible in JIT like runtime profile guided optimization PGO pseudo constant propagation or indirect virtual function inlining AOT must compile to a target architecture while a JIT can compile the code to make the best use of the actual CPU it is running on even years after the software has been released Further JIT compilers can speculatively optimize hot code by making assumptions on the code The generated code can be deoptimized if a speculative assumption later proves wrong Such operation slows the performance of the running software until code is optimized again by adaptive optimization An AOT compiler cannot make such assumptions and needs to infer as much information as possible at compile time It needs to resort to less specialized code because it cannot know what types will go through a method Such problems can be alleviated by profile guided optimizations But even in this case the generated code cannot be adapted dynamically to the changing runtime profile as a JIT compiler would do Storage trade offs EditThis section needs expansion You can help by adding to it May 2021 See also Edit Computer programming portalasm js compiler JavaScript Bartok CIL Excelsior JET Java GNU Compiler for Java IL2CPU CIL Native Image Generator CIL RubyMotion Ruby References Edit Jung Dong Heon Park Jong Kuk Bae Sung Hwan Lee Jaemok Moon Soo Mook 2006 10 22 Efficient exception handling in Java bytecode to c ahead of time compiler for smbedded systems Proceedings of the 6th ACM amp IEEE International Conference on Embedded Software EMSOFT 06 Seoul Korea Association for Computing Machinery 188 194 doi 10 1145 1176887 1176915 ISBN 978 1 59593 542 7 S2CID 15591457 Chambers Craig 2002 01 14 Staged compilation Proceedings of the 2002 ACM SIGPLAN Workshop on Partial Evaluation and Semantics based Program Manipulation PEPM 02 Portland Oregon Association for Computing Machinery 1 8 doi 10 1145 503032 503045 ISBN 978 1 58113 455 1 S2CID 18546907 Zhuykov R Sharygin E 2017 01 01 Ahead of time compilation of JavaScript programs Programming and Computer Software 43 1 51 59 doi 10 1134 S036176881701008X ISSN 1608 3261 S2CID 2338849 ispras v8 aotc Ivannikov Institute for System Programming of the Russian Academy of Sciences 2021 01 30 retrieved 2021 03 17 ispras webkit aotc Ivannikov Institute for System Programming of the Russian Academy of Sciences 2021 01 30 retrieved 2021 03 17 Clojure Ahead of time Compilation and Class Generation clojure org Retrieved 2021 03 17 Hermes A new open source JavaScript engine optimized for mobile apps Facebook Engineering 2019 07 12 Retrieved 2021 03 17 Angular angular io Retrieved 2021 03 17 External links EditSpeed NGen Revs Up Your Performance with Powerful New Features MSDN Magazine April 2005 Mono AOT Excelsior JET Certified Java SE Implementation with AOT compiler GNU Compiler for Java AOT compilation of asm js Real time Java Part 2 Comparing compilation techniques IBM developerWorks April 2007 Improving Swing Performance JIT vs AOT Compilation LinuxWorld Magazine November 2004 Archived 2008 06 12 at the Wayback Machine Manta Retrieved from https en wikipedia org w index php title Ahead of time compilation amp oldid 1124873441, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.