guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Summer of Code Recap


From: Amirouche Boubekki
Subject: Re: Summer of Code Recap
Date: Sat, 02 Sep 2017 00:09:04 +0200
User-agent: Roundcube Webmail/1.1.2

On 2017-08-28 20:56, Ian Price wrote:

1 Introduction
==============

  As many of you are aware, I have been working on compiling Guile
  Scheme to JavaScript this summer, as part of the Google Summer of
  Code. This post serves to bookend my work for the year.

  Before I go any further, I have to give my thanks to my mentor [Chris
  Webber], without whom this project would have fizzled out weeks ago;
  Google and the Gnu Project, naturally, for providing the Summer of
Code and allowing me to work on this project; and our fearless leader,
  [Andy Wingo], for answering a wide variety of stupid questions.


Sorry, for my last mail I was a bit upset a minimal scm file with "42"
will crash.

Anyway, I did a bit of exploration:

Apparently webkit does ship TCO and safari is the only browser [0] shipping it. So it will happen soon enough for chrome, but chrome is not a solution for many
of us. I don't know when firefox with ship TCO.

[0] https://www.chromestatus.com/feature/5516876633341952

Anyway, TCO requires "use strict"; thing to work, so I prefixed the output of guild jslink with that and it lead to discover a bug where there is two
times the same argument called `v_rest`. You can run the file with
the following command:

   node --harmony_tailcalls main.js

It will tell you where the error is.

Here is the fixed code:

    var k_27363 = function(v_19412, k_27499) {
      var k_27364 = function(v_19412, v_e, v_p, v_w, v_mod) {
        var v_19413 = v_e;
        var v_19414 = v_p;
        var v_19415 = v_w;
        var v_19416 = v_mod;
        if (scheme["is_true"](scheme["primitives"]["pair?"](v_19413))) {
          {
            var v_19417 = scheme["primitives"]["car"](v_19413);
            var v_19418 = scheme["EMPTY"];
            scheme["primitives"]["handle-interrupts"]();
            var k_27370 = function(v_first, v_rest) {
              var v_19419 = v_first;
              var v_19420 = v_rest;
              if (scheme["is_true"](v_19419)) {
                {
                  var v_19421 = scheme["primitives"]["cdr"](v_19413);
                  scheme["primitives"]["handle-interrupts"]();
var k_27375 = function(v_rest, v_rest2) { // The error is HERE!
                    var v_19422 = v_rest;
                    var v_19423 = v_rest2;

With that "fix" it run under nodejs v8.4.0 without increasing the callstack.
So it's good news!

I can't make it work with Google Chrome Version 60.0.3112.113 which use
a more recent version of v8 than my nodejs.

chrome://flags/#enable-javascript-harmony

The babel-plugin-tailcall-optimization doesn't work on my machine. It crash
with an OOM failure.

Also Google's traceur does not work.

Finally, there is this heavy page that is supposed to tell what is supported:

https://kangax.github.io/compat-table/es6/#test-proper_tail_calls_(tail_call_optimisation)

Attachment: 0002-add-a-few-ffi-procedures-inspired-from-biwascheme.patch
Description: Text Data

Attachment: 0001-always-throw-an-Error-object-to-have-a-nice-tracebac.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]