InfoQ

News

MacRuby 0.5 Beta Brings JIT, AOT, GCD Support, Removes GIL

Posted by Werner Schuster on Oct 18, 2009

Community
Ruby
Topics
Compilers ,
Performance & Scalability
Tags
GarbageCollection ,
MacRuby ,
LLVM ,
MacOS ,
iPhone ,
Threading ,
Apple

The first beta of MacRuby 0.5 is available, currently only for Snow Leopard (MacOS X 10.6) machines.

InfoQ talked to the MacRuby core team about the present and the future of MacRuby.

InfoQ: How does MacRuby's new VM use LLVM?

MacRuby compiles everything at demand (when the code is actually meant to be run). The [LLVM] bitcode is sent through optimization passes before compilation.

The release notes for the MacRuby 0.5 beta also mention that LLVM is used to generate stubs for calling foreign functions because that's faster than using libffi, which is used in older MacRuby versions.

InfoQ: MacRuby Ahead-Of-Time (AOT) compiles some of the Ruby standard libraries. What's the reason for that?

The impact is definitely a faster startup time. We are principally AOT compiling them to test the AOT compiler. They are compiled at build time, as part of the main rake task.

InfoQ: What's status of supporting native extensions?

We are able to get some C extensions running, like ripper, digest, socket, zlib, etc. after a few modifications. It is our plan to fully implement the MRI C extensions API in a future release.

InfoQ: One of the big improvements in version 0.5 is the removal of the GIL. Now that's been implemented for a while, what's the experience with your solution?

As far as we know it doesn't bring any significant overhead. Starting a thread is slightly costlier than before but most of the code can run in parallel after.

The GIL-less system was absolutely necessary for MacRuby to become a real Cocoa development platform, since it is common for desktop applications to use threads or more recently grand central dispatch (GCD).

InfoQ: MacRuby allows to AOT compile Ruby code - but is it possible to opt out of the Garbage Collector, ie. is there a way to just use Objective-C's reference counting memory management?

It's not possible yet [..]. But we are considering a mode where the compiler would emit autorelease pools and where the runtime would not use the Autozone GC. If you browse the mailing-list archives you will see a recent discussion on that topic.

The mentioned mailing list thread discusses how to emulate the GC, which is crucial to get MacRuby programs to run on platforms that don't support the Autozone GC, eg the iPhone. Another mail in the discussion explains why porting Autozone to the iPhone isn't a solution, because the iPhone's Cocoa version isn't GC aware.

The final MacRuby 0.5 release will run on Leopard and Snow Leopard, both in 32 bit and 64 bit modes.

See previous InfoQ coverage of MacRuby, and the road towards version 0.5.

No comments

Watch Thread Reply

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.