Mono is a. NET tool that includes a C # compiler and a common language execution platform that can run on Winodws Linux mac Unix platforms with a virtual machine containing a real-time compilation engine, and Unity3d is using mono to achieve cross-platform estimation.
-
- CIL (Common Intermediate Language Universal Intermediate language)
CIL can run in any environment that supports the CLI (Common Language Infrastructure, Common Language Infrastructure), just like. NET is Microsoft's implementation of this standard, and mono is another implementation of the CLI. Because CIL can run in all environments that support the CLI, for example, just mentioned. NET runtime and the Mono runtime, that is, regardless of the specific platform or CPU. This eliminates the need to deploy different content depending on the platform.
The compilation of the code is divided into two parts:
-
-
- Compile from the code itself to the CIL (in fact, the CIL will be compiled into a bit code to generate a CLI assembly)
- Runtime from CIL (in fact the CLI assembly, but for the sake of intuitive understanding, do not have to dwell on this detail) to the immediate compilation of local instructions (this leads to why U3D does not provide a hot update reason: mono in the iOS platform does not use the JIT engine, but the full AOT mode is running, so the amount that is said here is instant compilation does not include iOS)
Ahead of Time (AOT) compiles in advance to reduce the amount of JIT work, (Jit:just in time Compile, instant compiler) but by default the AOT does not compile all IL code, but rather a balance between optimization and JIT. In iOS, mono runs in full AOT mode and cannot use the JIT engine. The iOS platform disables the JIT engine, so Mono needs full AOT compilation and run on iOS. That is, all IL code in the assembly is pre-AOT-compiled to generate a local code image and then load the image directly at run time without using the JIT engine.
Should be divided into 3 steps:
1. C #---> CIL
2. CIL---> Bit code
3. There are two forms of the third step:
---> JIT bit code for virtual machine execution
----> AOT bit codes---> Direct platform execution on different platform native code
While the JIT is prohibited by iOS, only use AOT mode to compile before running (of course, the AOT compilation phase is also used to JIT engine)
That's basically it.
-
- What does reflection have to do with mono?
Guessing reflection is the main technique of using JIT for mono
- What's the difference between Unity3d and COCOS2DX update?
- Resources
- Why can mono cross-platform? Talk about CIL (MSIL)
- Mono's AOT mode is similar to static compilation
Unity3d Why can't update the data collection under iOS