IOS: AOT ahead of time, what is it?

I read an article from Xamarin and came across a specific informational word: "Ahead of time." According to some Google search results, this AOT does not allow code to be generated at runtime. Does this mean that it does not support dynamic things?

I know this question can be stupid, and I have 0 knowledge in iOS, I hope you can get an answer from here. thanks

+6
source share
2 answers

First, what is the definition of dynamic? For the general public, dynamic code means that an application can change functionality at runtime. For the iOS platform, binaries are signed to prevent malware. And Apple doesn't like apps that can load functionality at runtime.

Component (AOT) has nothing to do with dynamic code. This is due to the intermediate language, which is compilation on time (JIT) . The largest example of an intermediate language is Java bytecode; compile once, run anywhere. When a Java application runs, the compiled JIT code is native machine code. The AOT compiler just does it ahead of time to save time.

For the iOS platform, Xcode compiles Objective-C into its own binary for the device.

+3
source

Another way to look at this with an example ...

In .Net, you can use the Reflection.Emit namespace to generate and compile code at runtime.

For example, you can create an β€œIDE” with a text field that C # accepts. When you click a button that C # can compile the .Net framework into a user library that loads a dynamically or fully executable executable that starts as a new process.

This is insanely powerful when combined with the rest of the System.Reflection namespace. You can scan objects at runtime and compile your own code based on any criteria that you like.

That said ... Problems usually outweigh the benefits in most cases. This is mainly a serious security issue, especially when working on a consumer device.

You could create an application that would have nothing close to the malicious code, get it under Apple control, then download the application download code from your web server, compile it and execute it. This new code will not be checked ...

In fact, there is no good reason for this in the consumer application.

+3
source

All Articles