summaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal')
-rw-r--r--src/cmd/compile/internal/gc/bootstrap.go17
-rw-r--r--src/cmd/compile/internal/gc/pprof.go14
-rw-r--r--src/cmd/compile/internal/gc/trace.go30
-rw-r--r--src/cmd/compile/internal/gc/util.go16
-rw-r--r--src/cmd/compile/internal/logopt/escape.go14
-rw-r--r--src/cmd/compile/internal/logopt/escape_bootstrap.go13
-rw-r--r--src/cmd/compile/internal/logopt/log_opts.go4
-rw-r--r--src/cmd/compile/internal/noder/stencil.go3
8 files changed, 16 insertions, 95 deletions
diff --git a/src/cmd/compile/internal/gc/bootstrap.go b/src/cmd/compile/internal/gc/bootstrap.go
deleted file mode 100644
index 37b0d59ede..0000000000
--- a/src/cmd/compile/internal/gc/bootstrap.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.8
-// +build !go1.8
-
-package gc
-
-import (
- "cmd/compile/internal/base"
- "runtime"
-)
-
-func startMutexProfiling() {
- base.Fatalf("mutex profiling unavailable in version %v", runtime.Version())
-}
diff --git a/src/cmd/compile/internal/gc/pprof.go b/src/cmd/compile/internal/gc/pprof.go
deleted file mode 100644
index 5f9b030621..0000000000
--- a/src/cmd/compile/internal/gc/pprof.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.8
-// +build go1.8
-
-package gc
-
-import "runtime"
-
-func startMutexProfiling() {
- runtime.SetMutexProfileFraction(1)
-}
diff --git a/src/cmd/compile/internal/gc/trace.go b/src/cmd/compile/internal/gc/trace.go
deleted file mode 100644
index 8cdbd4b0f3..0000000000
--- a/src/cmd/compile/internal/gc/trace.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.7
-// +build go1.7
-
-package gc
-
-import (
- "os"
- tracepkg "runtime/trace"
-
- "cmd/compile/internal/base"
-)
-
-func init() {
- traceHandler = traceHandlerGo17
-}
-
-func traceHandlerGo17(traceprofile string) {
- f, err := os.Create(traceprofile)
- if err != nil {
- base.Fatalf("%v", err)
- }
- if err := tracepkg.Start(f); err != nil {
- base.Fatalf("%v", err)
- }
- base.AtExit(tracepkg.Stop)
-}
diff --git a/src/cmd/compile/internal/gc/util.go b/src/cmd/compile/internal/gc/util.go
index 56fd137de2..dcac0ce79a 100644
--- a/src/cmd/compile/internal/gc/util.go
+++ b/src/cmd/compile/internal/gc/util.go
@@ -8,12 +8,11 @@ import (
"os"
"runtime"
"runtime/pprof"
+ tracepkg "runtime/trace"
"cmd/compile/internal/base"
)
-var traceHandler func(string)
-
func startProfile() {
if base.Flag.CPUProfile != "" {
f, err := os.Create(base.Flag.CPUProfile)
@@ -64,13 +63,20 @@ func startProfile() {
if err != nil {
base.Fatalf("%v", err)
}
- startMutexProfiling()
+ runtime.SetMutexProfileFraction(1)
base.AtExit(func() {
pprof.Lookup("mutex").WriteTo(f, 0)
f.Close()
})
}
- if base.Flag.TraceProfile != "" && traceHandler != nil {
- traceHandler(base.Flag.TraceProfile)
+ if base.Flag.TraceProfile != "" {
+ f, err := os.Create(base.Flag.TraceProfile)
+ if err != nil {
+ base.Fatalf("%v", err)
+ }
+ if err := tracepkg.Start(f); err != nil {
+ base.Fatalf("%v", err)
+ }
+ base.AtExit(tracepkg.Stop)
}
}
diff --git a/src/cmd/compile/internal/logopt/escape.go b/src/cmd/compile/internal/logopt/escape.go
deleted file mode 100644
index 9660e938b4..0000000000
--- a/src/cmd/compile/internal/logopt/escape.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.8
-// +build go1.8
-
-package logopt
-
-import "net/url"
-
-func pathEscape(s string) string {
- return url.PathEscape(s)
-}
diff --git a/src/cmd/compile/internal/logopt/escape_bootstrap.go b/src/cmd/compile/internal/logopt/escape_bootstrap.go
deleted file mode 100644
index cc04eaadfd..0000000000
--- a/src/cmd/compile/internal/logopt/escape_bootstrap.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.8
-// +build !go1.8
-
-package logopt
-
-// For bootstrapping with an early version of Go
-func pathEscape(s string) string {
- panic("This should never be called; the compiler is not fully bootstrapped if it is.")
-}
diff --git a/src/cmd/compile/internal/logopt/log_opts.go b/src/cmd/compile/internal/logopt/log_opts.go
index 9fee83426f..09825e8278 100644
--- a/src/cmd/compile/internal/logopt/log_opts.go
+++ b/src/cmd/compile/internal/logopt/log_opts.go
@@ -376,7 +376,7 @@ func writerForLSP(subdirpath, file string) io.WriteCloser {
if lastdot != -1 {
basename = basename[:lastdot]
}
- basename = pathEscape(basename)
+ basename = url.PathEscape(basename)
// Assume a directory, make a file
p := filepath.Join(subdirpath, basename+".json")
@@ -428,7 +428,7 @@ func FlushLoggedOpts(ctxt *obj.Link, slashPkgPath string) {
if slashPkgPath == "" {
slashPkgPath = "\000"
}
- subdirpath := filepath.Join(dest, pathEscape(slashPkgPath))
+ subdirpath := filepath.Join(dest, url.PathEscape(slashPkgPath))
err := os.MkdirAll(subdirpath, 0755)
if err != nil {
log.Fatalf("Could not create directory %s for logging optimizer actions, %v", subdirpath, err)
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index 280f7cdf1c..d3f51e00cd 100644
--- a/src/cmd/compile/internal/noder/stencil.go
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -1357,6 +1357,9 @@ func (g *genInst) dictPass(info *instInfo) {
}
case ir.ODOTTYPE, ir.ODOTTYPE2:
dt := m.(*ir.TypeAssertExpr)
+ if dt.Type().IsEmptyInterface() || (dt.Type().IsInterface() && !dt.Type().HasShape()) {
+ break
+ }
if !dt.Type().HasShape() && !(dt.X.Type().HasShape() && !dt.X.Type().IsEmptyInterface()) {
break
}