]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile: add -d=unifiedquirks for quirks mode
authorMatthew Dempsky <mdempsky@google.com>
Tue, 22 Jun 2021 03:03:58 +0000 (20:03 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 22 Jun 2021 04:24:29 +0000 (04:24 +0000)
Originally, overloading -d=inlfuncswithclosures=0 to enable quirks
mode was convenient because toolstash -cmp doesn't provide a way to
pass different gcflags to the installed vs stashed toolchains. Prior
to unified IR being merged, the stashed toolchain wouldn't know about
or accept any unified-specific flags.

However, this concern is no longer applicable since unified IR has
been merged, and the TestUnifiedCompare test can easily specify
different flag sets for the baseline and experiment build configs.

This CL adds a new -d=unifiedquirks flag to enable quirks mode, so
that it's possible to test unified IR with -d=inlfuncswithclosures=0
without also affecting a bunch of other compilation details.

Change-Id: Id1932f332822622aa8617278e82ec6d1a53b1b46
Reviewed-on: https://go-review.googlesource.com/c/go/+/329733
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/cmd/compile/internal/base/debug.go
src/cmd/compile/internal/noder/quirks.go
src/cmd/compile/internal/noder/unified_test.go

index fd4202194667b83f95c3b89f075059693197a5ae..e2245e1c26ea64cb01cd4a63315f68fe70c5f949 100644 (file)
@@ -48,6 +48,7 @@ type DebugFlags struct {
        TypeAssert           int    `help:"print information about type assertion inlining"`
        TypecheckInl         int    `help:"eager typechecking of inline function bodies"`
        Unified              int    `help:"enable unified IR construction"`
+       UnifiedQuirks        int    `help:"enable unified IR construction's quirks mode"`
        WB                   int    `help:"print information about write barriers"`
        ABIWrap              int    `help:"print information about ABI wrapper generation"`
 
index 28a729f2763ee13cef10e0bf2482ddfd2c23d644..91b4c22025b8393e7557634a8c7212ef2912aeab 100644 (file)
@@ -23,10 +23,7 @@ import (
 // quirksMode controls whether behavior specific to satisfying
 // toolstash -cmp is used.
 func quirksMode() bool {
-       // Currently, unified IR doesn't try to be compatible with
-       // -d=inlfuncswithclosures=1, so we overload this as a flag for
-       // enabling quirks mode.
-       return base.Debug.InlFuncsWithClosures == 0
+       return base.Debug.UnifiedQuirks != 0
 }
 
 // posBasesOf returns all of the position bases in the source files,
index 242fa1282f4202f764787d05994c96139b38ebc6..4732892f6c015d43460befcdd09fbda50acf69fe 100644 (file)
@@ -59,7 +59,7 @@ func TestUnifiedCompare(t *testing.T) {
                        }
 
                        pkgs1 := loadPackages(t, goos, goarch, "-d=unified=0 -d=inlfuncswithclosures=0")
-                       pkgs2 := loadPackages(t, goos, goarch, "-d=unified=1 -d=inlfuncswithclosures=0")
+                       pkgs2 := loadPackages(t, goos, goarch, "-d=unified=1 -d=inlfuncswithclosures=0 -d=unifiedquirks=1")
 
                        if len(pkgs1) != len(pkgs2) {
                                t.Fatalf("length mismatch: %v != %v", len(pkgs1), len(pkgs2))