Conversation
|
Thanks for the write up! This clears up a misunderstanding from me: I thought using JSCL instead of other CL to compile JSCL is rather an exercise on conformance than bootstrap (because any conforming CL should be able to compile JSCL). But turns out it is indeed an exercise on bootstrap because we need to handle clashing between host/target JSCL package, etc.
I think
At some point we need to overhaul the reader, but I repeat myself :) A conforming reader is required to be thoroughly |
|
Any suggestions for compiling on |
What are the main limitations now? the lack of shell? I guess WLS or just doing the build in sbcl directly like Or is there any additional limitations? I imagine paths might be quite broken now. But something we should fix. Let's think about it when I open a PR to improve the build system to allow specify jscl as a host. |
|
A mismatch in bootstrapping was caused by this
Kind of funny! Thank you JS prototype chain. Prelude.js was good but packages created from package.lisp weren't. Probably good to migrate packages to use hash tables /map too at some point. |
|
Claude was almost completely useless for these bootstrapping issues. Can't grasp the root cause of the issues ever. It always suggests to add It only helped me to compare It makes it more fun though. It's quite cool to hack inside |
|
Ok! jscl.lisp is compiling itself now 🎉 There were quite a few hacks. Especially defstruct.lisp vs structures. Many tests are still failing
but it's at the point where I build jscl from jscl and I get a pretty close jscl.js and a functioning REPL. It might be a lot of effort to recreate individual PRs. Maybe it's better to refine this one and fix or create issue to solve all the hacks that were needed. |
c997986 to
9ae72af
Compare
Does it make sense to split out the part that implements functionality (i.e. improve conformance, like the I think conceptually the following goals are in order:
Improvements in 2 will probably reduce hacks needed in 3. And it does seem you completed some tasks in 2 in order to make 3 work! I think if we separate them out and consider it under premise of 2, it's easier to review and produce good code. No hacks or magic required in 2! |
e226846 to
8805168
Compare
|
Let me work on rebasing the PR and try to clean up the commits a bit to try to match that order, and make sure tests (at least the Some of my fixes can be merged but others are very hacky, def!struct and reader for instance. And I'd prefer if we do them properly. I'll try to extract the good stuff from it. |
5dd3dcb to
96ff58f
Compare
|
I took a peek, one reminder: be aware that if JSCL host uses some JSCL specific feature (rather than using it as "any other CL"), this is less "sanely" bootstrappable, because future changes in these feature might break bootstrap. |
I know! Thanks. This is my plan for now: I'm just trying to get one clean bootstrap + tests running. Just to make sure the approach is doable. All hacks allowed. Then I'll open a PR for the package + feature only. Then we can properly fix the the missing features. We can divide some work if you have time. And I'll incrementally rebase this PR to make sure I can still get tests passing, until they do pass in master, and we can make them a required step in the CI. |
Great plan! Thanks for the hard work in this PR :) |
|
Ok! I'm happy where this is now. Here is the status:
The bootstrap
It mostly works, but it fails some web REPL build later. I haven't tried to fix that. As I do successfully end in dist/ with
The testsThe "prebuilt" tests (built during bootstrap works). I prioritized these, because it's what we have in master now. But I changed the test suite to be usable at runtime too. My goal is to run It's a bit fragile, a bit of a mess with the packages. We'll have to fix it, probably puttin all tests in a new But if I get inside the host Everything is quite slow. But it'll be fun to optimize later. So this is a great branch to have as a reference as we go. I'll try to open the PRs. Let's try to not diverge too much from this one. It's pretty hard to debug issues. It'll get better once we have the full |
|
Claude analysis on Differences between out/jscl.js and dist/jscl.js1. Floating-point precisionConstants are full double-precision in
2. Symbol naming for format directive expandersThe biggest category of changes. In This affects ~30 format directives: This means 3. Package-qualified dump-loop-* functionsFour loop-related dump functions have different package qualifiers:
The JS function names also reflect this ( 4. Gensym counter offsetGensym counters are consistently offset (e.g., 5. Version string
6. Build date string
7. One actual code differenceLine 51456: |
Interesting, why would the version loaded in target slower than cross-compiled one? Or do even the cross-compiled one take 9.193 seconds? I think they should be mostly identical. |
|
It’s loading and running tests so they include compilation time. comoilation from inside sbcl is much faster but the running time only is identical I think. I’ll double check tomorrow. |
8b03978 to
07ecb20
Compare
|
I'm not sure how to proceed with the plan for this. Splitting this PR as I did for bootstrap 01 but not making changes to them is ab it pointless. But it's going to take quite some effort to rebase and keep everything working and up to date. It might just be easier to polish this PR enough to get it merged. |
|
@kchanqvq ok. I got it to finally cleanly bootstrap itself and pass all tests. Please check the updated description of the PR. Time to go through the diff and find all the hacks that were needed, and see which ones are easy to fix! I'll go through it myself tonight or tomorrow. If you have time to have a look, or checkout the branch locally and try the updated scripts or give any other feedback, it'd much appreciated. |
| <script src="jscl.js" type="text/javascript"></script> | ||
| <script src="tests.js" type="text/javascript"></script> | ||
| <script src="jscl-tests.js" type="text/javascript"></script> | ||
| <script>jscl.evaluateString('(jscl::run-tests)');</script> |
There was a problem hiding this comment.
Hm. We do not have HTML tests right now!
I think it's nice to have these to make sure we do not use things browser do not support.
I have to think of a solution.
Some errors were masked by the tests.lisp
STREAM-INDEX is not defined in host
|
I think I'll merge this if there is no big concerns with it, and keep working on recovering the old tests.html file and a few other fixes later. The PR is already huge. |
Because it works locally but fails on the sbcl version on the pipeline
|
Hmm, I thought I spotted some possible improvements but missed the deadline for review! Anyway, I'll start separate issues/PRs once I get to it. A bit busy this week :) |
Compile JSCL with itself!
Lot of changes were needed. The PR is not the cleanest. But it's in a good state, workflow wise.
The build scripts now support both SBCL and JSCL as host compilers:
./make.sh— Cross-compiles JSCL using SBCL (default) or a JSCL binary (--jscl=). Produces dist/jscl.js and REPL variants../run-tests.sh— Runs the test suite in JSCL (default) or SBCL (--sbcl)../bootstrap.sh— Two-stage bootstrap: SBCL builds a stage-0 JSCL (out/), then that JSCL builds the final stage-1 (dist/). CI runs tests againstboth stages.
Key changes
jscl-xcpackage andjscl-targetfeature flag to cleanly separate host/target code pathsjscl-testspackage and made portable across JSCL and SBCL (JSCL-specific tests gated with #+jscl)read-from-stringsecond return value, defstruct type/predicate, set-dispatch-macro-character,various loop/sort/package fixes