I'm happy to announce that from now on "mandatory" parts of the compiler can be implemented in Swift (on the main branch).
So far we only used Swift as an implementation language in parts of the compiler which are not strictly necessary for correct code generation of the standard library, like some optimization passes.
Now, we can use Swift in all parts of the compiler, including the parser, AST, type checker or mandatory SIL passes.
We are dropping the requirement to bootstrap the compiler with a pure C++ host toolchain.
Instead we are requiring that a Swift toolchain must be present to build the compiler.
How to bring the Swift compiler to new platforms where no Swift host toolchain is available, yet?
This can be done by bootstrapping with the 6.2 compiler. The 6.2 compiler is the last release which can be bootstrapped without a Swift host compiler. On the new platform the 6.2 compiler can be built and used as a Swift host toolchain.
This is great news, thanks to all who made is possible!
Does this mean that certain parts of the compiler, like the C++ parser, will be removed soon? Can new changes to the language grammar be implemented only in swift-syntax instead of both parsers as has been the case up until now?
Is there a documented policy for which host compilers will be supported going forward (e.g., "Swift 6.X can be built with a Swift 6.(X – 2) compiler" or something similar)?
Is there a documented policy for which host compilers will be supported going forward (e.g., "Swift 6.X can be built with a Swift 6.(X – 2) compiler" or something similar)?
Alternatively, you can cross-compile a bootstrap compiler on one of the well-supported host platforms, then use that on the new platform to build the Swift compiler natively. That is how @networkextensionappears to have gotten FreeBSD AArch64 going.
The linux CI builds the trunk Swift toolchain with Swift 5.9.2, ensuring no later Swift features creep into the Swift code used in the Swift compiler itself, but we're currently looking at upping that to Swift 6.2.4.
This can be done by bootstrapping with the 6.4 compiler. The 6.4 compiler is the last release which can be bootstrapped without a Swift host compiler.
We disabled the C++ bootstrapping verification bot most of the way through the 6.3 development and I stopped maintaining the C++ bootstrap when we did so. Given how frequently passes in the SIL optimizer were crashing during the 6.3 development timeframe and how often we would have source breaks because there were mandatory passes written in Swift that I couldn't use, I would be very surprised if we can successfully bootstrap with 6.4 without crashing. Have you verified this claim?
I haven't been doing the work of maintaining that, so unless someone has been behind the scenes, I don't have a lot of confidence that 6.4 will bootstrap from C++.
The last version I feel 100% confident saying will bootstrap to a fully passing state successfully is 6.2, and that's because we have CI verifying that things are working when patches are made against release/6.2: [release/6.2] OSS - Swift Bootstrap - Amazon Linux 2023 [Jenkins]. I feel confident that a little work could make 6.3 work, though I think we dropped the bootstrap testing while the compiler was crashing somewhere in the SIL optimizer.
I think the options right now are either keeping things working with 6.2 and using that to do the bootstrap, or cross-compiling.
The linux CI builds the trunk Swift toolchain with Swift 5.9.2, ensuring no later Swift features creep into the Swift code used in the Swift compiler itself, but we're currently looking at upping that to Swift 6.2.4.
I know the older releases have been closed for a while, and this request is a long shot, but it might be nice to consider keeping a 6.2 branch (or a branch of whatever might be considered the Last Release in the future) open strictly for bootstrap related issues that might arise when bringing Swift to new platforms in the future, to slightly ameliorate maintaining local side patches. I can also see arguments not to do this, but the thought has been rattling around in my head for a while…
Not a long shot. This is exactly the plan. I don't have a branch name yet since we haven't had to bring one up, but it'll probably be something like 6.2/bootstrap.