Chris Seaton PolyConf 17 Interview

Chris Seaton is a Research Manager at the Virtual Machine Group in Oracle Labs, where he leads the work to implement Ruby using the next generation of Java Virtual Machine technology, and other projects.

How did you get into programming?

I started programming with GW-BASIC sitting on my mother’s knee when I was very small. I’ve always been interested in programming languages themselves because as a programmer that’s what’s in front of you all of the time. I’ve always been trying to learn more about how programming languages work, ever since then and still today.

What is your presentation about?

Many dynamic languages like Ruby, JavaScript and Python have C extensions for when you want code to run faster or to access lower-level libraries. But as we start to better understand how to make the languages themselves faster with better virtual machines and just-in-time compilers it looks like we’ve painted ourselves into a bit of a corner — the C extensions expose a lot of the internals of the language interpreters. We’re restricted in what radical ideas we can try for making these languages faster by having to provide this ancient API for C extensions.

What we’ve decided to do at Oracle Labs is to run Ruby’s C extension code on the same virtual machine as we are using to run Ruby.

This lets us virtualise the C code, and abstract it from the nitty-gritty of the native machine. We implement sophisticated illusions so that the C code believes it is using native code and data structures, but really we redirect this to allow us to optimise both Ruby and C together.

It not only allows us to optimise Ruby while still supporting C extensions, but it turns out that because we can optimise them together at the same time with the same just-in-time-compiler, it’s actually faster than running the native code!

What concepts do you recommend people be familiar with to maximize their experience with your presentation?

That probably sounds really complicated! But I will break it down so if you just know a dynamic language like Ruby or Python, and you understand that people sometimes write C extensions then I can bring you along with me in the presentation. I’ll show you what we’re doing and what it makes possible.

What are you excited about in 2017?

Did you know that Java 9 has a new API called JVMCI that lets you replace the just-in-time compiler in the JVM with one written yourself in Java? When Java 9 is released this summer you’ll be able to implement a Java interface to create your own just-in-time compiler. Of course not everyone will be doing that! But it’s great that you can now substitute such a key part of the JVM with something written itself in Java.

Can you tell us something surprising or amusing that you’ve learnt recently about programming?

There’s a feature in Ruby called flip-flops that’s a special kind of if-statement. People use it as an example of something in the language that almost nobody uses. For fun I searched through all of RubyGems to count how many times it’s really used, and found it’s used in about one in every ten million lines of code. There are actually more lines of code implementing flip-flops in the Ruby interpreter than there are using them.