Comments (4)
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.
Thanks a lot, it helps a lot.
from schism.
Feel free to close the issue or copy / paste your explanation in the doc folder ;)
from schism.
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)
- Add macro expander
- Try µKanren as a test case
- Add support for failure tests
- Add file input ports
- First class procedures HOT 5
- Add a command to compile a file to .wasm HOT 3
- Pass options to Schism.Engine as a dictionary HOT 1
- Remove `list-all-eq?` HOT 6
- README.md review: What does Schism do? HOT 2
- Add test case for string `eq?` behavior HOT 5
- Add some kind of `include-data` macro HOT 1
- Do we want a SchismValue or similar class?
- Bootstrapping from guile fails: "Unbound variable: %file-exists?" HOT 6
- master playground doesn't work HOT 2
- equal? should handle cyclic structures
- bug related to tail-call-indirect
- Allow multiple tests per test file
- test/list-find.ss fails HOT 1
- Guile bootstrap seems to be broken again? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from schism.