With the latest toolchain updates I'm having trouble regenerating ssa rules easily. Previously, I was able to use stable compiler to generate the new code.
To make things more concrete, I've been experimenting with changing `growslice` implementation in `src/runtime`, which also requires changes in `cmd/compile/internal/ssa`.
My setup uses Go tip and 1.21 as my boostrap compiler:
C:\Go.tip\src\cmd\compile\internal\ssa>where go
C:\Program Files\Go\bin\go.exe // this is my default installation
I started with trying to regenerate the code:
C:\Go.tip\src\cmd\compile\internal\ssa>go generate .
go: downloading go1.22 (windows/amd64)
go: download go1.22 for windows/amd64: toolchain not available
Of course I don't have a the go1.22 compiler available, because it's not yet released.
If I change the `C:\Go.tip\src\cmd\go.mod` to use `1.21` and do:
C:\Go.tip\src\cmd\compile\internal\ssa>go generate .
C:\Go.tip\src\cmd\compile\internal\ssa>
This doesn't seem to work, I assume it actually ended up running go generate in my default installation rather than in Go.tip.
If I run the command manually, I get:
C:\Go.tip\src\cmd\compile\internal\ssa>go run -C=_gen .
ambiguous import: found package cmd/compile/internal/ssa/_gen in multiple directories:
C:\Program Files\Go\src\cmd\compile\internal\ssa\_gen
C:\Go.tip\src\cmd\compile\internal\ssa\_gen
I can switch to using `C:\Go.tip` as the tool for running the ssa generation,
however, then I hit the other problem that it'll end up picking up my
`runtime` changes as well, which won't work unless the `ssa` logic has been
updated.
Which leads me to this workflow to do things:
1. modify things in ssa and runtime
2. stash changes in runtime
3. go generate cmd/compile/internal/ssa
4. unstash changes from runtime
5. run make in src to recompile the compiler
6. realize that my modifications had a bug in it
7. stash everything
8. recompile the compiler
9. go back to step 1.
I can avoid 7. - 8. by keeping a backup of a stable compiler, but there's still
a significant amount of stash/unstash to do things.
Am I missing something in my workflow to be able to regenerate
the ssa, with a separate compiler? Or should I look automating my
workflow to avoid issues?
All the best,
+ Egon