1*9880d681SAndroid Build Coastguard WorkerDate: Wed, 31 Jan 2001 12:04:33 -0600 2*9880d681SAndroid Build Coastguard WorkerFrom: Vikram S. Adve <[email protected]> 3*9880d681SAndroid Build Coastguard WorkerTo: Chris Lattner <[email protected]> 4*9880d681SAndroid Build Coastguard WorkerSubject: another thought 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard WorkerI have a budding idea about making LLVM a little more ambitious: a 7*9880d681SAndroid Build Coastguard Workercustomizable runtime system that can be used to implement language-specific 8*9880d681SAndroid Build Coastguard Workervirtual machines for many different languages. E.g., a C vm, a C++ vm, a 9*9880d681SAndroid Build Coastguard WorkerJava vm, a Lisp vm, .. 10*9880d681SAndroid Build Coastguard Worker 11*9880d681SAndroid Build Coastguard WorkerThe idea would be that LLVM would provide a standard set of runtime features 12*9880d681SAndroid Build Coastguard Worker(some low-level like standard assembly instructions with code generation and 13*9880d681SAndroid Build Coastguard Workerstatic and runtime optimization; some higher-level like type-safety and 14*9880d681SAndroid Build Coastguard Workerperhaps a garbage collection library). Each language vm would select the 15*9880d681SAndroid Build Coastguard Workerruntime features needed for that language, extending or customizing them as 16*9880d681SAndroid Build Coastguard Workerneeded. Most of the machine-dependent code-generation and optimization 17*9880d681SAndroid Build Coastguard Workerfeatures as well as low-level machine-independent optimizations (like PRE) 18*9880d681SAndroid Build Coastguard Workercould be provided by LLVM and should be sufficient for any language, 19*9880d681SAndroid Build Coastguard Workersimplifying the language compiler. (This would also help interoperability 20*9880d681SAndroid Build Coastguard Workerbetween languages.) Also, some or most of the higher-level 21*9880d681SAndroid Build Coastguard Workermachine-independent features like type-safety and access safety should be 22*9880d681SAndroid Build Coastguard Workerreusable by different languages, with minor extensions. The language 23*9880d681SAndroid Build Coastguard Workercompiler could then focus on language-specific analyses and optimizations. 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard WorkerThe risk is that this sounds like a universal IR -- something that the 26*9880d681SAndroid Build Coastguard Workercompiler community has tried and failed to develop for decades, and is 27*9880d681SAndroid Build Coastguard Workeruniversally skeptical about. No matter what we say, we won't be able to 28*9880d681SAndroid Build Coastguard Workerconvince anyone that we have a universal IR that will work. We need to 29*9880d681SAndroid Build Coastguard Workerthink about whether LLVM is different or if has something novel that might 30*9880d681SAndroid Build Coastguard Workerconvince people. E.g., the idea of providing a package of separable 31*9880d681SAndroid Build Coastguard Workerfeatures that different languages select from. Also, using SSA with or 32*9880d681SAndroid Build Coastguard Workerwithout type-safety as the intermediate representation. 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard WorkerOne interesting starting point would be to discuss how a JVM would be 35*9880d681SAndroid Build Coastguard Workerimplemented on top of LLVM a bit more. That might give us clues on how to 36*9880d681SAndroid Build Coastguard Workerstructure LLVM to support one or more language VMs. 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker--Vikram 39*9880d681SAndroid Build Coastguard Worker 40