Code Monkey home page Code Monkey logo

Comments (4)

Fireboltofdeath avatar Fireboltofdeath commented on May 28, 2024

What optimization level are you compiling on? If you're compiling with all optimizations off, Wasynth has to generate a lot of locals.

I believe there are plans to introduce unlimited locals eventually but enabling optimizations should fix this in the majority of cases.

from wasynth.

schmatz avatar schmatz commented on May 28, 2024

Ah, great point. Slapping an -O3 on there fixed the issue with the example program.

Out of curiosity, would the unlimited locals be powered by just using a table of registers or something like that, or would more complex algorithms be needed?

from wasynth.

Rerumu avatar Rerumu commented on May 28, 2024

I've been experimenting for some time but reached no conclusive solution. I am currently torn between two options:

  • A simple variable hoisting algorithm for allowing locals to be defined at their highest common block.

  • Refactoring the AST to have SSA properties and forget about the concept of a Wasm "local" altogether.

The first would likely solve a lot of the annoying cases (and generate better JIT code). It would fail if there are too many variables scoped to the same block.

The second would require some extra work on my part, but would also allow us to use industry standard solutions. Applying register graph coloring on top of this would allow us an unlimited amount of locals everywhere (with spilling to a table).

from wasynth.

Rerumu avatar Rerumu commented on May 28, 2024

This was band aid fixed in d33e4a6. A proper and efficient solution is planned in the future for the newer version of the tool.

from wasynth.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.