"internal/godebugs",
"internal/goexperiment",
"internal/goos",
+ "internal/stringslite",
}
// extraNoInstrumentPkgs is the set of packages in addition to runtimePkgs that
import (
"internal/abi"
+ "internal/stringslite"
"unsafe"
)
return false
}
f := findfunc(ctxt.sigpc())
- if !(hasPrefix(funcname(f), "runtime.debugCall") || hasPrefix(funcname(f), "debugCall")) {
+ if !(stringslite.HasPrefix(funcname(f), "runtime.debugCall") || stringslite.HasPrefix(funcname(f), "debugCall")) {
println("trap in unknown function", funcname(f))
return false
}
import (
"internal/abi"
"internal/goarch"
+ "internal/stringslite"
"unsafe"
)
// level by the program but will otherwise be ignored.
flags = _SigNotify
for sig, t = range sigtable {
- if hasPrefix(notestr, t.name) {
+ if stringslite.HasPrefix(notestr, t.name) {
flags = t.flags
break
}
import (
"internal/abi"
"internal/runtime/atomic"
+ "internal/stringslite"
"unsafe"
)
return 0
}
for i := 0; i < len(s); i++ {
- if s[i] == t[0] && hasPrefix(s[i:], t) {
+ if s[i] == t[0] && stringslite.HasPrefix(s[i:], t) {
return i
}
}
}
func atolwhex(p string) int64 {
- for hasPrefix(p, " ") || hasPrefix(p, "\t") {
+ for stringslite.HasPrefix(p, " ") || stringslite.HasPrefix(p, "\t") {
p = p[1:]
}
neg := false
- if hasPrefix(p, "-") || hasPrefix(p, "+") {
+ if stringslite.HasPrefix(p, "-") || stringslite.HasPrefix(p, "+") {
neg = p[0] == '-'
p = p[1:]
- for hasPrefix(p, " ") || hasPrefix(p, "\t") {
+ for stringslite.HasPrefix(p, " ") || stringslite.HasPrefix(p, "\t") {
p = p[1:]
}
}
var n int64
switch {
- case hasPrefix(p, "0x"), hasPrefix(p, "0X"):
+ case stringslite.HasPrefix(p, "0x"), stringslite.HasPrefix(p, "0X"):
p = p[2:]
for ; len(p) > 0; p = p[1:] {
if '0' <= p[0] && p[0] <= '9' {
break
}
}
- case hasPrefix(p, "0"):
+ case stringslite.HasPrefix(p, "0"):
for ; len(p) > 0 && '0' <= p[0] && p[0] <= '7'; p = p[1:] {
n = n*8 + int64(p[0]-'0')
}
"internal/abi"
"internal/goarch"
"internal/runtime/atomic"
+ "internal/stringslite"
"runtime/internal/sys"
"unsafe"
)
// pc should be the program counter of the compiler-generated code that
// triggered this panic.
func panicCheck1(pc uintptr, msg string) {
- if goarch.IsWasm == 0 && hasPrefix(funcname(findfunc(pc)), "runtime.") {
+ if goarch.IsWasm == 0 && stringslite.HasPrefix(funcname(findfunc(pc)), "runtime.") {
// Note: wasm can't tail call, so we can't get the original caller's pc.
throw(msg)
}
import (
"internal/abi"
"internal/goarch"
+ "internal/stringslite"
)
type suspendGState struct {
// Check the inner-most name
u, uf := newInlineUnwinder(f, pc)
name := u.srcFunc(uf).name()
- if hasPrefix(name, "runtime.") ||
- hasPrefix(name, "runtime/internal/") ||
- hasPrefix(name, "reflect.") {
+ if stringslite.HasPrefix(name, "runtime.") ||
+ stringslite.HasPrefix(name, "runtime/internal/") ||
+ stringslite.HasPrefix(name, "reflect.") {
// For now we never async preempt the runtime or
// anything closely tied to the runtime. Known issues
// include: various points in the scheduler ("don't
"internal/goarch"
"internal/goos"
"internal/runtime/atomic"
+ "internal/stringslite"
"runtime/internal/sys"
"unsafe"
)
p := argv_index(argv, argc+1+i)
s := unsafe.String(p, findnull(p))
- if hasPrefix(s, prefix) {
+ if stringslite.HasPrefix(s, prefix) {
env = gostring(p)[len(prefix):]
break
}
// received from somewhere else (with _LostSIGPROFDuringAtomic64 as pc).
if GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm" {
if f := findfunc(pc); f.valid() {
- if hasPrefix(funcname(f), "internal/runtime/atomic") {
+ if stringslite.HasPrefix(funcname(f), "internal/runtime/atomic") {
cpuprof.lostAtomic++
return
}
package runtime
+import (
+ "internal/stringslite"
+)
+
func secure() {
initSecureMode()
func secureEnv() {
var hasTraceback bool
for i := 0; i < len(envs); i++ {
- if hasPrefix(envs[i], "GOTRACEBACK=") {
+ if stringslite.HasPrefix(envs[i], "GOTRACEBACK=") {
hasTraceback = true
envs[i] = "GOTRACEBACK=none"
}
return s
}
-func hasPrefix(s, prefix string) bool {
- return len(s) >= len(prefix) && s[:len(prefix)] == prefix
-}
-
-func hasSuffix(s, suffix string) bool {
- return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix
-}
-
const (
maxUint64 = ^uint64(0)
maxInt64 = int64(maxUint64 >> 1)
import (
"internal/abi"
+ "internal/stringslite"
"runtime/internal/sys"
)
for ; uf.valid(); uf = u.next(uf) {
file, line := u.fileLine(uf)
const wantFile = "symtabinl_test.go"
- if !hasSuffix(file, wantFile) {
+ if !stringslite.HasSuffix(file, wantFile) {
t.Errorf("tiuTest+%#x: want file ...%s, got %s", pc-pc1, wantFile, file)
}
name := sf.name()
const namePrefix = "runtime."
- if hasPrefix(name, namePrefix) {
+ if stringslite.HasPrefix(name, namePrefix) {
name = name[len(namePrefix):]
}
- if !hasPrefix(name, "tiu") {
+ if !stringslite.HasPrefix(name, "tiu") {
t.Errorf("tiuTest+%#x: unexpected function %s", pc-pc1, name)
}
"internal/abi"
"internal/bytealg"
"internal/goarch"
+ "internal/stringslite"
"runtime/internal/sys"
"unsafe"
)
return true
}
- return bytealg.IndexByteString(name, '.') >= 0 && (!hasPrefix(name, "runtime.") || isExportedRuntime(name))
+ return bytealg.IndexByteString(name, '.') >= 0 && (!stringslite.HasPrefix(name, "runtime.") || isExportedRuntime(name))
}
// isExportedRuntime reports whether name is an exported runtime function.
}
return fingStatus.Load()&fingRunningFinalizer == 0
}
- return hasPrefix(funcname(f), "runtime.")
+ return stringslite.HasPrefix(funcname(f), "runtime.")
}
// SetCgoTraceback records three C functions to use to gather