8 ms·
Besides, doesn't LLVM already have an IR which servers as one such higher-level abstraction?
by dmitriid 7y ago
Besides, doesn't LLVM already have an IR which servers as one such higher-level abstraction?
- rapsey 7y agoI'm pretty sure it is not stable and not designed for such a use case.
- pjmlp 7y agoApple kind of disagrees with watchOS bitcode.
- tom_mellior 7y ago"not designed for that use case" != "isn't used for that use case in practice" Apple has tight control over the bitcode version and the target platforms supported by Xcode. That's not the same thing as accepting arbitrary LLVM bitcode files.
- pjmlp 7y agoNothing prevents LLVM project to adopt such variant, other than unwillingness to do so.
- jcelerier 7y agoNo, LLVM IR is machine specific. Any "native" language is since the ABI of a struct will depend e.g. on the size of pointers for that platform. E.g. Consider in C int foo[sizeof(void*)];
- pjmlp 7y agoOpen source LLVM IR is machine specific, it doesn't have to be, as proven by watchOS bitcode, or PNaCL.
- saagarjha 7y agoBoth of the examples you gave were very carefully architected to make sure that was the case.
- pjmlp 7y agoWhich doesn't prevent the case of someone contributing back such kind of variants.
- jcelerier 7y ago> it doesn't have to be, as proven by watchOS bitcode, or PNaCL. Both of those have fixed 32-bit pointer sizes and are little-endian. When you compile for watchOS bitcode or PNaCL you just target a single virtual machine & "system" ABI. LLVM IR or any related techniques won't ever allow you to produce a 32 / 64 bit or ARM / x86 app that is able to leverage the whole feature set of the platform from the same bitcode.
- pjmlp 7y agoYet watchOS migrated from 32 bit to 64 bit. It is possible, LLVM project just needs to actually want to support such use cases in a portable way.
- jcelerier 7y ago> Yet watchOS migrated from 32 bit to 64 bit. that is what they said in the press release but in practice they migrated from "classical" 32bit ARM to ILP-32 (akin to the x32 ABI on linux) so the size of pointers, etc etc does not change from 32-bit. You get more registers & stuff like that which is nice, but that is not moving to 64 bit, just having nicer 32 bit execution on 64 bit CPUs. If you want proper aarch64 support on WatchOS you have to recompile.
- pjmlp 7y agoFair enough. Still nothing prevents LLVM bitcode to be fully CPU agnostic, if LLVM guys were willing to keep such variant around.
- jahewson 7y agoGoogle created pretty much this, called it PNaCl and shipped it in Chrome. It now has been retired in favor of WASM.
- pjmlp 7y agoBecause Mozilla went political and came up with asm.js as counter technology.
- afiori 7y agoOr as some other (like, eg Google itself) would say: > Because Mozilla went political and came up with asm.js as better technology.
- pjmlp 7y agoI am pretty sure that asm.js would not happened if Chrome already had the market share it enjoys nowadays. WASM is still catching up to PNaCL in performance, hardly better.
- AndrewDucker 7y agoFor the reasoning behind this, see https://github.com/WebAssembly/design/blob/master/FAQ.md#why-not-just-use-llvm-bitcode-as-a-binary-format https://github.com/WebAssembly/design/blob/master/FAQ.md#why...
- TazeTSchnitzel 7y agoLLVM IR is unstable, way too big in scope, and not as machine-independent as people think. There have been several efforts to use it as a target-independent high-level bytecode, and they either are very platform-specific single-vendor affairs (Apple) or were retired in favour of a simpler new language that doesn't have its problems (SPIR became SPIR-V, PNaCl became WebAssembly).