-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
self-hosted compiler: ship it! #89
Comments
|
There are some compelling reasons to self-host:
We still want the bootstrapping process to be simple though. So here's another proposal. We get a self-hosted compiler going right now. It's the official zig compiler. However the C++ implementation must be able to build the official zig compiler. As long as that remains true, bootstrapping is 1 step process. |
Things I Want to Improve in the Self-Hosted CompilerPerformance and Caching
Representation of Types and ValuesConstExprValue right now has a lot of footguns built into it,
|
How will this work with name resolution? You can't compile a file that depends on a file that hasn't been parsed yet. |
Here's an example:
You can see from this example we would get better parallelism if we prioritized analysis of functions since that creates jobs for the pipeline - it would make thread 2 have something to do while thread 1 analyzes baz(). But this should illustrate the idea. |
0.3.0 ... seemed so close 😃 |
Yeah. I couldn't make the deadline. 0.3.0 is two weeks away and I think those two weeks can best be spent on:
|
building master always anyway 👍 |
Something that I would like to see with a self-hosted compiler is the ability to import the compiler as a library within my application to compile and link new code while running. For example, https://github.com/anael-seghezzi/CToy embeds tcc and provides a creative coding environment that does not require a restart when modifying code. Is such a thing possible already when importing |
Unfortunately that's not ever going to be possible, because of the LLVM and clang dependency. Zig compiler ships with LLVM and clang libraries built into the zig compiler. And Zig supports cross compiling for many targets. To import the compiler as a library would require that LLVM and clang were available in source form (written in zig) so that they could be cross compiled for the target. To give up LLVM/clang and code our own code generator in zig would be giving up state-of-the-art optimizations and a very active community of people working on it. However, the parts of the compiler that do not depend on LLVM and clang are available in the standard library, for example the parser and formatter. As for a coding environment that does not require a restart when modifying code, see #68. |
Having LLVM/Clang written in C++ shouldn't prevent the compiler from being used as a library. Just like zig programs can link to and use C libraries even though they aren't in Zig. |
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes #89
Hello everybody, The self-hosted compiler is now the default compiler. I have marked the 0.10.0 milestone with the due date of September 21, 2022. Please take a look at the upgrade guide for help deciding when to upgrade and how to upgrade. I will personally be working on the existing bug reports that are affecting third party projects, and then continue working with the projects to get them fully upgraded. |
Congratulations @andrewrk! I know you and your team have been working diligently to make this happen for a long time. It's a serious milestone. Nicely done 🎉 |
Just witness a historical event, pure awesome |
major congrats @andrewrk and team for shipping this huge milestone for Zig! ⚡ 🚢 |
I have a table of function pointers which stage2 tells me to change to |
Maybe we could create a specific issue template for bug occurring due to the upgrade? I don't think it will be efficient to make this one longer. |
Yes, I agree with @kuon. You should discuss it in another issue or in any community channel. Just to give you a hint, basically you can't tail a function pointer call because you have no idea what body the function has. By the way, congrats to the Zig team and the whole community! :) |
@kuon @davidgm94 will do, thanks. |
stage1 is available behind the -fstage1 flag. closes #89
stage1 is available behind the -fstage1 flag. closes ziglang#89
This is a tracking issue for when we can completely replace stage1 with self-hosted in official builds of Zig.
async/await/suspend/resume #6025async/await/suspend/resume will not be available in 0.10.0std.fmt.parseFloat
does not parse 9007199254740993.0 correctly #11169std.math.big.int.Managed.shiftLeft
#11897check all the TODO comments in stage2 source code and convert relevant ones into issues blocking this oneconvert TODO comments from source code into issues #363zig build -Drelease-small
)zig build
, good amount of zig and C code in here)The text was updated successfully, but these errors were encountered: