Skip to content

Proper Tail Optimization doesn't work #2140

@amirouche

Description

@amirouche

GNU Guile has now a working prototype of a compiler backend that generates JavaScript.

It use lots of tail calls. I compiled it with traceur using the following command:

$ traceur --out script.js --script out.prettier.js --proper-tail-calls  --experimental

I run it in chrome using the following html file:

<html>
  <body>
    <script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script>
    <script src="https://google.github.io/traceur-compiler/bin/BrowserSystem.js"></script>
    <script src="/script.js" type="text/javascript"></script>
  </body>
</html>

It fails with a Uncaught RangeError: Maximum call stack size exceeded.

The original scheme program is:

(js-invoke (js-eval "console") "log" "héllo world")

The input JavaScript file can be found here. That input file is correctly intrepreted by nodejs v8.4.0 using the --harmony_tailcalls flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions