diff options
| author | Tim King <taking@google.com> | 2024-08-26 15:49:09 -0700 |
|---|---|---|
| committer | Tim King <taking@google.com> | 2024-08-28 21:03:29 +0000 |
| commit | 9e8ea567c838574a0f14538c0bbbd83c3215aa55 (patch) | |
| tree | fc7865088176fffae13b4c9a900cf565622d7ea6 /src/cmd/compile/internal/noder/unified.go | |
| parent | 6d52d7d22b70a5faa2868b6406ccdc7fd9b89083 (diff) | |
| download | go-9e8ea567c838574a0f14538c0bbbd83c3215aa55.tar.xz | |
cmd/compile/internal/noder: write V2 bitstream aliastypeparams=1
Enables V2 unified IR bitstreams when GOEXPERIMENT aliastypeparams
are enabled.
Allows pkgbits.NewPkgEncoder to set the output version.
Reenables support for writing V0 streams.
Updates #68778
Updates #68526
Change-Id: I590c494d81ab7db148232ceaba52229068d1e986
Reviewed-on: https://go-review.googlesource.com/c/go/+/608595
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/unified.go')
| -rw-r--r-- | src/cmd/compile/internal/noder/unified.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/noder/unified.go b/src/cmd/compile/internal/noder/unified.go index ead348f0c1..c8dbc43e67 100644 --- a/src/cmd/compile/internal/noder/unified.go +++ b/src/cmd/compile/internal/noder/unified.go @@ -6,6 +6,7 @@ package noder import ( "fmt" + "internal/buildcfg" "internal/pkgbits" "internal/types/errors" "io" @@ -462,8 +463,13 @@ func readPackage(pr *pkgReader, importpkg *types.Pkg, localStub bool) { // writeUnifiedExport writes to `out` the finalized, self-contained // Unified IR export data file for the current compilation unit. func writeUnifiedExport(out io.Writer) { + // Use V2 as the encoded version aliastypeparams GOEXPERIMENT is enabled. + version := pkgbits.V1 + if buildcfg.Experiment.AliasTypeParams { + version = pkgbits.V2 + } l := linker{ - pw: pkgbits.NewPkgEncoder(base.Debug.SyncFrames), + pw: pkgbits.NewPkgEncoder(version, base.Debug.SyncFrames), pkgs: make(map[string]index), decls: make(map[*types.Sym]index), |
