Skip to content

Commit fc5073b

Browse files
committed
runtime,internal: move runtime/internal/sys to internal/runtime/sys
Cleanup and friction reduction For #65355. Change-Id: Ia14c9dc584a529a35b97801dd3e95b9acc99a511 Reviewed-on: https://go-review.googlesource.com/c/go/+/600436 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
1 parent f9eb3e3 commit fc5073b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+89
-89
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ _testmain.go
3737
/src/go/build/zcgo.go
3838
/src/go/doc/headscan
3939
/src/internal/buildcfg/zbootstrap.go
40-
/src/runtime/internal/sys/zversion.go
40+
/src/internal/runtime/sys/zversion.go
4141
/src/unicode/maketables
4242
/src/time/tzdata/zzipdata.go
4343
/test.out

src/cmd/compile/internal/noder/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ func isTypeParam(t types2.Type) bool {
114114
}
115115

116116
// isNotInHeap reports whether typ is or contains an element of type
117-
// runtime/internal/sys.NotInHeap.
117+
// internal/runtime/sys.NotInHeap.
118118
func isNotInHeap(typ types2.Type) bool {
119119
typ = types2.Unalias(typ)
120120
if named, ok := typ.(*types2.Named); ok {
121-
if obj := named.Obj(); obj.Name() == "nih" && obj.Pkg().Path() == "runtime/internal/sys" {
121+
if obj := named.Obj(); obj.Name() == "nih" && obj.Pkg().Path() == "internal/runtime/sys" {
122122
return true
123123
}
124124
typ = named.Underlying()

src/cmd/compile/internal/ssagen/ssa.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4287,13 +4287,13 @@ func InitTables() {
42874287
// make it worthwhile as an intrinsic
42884288
brev_arch = append(brev_arch, sys.PPC64)
42894289
}
4290-
/******** runtime/internal/sys ********/
4291-
addF("runtime/internal/sys", "Bswap32",
4290+
/******** internal/runtime/sys ********/
4291+
addF("internal/runtime/sys", "Bswap32",
42924292
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
42934293
return s.newValue1(ssa.OpBswap32, types.Types[types.TUINT32], args[0])
42944294
},
42954295
brev_arch...)
4296-
addF("runtime/internal/sys", "Bswap64",
4296+
addF("internal/runtime/sys", "Bswap64",
42974297
func(s *state, n *ir.CallExpr, args []*ssa.Value) *ssa.Value {
42984298
return s.newValue1(ssa.OpBswap64, types.Types[types.TUINT64], args[0])
42994299
},
@@ -4309,9 +4309,9 @@ func InitTables() {
43094309

43104310
// Make Prefetch intrinsics for supported platforms
43114311
// On the unsupported platforms stub function will be eliminated
4312-
addF("runtime/internal/sys", "Prefetch", makePrefetchFunc(ssa.OpPrefetchCache),
4312+
addF("internal/runtime/sys", "Prefetch", makePrefetchFunc(ssa.OpPrefetchCache),
43134313
sys.AMD64, sys.ARM64, sys.PPC64)
4314-
addF("runtime/internal/sys", "PrefetchStreamed", makePrefetchFunc(ssa.OpPrefetchCacheStreamed),
4314+
addF("internal/runtime/sys", "PrefetchStreamed", makePrefetchFunc(ssa.OpPrefetchCacheStreamed),
43154315
sys.AMD64, sys.ARM64, sys.PPC64)
43164316

43174317
/******** internal/runtime/atomic ********/
@@ -4837,8 +4837,8 @@ func InitTables() {
48374837
return s.newValue1(ssa.OpCtz64, types.Types[types.TINT], y)
48384838
},
48394839
sys.S390X)
4840-
alias("math/bits", "ReverseBytes64", "runtime/internal/sys", "Bswap64", all...)
4841-
alias("math/bits", "ReverseBytes32", "runtime/internal/sys", "Bswap32", all...)
4840+
alias("math/bits", "ReverseBytes64", "internal/runtime/sys", "Bswap64", all...)
4841+
alias("math/bits", "ReverseBytes32", "internal/runtime/sys", "Bswap32", all...)
48424842
// ReverseBytes inlines correctly, no need to intrinsify it.
48434843
// Nothing special is needed for targets where ReverseBytes16 lowers to a rotate
48444844
// On Power10, 16-bit rotate is not available so use BRH instruction
@@ -5051,12 +5051,12 @@ func InitTables() {
50515051
sys.AMD64)
50525052
alias("math/bits", "Div", "math/bits", "Div64", sys.ArchAMD64)
50535053

5054-
alias("runtime/internal/sys", "TrailingZeros8", "math/bits", "TrailingZeros8", all...)
5055-
alias("runtime/internal/sys", "TrailingZeros32", "math/bits", "TrailingZeros32", all...)
5056-
alias("runtime/internal/sys", "TrailingZeros64", "math/bits", "TrailingZeros64", all...)
5057-
alias("runtime/internal/sys", "Len8", "math/bits", "Len8", all...)
5058-
alias("runtime/internal/sys", "Len64", "math/bits", "Len64", all...)
5059-
alias("runtime/internal/sys", "OnesCount64", "math/bits", "OnesCount64", all...)
5054+
alias("internal/runtime/sys", "TrailingZeros8", "math/bits", "TrailingZeros8", all...)
5055+
alias("internal/runtime/sys", "TrailingZeros32", "math/bits", "TrailingZeros32", all...)
5056+
alias("internal/runtime/sys", "TrailingZeros64", "math/bits", "TrailingZeros64", all...)
5057+
alias("internal/runtime/sys", "Len8", "math/bits", "Len8", all...)
5058+
alias("internal/runtime/sys", "Len64", "math/bits", "Len64", all...)
5059+
alias("internal/runtime/sys", "OnesCount64", "math/bits", "OnesCount64", all...)
50605060

50615061
/******** sync/atomic ********/
50625062

src/cmd/compile/internal/test/inl_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func TestIntendedInlining(t *testing.T) {
9797
"traceLocker.ok",
9898
"traceEnabled",
9999
},
100-
"runtime/internal/sys": {},
100+
"internal/runtime/sys": {},
101101
"internal/runtime/math": {
102102
"MulUintptr",
103103
},
@@ -246,9 +246,9 @@ func TestIntendedInlining(t *testing.T) {
246246
if runtime.GOARCH != "386" {
247247
// As explained above, TrailingZeros64 and TrailingZeros32 are not Go code on 386.
248248
// The same applies to Bswap32.
249-
want["runtime/internal/sys"] = append(want["runtime/internal/sys"], "TrailingZeros64")
250-
want["runtime/internal/sys"] = append(want["runtime/internal/sys"], "TrailingZeros32")
251-
want["runtime/internal/sys"] = append(want["runtime/internal/sys"], "Bswap32")
249+
want["internal/runtime/sys"] = append(want["internal/runtime/sys"], "TrailingZeros64")
250+
want["internal/runtime/sys"] = append(want["internal/runtime/sys"], "TrailingZeros32")
251+
want["internal/runtime/sys"] = append(want["internal/runtime/sys"], "Bswap32")
252252
}
253253
if runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64" || runtime.GOARCH == "loong64" || runtime.GOARCH == "mips" || runtime.GOARCH == "mips64" || runtime.GOARCH == "ppc64" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "s390x" {
254254
// internal/runtime/atomic.Loaduintptr is only intrinsified on these platforms.

src/cmd/compile/internal/types/pkg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
var pkgMap = make(map[string]*Pkg)
1717

1818
type Pkg struct {
19-
Path string // string literal used in import statement, e.g. "runtime/internal/sys"
19+
Path string // string literal used in import statement, e.g. "internal/runtime/sys"
2020
Name string // package name, e.g. "sys"
2121
Prefix string // escaped path for use in symbol table
2222
Syms map[string]*Sym

src/cmd/compile/internal/types/type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ func NewNamed(obj Object) *Type {
16501650
t.SetIsShape(true)
16511651
t.SetHasShape(true)
16521652
}
1653-
if sym.Pkg.Path == "runtime/internal/sys" && sym.Name == "nih" {
1653+
if sym.Pkg.Path == "internal/runtime/sys" && sym.Name == "nih" {
16541654
// Recognize the special not-in-heap type. Any type including
16551655
// this type will also be not-in-heap.
16561656
// This logic is duplicated in go/types and

src/cmd/dist/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ var gentab = []struct {
639639
}{
640640
{"go/build", "zcgo.go", mkzcgo},
641641
{"cmd/go/internal/cfg", "zdefaultcc.go", mkzdefaultcc},
642-
{"runtime/internal/sys", "zversion.go", mkzversion},
642+
{"internal/runtime/sys", "zversion.go", mkzversion},
643643
{"time/tzdata", "zzipdata.go", mktzdata},
644644
}
645645

@@ -1707,7 +1707,7 @@ func checkNotStale(env []string, goBinary string, targets ...string) {
17071707
out := runEnv(workdir, CheckExit, env, append(goCmd, targets...)...)
17081708
if strings.Contains(out, "\tSTALE ") {
17091709
os.Setenv("GODEBUG", "gocachehash=1")
1710-
for _, target := range []string{"runtime/internal/sys", "cmd/dist", "cmd/link"} {
1710+
for _, target := range []string{"internal/runtime/sys", "cmd/dist", "cmd/link"} {
17111711
if strings.Contains(out, "STALE "+target) {
17121712
run(workdir, ShowOutput|CheckExit, goBinary, "list", "-f={{.ImportPath}} {{.Stale}}", target)
17131713
break

src/cmd/distpack/pack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func main() {
132132
// Generated during cmd/dist. See ../dist/build.go:/gentab.
133133
"src/cmd/go/internal/cfg/zdefaultcc.go",
134134
"src/go/build/zcgo.go",
135-
"src/runtime/internal/sys/zversion.go",
135+
"src/internal/runtime/sys/zversion.go",
136136
"src/time/tzdata/zzipdata.go",
137137

138138
// Generated during cmd/dist by bootstrapBuildTools.

src/cmd/distpack/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var srcRules = []testRule{
3535
{name: "go/pkg/**", exclude: true},
3636
{name: "go/src/cmd/dist/dist", exclude: true},
3737
{name: "go/src/cmd/dist/dist.exe", exclude: true},
38-
{name: "go/src/runtime/internal/sys/zversion.go", exclude: true},
38+
{name: "go/src/internal/runtime/sys/zversion.go", exclude: true},
3939
{name: "go/src/time/tzdata/zzipdata.go", exclude: true},
4040
}
4141

src/cmd/go/go_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -943,14 +943,14 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
943943
tg.run("install", "p1")
944944
tg.wantNotStale("p1", "", "./testgo list claims p1 is stale, incorrectly, before any changes")
945945

946-
// Changing mtime of runtime/internal/sys/sys.go
946+
// Changing mtime of internal/runtime/sys/sys.go
947947
// should have no effect: only the content matters.
948948
// In fact this should be true even outside a release branch.
949-
sys := tg.path("goroot/src/runtime/internal/sys/sys.go")
949+
sys := tg.path("goroot/src/internal/runtime/sys/sys.go")
950950
tg.sleep()
951951
restore := addVar(sys, 0)
952952
restore()
953-
tg.wantNotStale("p1", "", "./testgo list claims p1 is stale, incorrectly, after updating mtime of runtime/internal/sys/sys.go")
953+
tg.wantNotStale("p1", "", "./testgo list claims p1 is stale, incorrectly, after updating mtime of internal/runtime/sys/sys.go")
954954

955955
// But changing content of any file should have an effect.
956956
// Previously zversion.go was the only one that mattered;

0 commit comments

Comments
 (0)