AOT - Mono Project
文章推薦指數: 80 %
Ahead of Time Compilation or AOT is a feature of the Mono runtime code generator. The Mono code generator can operate in two modes: Just-in-Time compilation ...
Mono
Menu
Home
Download
Documentation
News
Community
Youarehere:docs
advanced
aot
Tableofcontents
Tableofcontents
AOT
EditpageonGitHub
AheadofTimeCompilationorAOTisafeatureoftheMonoruntimecodegenerator.
TheMonocodegeneratorcanoperateintwomodes:Just-in-TimecompilationorJIT,andAhead-of-TimecompilationorAOT.
AOTcompilationworksintwostages.Thefirststageconsistsofprecompilingtheassemblies.Thisisamanualprocessthatindividualdeploymentsmustdo.Thesecondstageisautomatic,theMonoruntimewillautomaticallyloadanyprecompiledcodethatyouhavegenerated.
GeneratingAOTcodefromanassemblyisverysimple,justinvoketheMonoruntimewiththe--aotflag,likethis:
mono--aotprogram.exe
Thiswillgenerateafilecalled“program.exe.so”,whichcontainsthenativecodethatwasprecompiledbyMonoformostoftheILmethods.The--aotflagbydefaultwilllimititselftoILmethodswhichwillgiveyouthemostbenefits,butwillnotcompileabsolutelyeverythingyouneed.Seebelowformoredetails.
AlthoughtheJITmodeisveryfast,andthedefaultoptimizationsinMonohavebeentunedtoprovideagoodbalancebetweenoptimizationsandJITspeed,AOTcompilationprovidesafewextrabenefits:
Reducedstartuptime.
Increasedmemorysharing.
Potentialbetterperformance.
Tableofcontents
1FullAOT
1.1KnownLimitations
1.1.1Limitation:Platform
1.1.2GenericValueTypeSharing
2SupportedPlatforms
3ReducedStartupTime
4IncreasedMemorySharing
5PotentialBetterPerformance
6Limitations
7Discussion
8AOTingallthesystemlibraries
FullAOT
Insomeoperatingsystemconfigurations(mostlyembeddedsystems)theoperatingsystemservicesforgeneratingcodedynamicallyarenotavailable,thispreventsMono’sJITfromworking.Inthosesystems,youcanuse--aot=fulltoensurethatMonoprecompileseverything,andthenusetheoption--full-aottoensurethatMononeverusestheJITengine.
#DoafullAOT:
$mono--aot=fullmscorlib.dll
$mono--aot=fullsample.exe
#Run,butrequestthatMononevertriestoJIT:
$mono--full-aotsample.exe
FullAOTisafairlystraightforwardprocessexceptinthecaseofgenericinstantiations.InthosecasesMonomustperformastaticanalysisofthecodeanddetermineallofthepossibleinstantiationsofatypeandgeneratethecoderequired.ForexampleifaprogramusesaList
延伸文章資訊
- 1Using the Ahead-of-Time (AOT) Compiler | Pluralsight
The Ahead-of-Time (AOT) Compiler ... We can decrease the size of the build and compile it at the ...
- 2AOT - Mono Project
Ahead of Time Compilation or AOT is a feature of the Mono runtime code generator. The Mono code g...
- 3Ahead-of-time compilation - Wikipedia
In computer science, ahead-of-time compilation (AOT compilation) is the act of compiling an (ofte...
- 4Just-in-Time (JIT) and Ahead-of-Time (AOT) Compilation in ...
An ahead-of-time (AOT) compiler converts your code during the build time before the browser downl...
- 5[技術支援-5] 佈署方式JIT及AOT介紹 - iT 邦幫忙
AOT(Ahead-of-Time):在程式發佈之前就透過Angular Compiler 進行編譯,所以瀏覽器下載完的 *.js 檔案,就可以直接被執行,然後渲染畫面。 下表為這兩種佈署方式的...