Hacker News new | ask | show | jobs
by ajconway 2237 days ago
It is not necessary to resort to JavaScript for the emulation, emulation and interpretation are allowed. App Store effectively forbids the usage of JIT (so VMs do not run as fast as one could expect) and running any code that’s not included in the package at the time you submit the app for review (with an exception for educational apps).
1 comments

I’m not doubting you, but I don’t see where in the App Store rules it forbids JIT, other than the prohibition of running third-party code. Emulation and interpretation are allowed — if the code is first- or second- party.

Educational apps are an interesting exception, but as I quoted in my patent comment, JavaScript is the other major one.

So I wonder if JIT compilation and execution is possible under the rules in JavaScript? (Again, is that even feasible?)

Generally, JIT requires the ability to execute data (writeable memory pages that contain code). iOS apps need a special system permission (in Apple's terminology — entitlement) to construct such pages. To my knowledge, no apps except for the first-party ones (like Safari) have this permission. Apps can call into one system API that has this JIT capacity (WKWebView). It runs in a separate process and uses IPC to communicate with the app. It has an API that allows the application to execute arbitrary JS code at full speed. Some time ago it lacked support for WebAssembly, but it may have been resolved by now.

So, these are the technical limitations of the platform. Apple chose to implement a number of arbitrary rules on top of that. Well, it's not a democracy, and they are free to do so. There is always a slight chance of having some form of less restricted execution environment in future versions of iOS, mainly due to how much their iPad Pro hardware is overpowered relative to the OS capabilities.

This was also discussed here a few months ago by the author of utmapp (Qemu on iOS). In order to get their code to work, they need to effectively run their own code in debugging mode. And yes, this requires the same entitlement as the JS JIT.

https://news.ycombinator.com/item?id=22387742