LLVM has been around for what? 25 years or so. I used it and gcc for writing kernel level code. It wouldn’t be hard to build an LLVM front end for LUA to translate it directly into the AST (Abstract Symbol Tree) and then pass that on to the code generator for translation into IML. After translation into the AST step, everything else is the same.
So what Roblox could do is use an expanded LLVM or gcc compiler and build the object code for multiple targets when the code is published. Once built, there is no further processing cost for the code other than to figure out which version to send to the client and send it.
The most problematic platforms are the mobile ones with three major operating systems available depending on the manuacturer:
- iOS (Apple Only)
- Android (Everyone else…even the Amazon Fire tables are Android, I have one)
- Windows (Microsoft Surface, and a few others but not any major market share)
With iOS, there is only ONE manufacturer so that’s pretty much a no-brainer there. Windows implements Bill Gates dream of abstracting the hardware to higher levels of software which gives applications a uniform platform to run on, hence the enhanced compatibility. Android, for those that don’t know, is based on Linux. There are multiple manufacturers and versions which present a challenge. I think the current Android version is 15. My phone is using 8.1. There’s quite a bit of variance in between.
However, by compiling the LUA code directly to assembler and then to machine language and linking it to Roblox provided libraries, Roblox can still maintain control of the execution environment as well as maintain security if the compiled LUA code uses the same function entrypoints that native LUA bytecode uses.
Considering what they have already, it wouldn’t be much to add that guarantee.
EDIT:
There is one issue that could present a problem that I just thought about. With the security that operating systems implement now with read/write and no execute permission bits in the descriptor tables for each memory page (4096 bytes, or 2MB, depending on OS), that could be a hurdle. The code would have to download into a memory segment that is marked as R/W and execute, which many operating system will not allow due to exploits. You have to be at Ring 0 to touch that stuff.
That could be a very real technical reason as to why they haven’t turned it on.