return false, 0, false
}
+ if base.Debug.Checkptr != 0 && types.IsRuntimePkg(callee.Sym().Pkg) {
+ // We don't intrument runtime packages for checkptr (see base/flag.go).
+ if log && logopt.Enabled() {
+ logopt.LogOpt(n.Pos(), "cannotInlineCall", "inline", ir.FuncName(callerfn),
+ fmt.Sprintf(`call to into runtime package function %s in -d=checkptr build`, ir.PkgFuncName(callee)))
+ }
+ return false, 0, false
+ }
+
// Check if we've already inlined this function at this particular
// call site, in order to stop inlining when we reach the beginning
// of a recursion cycle again. We don't inline immediately recursive
return objabi.LookupPkgSpecial(p.Path).NoRaceFunc
}
+// IsRuntimePkg reports whether p is a runtime package.
+func IsRuntimePkg(p *Pkg) bool {
+ return objabi.LookupPkgSpecial(p.Path).Runtime
+}
+
// ReceiverBaseType returns the underlying type, if any,
// that owns methods with receiver parameter t.
// The result is either a named type or an anonymous struct.
//
// - Optimizations are always enabled.
//
+ // - Checkptr is always disabled.
+ //
// This should be set for runtime and all packages it imports, and may be
// set for additional packages.
Runtime bool
buf []byte
}
-// This is just a wrapper around abi.NoEscape.
-//
-// This wrapper is necessary because internal/abi is a runtime package,
-// so it can not be built with -d=checkptr, causing incorrect inlining
-// decision when building with checkptr enabled, see issue #68415.
-//
-//go:nosplit
-//go:nocheckptr
-func noescape(p unsafe.Pointer) unsafe.Pointer {
- return abi.NoEscape(p)
-}
-
func (b *Builder) copyCheck() {
if b.addr == nil {
// This hack works around a failing of Go's escape analysis
// See issue 23382.
// TODO: once issue 7921 is fixed, this should be reverted to
// just "b.addr = b".
- b.addr = (*Builder)(noescape(unsafe.Pointer(b)))
+ b.addr = (*Builder)(abi.NoEscape(unsafe.Pointer(b)))
} else if b.addr != b {
panic("strings: illegal use of non-zero Builder copied by value")
}
package main
-import "regexp"
+import (
+ "regexp"
+ "unique"
+)
var dataFileRegexp = regexp.MustCompile(`^data\.\d+\.bin$`)
func main() {
_ = dataFileRegexp
+ unique.Make("")
}