BT

Your opinion matters! Please fill in the InfoQ Survey!

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

| by Werner Schuster Follow 4 Followers on Oct 18, 2009. Estimated reading time: 2 minutes |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

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.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT