Git Product home page Git Product logo

Comments (4)

eholk avatar eholk commented on May 5, 2024 1

This comes out of the self-hosted nature of Schism.

Stage0 is also called the snapshot. We keep it checked into the repo, but it doesn't have to be (and probably shouldn't be). It's a working version of the compiler in binary form (Wasm, in this case), that is used to jump start the rest of the compilation process. Note that you can also use bootstrap-from-guile.sh to regenerate this.

Stage1 is Schism compiled by the stage0 compiler. I'll say more about this in a second.

Stage2 is Schism compiled by the stage1 compiler. From time to time, we "update the snapshot," which basically means we rename schism-stage2.wasm to schism-stage0.wasm, so the stage 2 compiler becomes the new snapshot.

There's also a stage3 compiler, which is Schism compiled by the stage2 compiler. This should be exactly the same as the stage2 compiler, so we don't generally build the stage3 compiler. From time to time we do though to make sure stage 2 and 3 actually are identical.

The distinction comes up when adding optimizations or features to the compiler.

If you add a new optimization, you would write it into Schism, at compiler.ss. You then compile this into the stage1 compiler using the stage0 compiler. The stage1 compiler now knows how to do your optimization, but it has not itself been optimized. Stage2 would then both be able to perform the optimization, and has also had the optimization applied. If you look at compiler performance in this case, it's pretty common for stage1 to be slower than stage0, because it has to do additional work to perform the optimization, But then, stage2 is often faster than both stage0 and stage1 because it has been optimized by the new optimization.

When adding a new feature, such as when I was adding support for lambdas, you have to implement the feature without using it in the compiler. Once you've implemented it, stage1 can compile code with the new feature. So, if you have test cases that use the feature, these will start to pass. However, you can't use the new feature in the compiler until you take a new snapshot, so that stage0 will support the feature as well.

I hope this helps!

from schism.

amirouche avatar amirouche commented on May 5, 2024

Thanks a lot, it helps a lot.

from schism.

amirouche avatar amirouche commented on May 5, 2024

Feel free to close the issue or copy / paste your explanation in the doc folder ;)

from schism.

eholk avatar eholk commented on May 5, 2024

I added a cleaned up version of my explanation above to the docs/ folder, so I'll go ahead and close this issue.

from schism.

Related Issues (20)

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.