XDC 2014: Compiler News

The Xojo Developer Conference keynote address is usually where a bunch of future items are put on display.  This year it was iOS and Xojo Cloud (the latter just being released).  But sometimes the sessions that the engineers lead are just as informative.  Sometimes it’s hints about future things and sometimes it’s an outright roadmap.

In Geoff’s keynote presentation we learned that the ARM compiler and LLVM backend compiler are real and if not perfect, mostly working.  Joe Strout stated that many things still had to be finalized but it’s a good sign that a significant amount of work has already been put into them and they are functional.

In Joe Ranieri’s ‘About the Xojo Compiler’ session we learned a lot about what a compiler does.  The frontend of the compiler includes the lexer, parser, semantic analyzer, and the intermediate representation (IR) generator.  The results then get passed into the backend of the compiler which has an optimizer and code generator.  That output then gets sent to the linker.  Very technical stuff but interesting.

He then went on to explain how the compiler described isn’t actually what’s in use today. The current compiler is designed to emit machine code quickly and merges a number of the compilation steps together.  Unfortunately this results in it not being reusable for other tasks like autocomplete and there being at least two to three other parsers in the product.  The current compiler also has poor error recovery and diagnostics, and, expects 32-bit integers.  Obviously the compiler needs to be updated.

The new compiler will be designed and implemented very much like what was described earlier, providing a base for future plans. With the first release, the new compiler will create 64-bit applications.  Some of this is waiting on framework work to make sure they are capable of using 64-bits.

The new compiler will be built using LLVM, which has has some great optimization passes but they’re pretty generic to work across a lot of languages.  It will also have additional optimization passes that are specific for Xojo (the language).  This means that some things will get huge speed gains such as direct calls into the framework, redundant reference counting, and direct access to arrays.

The new compiler will have better diagnostics.  Hopefully this will turn into better compiler error messages.  So hopefully this means we can get better information than a generic ‘syntax error.’

Finally, the new compiler will have native linkers.  Currently the compiler does not have native linkers for Linux and Windows which requires the loader stub to do some work that will sometimes trigger Anti-Virus warnings.

The new compiler is scheduled for the first quarter of 2015.  It will not be an immediate replacement and the end Xojo user will be able to switch between the two compilers as fringe cases are found.  All of this is not new to anyone that was around during REALbasic version 5.

All-in-all this is good news.  It’s a little disappointing that it’s going to be another 9 months to see the new compiler but as with all things I’d much rather it work well in version 1 than have it take 3 releases to be usable.

In my next post I’ll talk a little bit about what some of these changes *might* mean in the future.

3 thoughts on “XDC 2014: Compiler News

  1. The new compiler was announced about 4 years ago here http://www.realsoftwareblog.com/2010/03/compiler-better-stronger-faster.html

    I quote: “Today, we are working on getting LLVM supported for RBScript. That is nearly complete. Beta testers have been testing it for several weeks now. Once done, we will then move on to supporting LLVM for the main compiler. Considering how important the compiler is to REAL Studio, you may be wondering what sort of transition will be required to move from a version of REAL Studio that uses our current compiler to a future release that uses LLVM. If you were around for the last major compiler transition, you are probably especially curious. The good news is that because we are changing the back end and not the front end, the transition should be extremely smooth.”

    This quote gives the impression that the LLVM compiler would be done by now. I think Xojo could have done a “kickstarter” to fund this effort better.

    • RBScript and regular code are completely different beasts. And if it weren’t for iOS it probably would have been done by now.

  2. I have been working on a simple compiler for RCA 1802 machine-code and know that a compiler is the last one thing you want to touch. However, it saddens me that they still after four years of claiming how crappy their current compiler is an LLVM will be so much better. Four years of blah-blah and we still have the same old crappy compiler.
    By the time Xojo is over to LLVM there will be greener pastures, iOS usage has shrunk below 10% and we will all be wishing for Android and Windows Phone compilation in Xojo, using Java or JavaScript.

Comments are closed.