Become a fan of Slashdot on Facebook


Forgot your password?
Programming GNU is Not Unix

GNU Guile Scheme Gets a Register VM and CPS-Based IL 42

In late November, Andy Wingo pushed a new register VM to Guile's (the GNU implementation of the Scheme language) master branch. It brought a number of performance improvements, but led to a bit of a conceptual mismatch between the compiler's direct-style intermediate language and the virtual machine. Earlier this week Andy Wingo announced a new continuation-passing style intermediate language for Guile. From the article: "To recap, we switched from a stack machine to a register machine because, among other reasons, register machines can consume and produce named intermediate results in fewer instructions than stack machines, and that makes things faster. To take full advantage of this new capability, it is appropriate to switch at the same time from the direct-style intermediate language (IL) that we had to an IL that names all intermediate values. ... In Guile I chose a continuation-passing style language. ... Guile's CPS language is composed of terms, expressions, and continuations. It was heavily inspired by Andrew Kennedy's 'Compiling with Continuations, Continued' paper. ... The optimizations I have currently implemented for CPS are fairly basic. Contification was tricky. One thing I did recently was to make all non-tail $call nodes require $kreceive continuations; if, as in the common case, extra values were unused, that was reflected in an unused rest argument. This required a number of optimizations to clean up and remove the extra rest arguments for other kinds of source expressions: dead-code elimination, the typical beta/eta reduction, and some code generation changes." The article describes the CPS language provided by Guile and explains the reasons behind choosing CPS over SSA or A-Normal Form. The Guile manual contains draft documentation. The new VM and Intermediate Language will be released with Guile 2.2, which should be out later this year.
This discussion has been archived. No new comments can be posted.

GNU Guile Scheme Gets a Register VM and CPS-Based IL

Comments Filter:
  • by iluvcapra ( 782887 ) on Wednesday January 15, 2014 @04:16PM (#45968923)

    Remember when a nerd was someone who cared about tail call optimizations and SSA, and not which corporation made their cellphone?

    Off my lawn.

  • Hierarchic thinking has infested Computer Science for decades. The entire Object Oriented Programming paradigm was founded on hierarchy, with Inheritance defined as from one parent only, and many not too sure if multiple inheritance is a good idea or needed. That the notion of inheritance even has to be qualified with that word "multiple", because it implicitly means single otherwise, is a barrier to thought. Trees are useful data structures, but they aren't the ultimate, universal data structure that can succinctly describe all other organizations of data.

    There's a lot of foolish programmers who think that because they've got inheritance available to them, they've got to use it. It's the If All You Have Is A Hammer principle. Delegation/composition is much more useful in practice (and can express arbitrary graphs just fine).

  • by ari_j ( 90255 ) on Wednesday January 15, 2014 @09:40PM (#45971889)

    To those interested in the implementation of programming languages, it is immediately apparent that this is a fundamental change in the compiler behind the GNU Guile system which implements the Scheme programming language, inasmuch as it now has a virtual machine based on the register model instead of the implied stack model, along with an intermediate language in its compilation path that is based on continuation-passing style.

    I think that the lesson here is for everyone: There are many segments of nerd culture, and it is very unlikely that any randomly-selected Slashdot reader understands and appreciates all of those segments. For example, the earlier headline today "Why Transivity Violations Can Be Rational" has no meaning to many readers, even after the title was corrected to spell transitivity correctly. After reading a little about that topic, I see that it is an area of of obvious interest to many nerds.

    That being said, there are plenty of topics Slashdot poorly reports on which are not of interest to any segment of nerd culture, at least not beyond the overlap between nerd culture and the mainstream news where we already read the same information three days earlier except through the words of a literate, competent reporter with real editing before it hit the press.

"Aww, if you make me cry anymore, you'll fog up my helmet." -- "Visionaries" cartoon