AppStore的iOS应用程序中是否禁止使用JIT(即时)编译的代码?
我听说 iOS AppStore 中不允许 JIT 编译的代码,因为禁止将可执行代码放在堆中。是这样吗?还是只是谣言?
I heard that JIT compiled code is not allowed in iOS AppStore because placing executable code in heap is prohibited. It that right? Or just a rumor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不允许使用可安装代码(“或”是 3.3.2 中的关键词)。所有内容(Javascript 除外)都必须静态链接。
JIT 编译成 Javascript 源代码文本似乎是允许的。 (不是开玩笑,有一个商业编译器可以执行此操作。)编译为字节码以由编写的 Javascript 解释器执行并在 UIWebView 中运行可能会让审阅者感到困惑,甚至可能拒绝这样做的应用程序。
iOS 安全沙箱可能会杀死任何试图跳转到任何动态生成的数据的应用程序。
Installable code isn't allowed ("or" is the key word in 3.3.2). Everything (except Javascript) has to be statically linked.
JIT compiling into Javascript source code text appears to be allowed. (Not a joke, there is a commercial compiler that does this.) Compiling into bytecode for execution by an interpreter written Javascript and running in a UIWebView may confuse the reviewers enough to possibly reject an app doing that.
The iOS security sandbox will likely kill any app that tries to jump into any dynamically generated data.
没错。
您可以阅读 iOS 标准协议,在设置开发者注册时需要接受该协议:
That is right.
You can read in the iOS standard agreement, which you need to accept when setting up your developer enrollment:
我还对在 iOS 上运行的编译器(不是 JIT,而是真正的编程语言)提出了自己的想法。我的想法是使用汇编器编写的函数的地址来实现伪操作码作为指令,而不是“传统字节码”(每个伪操作码 1 个字节)。
一个 ARM 寄存器被保留为“代码指针”(此处称为“rCP”),指向我的“字节码”。伪操作码函数的最后一条指令是“ldmfd rCP!, {pc}”。这意味着函数的最后一条指令不是“返回”,而是跳转到下一个操作码。
使用这种方法,您可以获得非常快的“字节码”。也许商业编译器是这样工作的。我不敢相信有一个 JIT 编译器在 iOS 上运行本机代码。
I also made my thoughts about a compiler (not JIT but real programming language) running on iOS. My idea was using addresses to assembler-written functions implementing pseudo-opcodes as instructions instead of "traditional bytecode" (1 byte per pseudo-opcode).
One ARM register is reserved as "code pointer" (here named "rCP") pointing into my "bytecode". The last instruction of a pseudo-opcode-function is "ldmfd rCP!, {pc}". This means the last instruction of the function is not a "return" but a jump into the next opcode.
Using this method you get very fast "bytecode". Maybe the commercial compiler works like this. I cannot believe that there is a JIT compiler running native code on iOS.