From: Robert Feldt Date: 2004-08-13T06:58:26+09:00 Subject: Re: Ruby and Mono George Marrows wrote: >>ummm c++ requirement? llvm is c++ .. >> >> > >Robert - weren't you or one of your students working on an llvm-based >compiler? How did that go? Anything demonstratable? Any pitfalls or >pleasant surprises to report? > > > Good reminder; I never uploaded that thesis. But now it is available on the page http://www.pronovomundo.com/htu/theses2004/ here's the short version: Anders Alexandersson, �RubyComp � a Ruby-to-LLVM Compiler Prototype� Abstract Dynamic programming languages are not generally precompiled, but are interpreted at run-time. This approach has some serious drawbacks, e.g. complex deployment, human readable source code not preserving the intellectual properties of the developers and no ability to do optimizations at compile-time or run-time. In this paper we study the possibility to pre-compile the Ruby language, a dynamic object-oriented language, into Low Level Virtual Machine (LLVM) code for execution by the LLVM run-time, a compiler framework for lifelong optimization of an application. The result of the project is a Ruby compiler prototype, describing the infrastructure and overall design principles to map the highly dynamic properties of the Ruby language into low-level static constructs of the LLVM language. The LLVM framework supports different hardware platforms, and by using LLVM as the target of compilation the benefits of that portability are gained. Conclusions The core of the prototype design is to handle dynamic behavior by recompilation from one static state to another, by the use of meta-data. Between recompilations static pointers are used, which enables good performance. The prototype contains an LLVM Modelling Layer, hiding the LLVM syntax which is used to process the AST. Some important obstacles have been identified in the LLVM framework, preventing support for full dynamic behavior, and to solve this, the framework needs modifications. As a whole and provided that the LLVM framework can be modified to fit the needs of the Ruby dynamic requirements, compiling Ruby to LLVM is indeed feasible. My comment: I haven't checked what state the code is in, the paper should contain the majority of the details. For me LLVM is (still) a very interesting project and I think it would be a feasible path for a Ruby compilation back-end (a very good thing is that it is well supported and quickly evolving, ie. it's future seem bright), however there are some hurdles for supporting Ruby's eval etc which seems a bit more complex than I initially thought. Regards, Robert