![](https://img-blog.csdnimg.cn/img_convert/6acf4d7f8013256ed11dc86a9e3ed6ed.png)
il2cpp
Almost a year ago now, we started to talk about the future of scripting in Unity. The new IL2CPP scripting backend promised to bring a highly-performant, highly-portable virtual machine to Unity. In January, we shipped our first platform using IL2CPP, iOS 64-bit. The Unity 5 release brought another platform, WebGL. Thanks to the input from our tremendous community of users, we have shipped many patch release updates for IL2CPP, steadily improving its compiler and runtime.
大约一年前的现在,我们开始谈论Unity中脚本的未来 。 新的IL2CPP脚本后端承诺将为Unity带来高性能,高度可移植的虚拟机。 1月,我们使用IL2CPP( iOS 64位)发布了第一个平台。 Unity 5版本带来了另一个平台WebGL 。 感谢广大用户的反馈,我们为IL2CPP发行了许多补丁程序更新 ,从而稳步改善了其编译器和运行时。
We have no plans to stop improving IL2CPP, but we thought it might be a good idea to take a step back and tell you a little bit about how IL2CPP works from the inside out. Over the next few months, we’re planning to write about the following topics (and maybe others) in this IL2CPP Internals series of posts:
我们没有停止改善IL2CPP的计划,但是我们认为最好退一步,向您介绍一下IL2CPP从内而外的工作原理。 在接下来的几个月中,我们计划在此IL2CPP Internals系列文章中撰写以下主题(可能还有其他主题):
Method calls (normal methods, virtual methods, etc.)
方法调用 (普通方法,虚拟方法等)
In order to make this series of posts possible, we’re going to discuss some details about the IL2CPP implementation that will surely change in the future. Hopefully we can still provide some useful and interesting information.
为了使这一系列文章成为可能,我们将讨论有关IL2CPP实现的一些细节,这些细节将来肯定会改变。 希望我们仍然可以提供一些有用和有趣的信息。
What is IL2CPP?
什么是IL2CPP?
The technology that we refer to as IL2CPP has two distinct parts.
我们称为IL2CPP的技术有两个不同的部分。
The AOT compiler translates Intermediate Language (IL), the low-level output from .NET compilers, to C++ source code. The runtime library provides services and abstractions like a garbage collector, platform-independent access to threads and files, and implementations of internal calls (native code which modifies managed data structures directly).
AOT编译器将.NET编译器的低级输出中间语言(IL)转换为C ++源代码。 运行时库提供服务和抽象,例如垃圾收集器,对线程和文件的平台独立访问以及内部调用的实现(直接修改托管数据结构的本机代码)。
The AOT compiler
AOT编译器
The IL2CPP AOT compiler is named il2cpp.exe. On Windows you can find it in the Editor\Data\il2cpp directory. On OSX it is in the Contents/Frameworks/il2cpp/build directory in the Unity installation. The il2cpp.exe utility is a managed executable, written entirely in C#. We compile it with both .NET and Mono compilers during