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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]>
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

+1-1
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

+2-2
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

+13-13
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

+4-4
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

+1-1
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

+1-1
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

+2-2
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

+1-1
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

+1-1
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

+3-3
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;

src/cmd/internal/objabi/pkgspecial.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var runtimePkgs = []string{
4848
"internal/runtime/atomic",
4949
"internal/runtime/exithook",
5050
"internal/runtime/math",
51-
"runtime/internal/sys",
51+
"internal/runtime/sys",
5252
"internal/runtime/syscall",
5353

5454
"internal/abi",

src/cmd/internal/objabi/stack.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func StackNosplit(race bool) int {
1818
// stack guard size. Larger multipliers are used for non-optimized
1919
// builds that have larger stack frames or for specific targets.
2020
func stackGuardMultiplier(race bool) int {
21-
// This arithmetic must match that in runtime/internal/sys/consts.go:StackGuardMultiplier.
21+
// This arithmetic must match that in internal/runtime/sys/consts.go:StackGuardMultiplier.
2222
n := 1
2323
// On AIX, a larger stack is needed for syscalls.
2424
if buildcfg.GOOS == "aix" {

src/go/build/deps_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ var depsRules = `
8383
< internal/stringslite
8484
< internal/itoa
8585
< internal/unsafeheader
86-
< runtime/internal/sys
86+
< internal/runtime/sys
8787
< internal/runtime/syscall
8888
< internal/runtime/atomic
8989
< internal/runtime/exithook

src/internal/coverage/pkid.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ package coverage
2626
// slot: 1 path='internal/goarch' hard-coded id: 2
2727
// slot: 2 path='internal/runtime/atomic' hard-coded id: 3
2828
// slot: 3 path='internal/goos'
29-
// slot: 4 path='runtime/internal/sys' hard-coded id: 5
29+
// slot: 4 path='internal/runtime/sys' hard-coded id: 5
3030
// slot: 5 path='internal/abi' hard-coded id: 4
3131
// slot: 6 path='internal/runtime/math' hard-coded id: 6
3232
// slot: 7 path='internal/bytealg' hard-coded id: 7
@@ -50,7 +50,7 @@ var rtPkgs = [...]string{
5050
"internal/runtime/atomic",
5151
"internal/goos",
5252
"internal/chacha8rand",
53-
"runtime/internal/sys",
53+
"internal/runtime/sys",
5454
"internal/abi",
5555
"internal/runtime/math",
5656
"internal/bytealg",

src/runtime/internal/sys/intrinsics_test.go renamed to src/internal/runtime/sys/intrinsics_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package sys_test
66

77
import (
8-
"runtime/internal/sys"
8+
"internal/runtime/sys"
99
"testing"
1010
)
1111

File renamed without changes.
File renamed without changes.

src/reflect/deepequal.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func deepValueEqual(v1, v2 Value, visited map[visit]bool) bool {
4141
case Pointer:
4242
if !v1.typ().Pointers() {
4343
// not-in-heap pointers can't be cyclic.
44-
// At least, all of our current uses of runtime/internal/sys.NotInHeap
44+
// At least, all of our current uses of internal/runtime/sys.NotInHeap
4545
// have that property. The runtime ones aren't cyclic (and we don't use
4646
// DeepEqual on them anyway), and the cgo-generated ones are
4747
// all empty structs.

src/runtime/HACKING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ There are three mechanisms for allocating unmanaged memory:
235235
objects of the same type.
236236

237237
In general, types that are allocated using any of these should be
238-
marked as not in heap by embedding `runtime/internal/sys.NotInHeap`.
238+
marked as not in heap by embedding `internal/runtime/sys.NotInHeap`.
239239

240240
Objects that are allocated in unmanaged memory **must not** contain
241241
heap pointers unless the following rules are also obeyed:

src/runtime/arena.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ import (
8787
"internal/goarch"
8888
"internal/runtime/atomic"
8989
"internal/runtime/math"
90-
"runtime/internal/sys"
90+
"internal/runtime/sys"
9191
"unsafe"
9292
)
9393

src/runtime/cgo/cgo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ package cgo
3232
*/
3333
import "C"
3434

35-
import "runtime/internal/sys"
35+
import "internal/runtime/sys"
3636

3737
// Incomplete is used specifically for the semantics of incomplete C types.
3838
type Incomplete struct {

src/runtime/cgocall.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ import (
8888
"internal/abi"
8989
"internal/goarch"
9090
"internal/goexperiment"
91-
"runtime/internal/sys"
91+
"internal/runtime/sys"
9292
"unsafe"
9393
)
9494

src/runtime/cpuprof.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ package runtime
1414

1515
import (
1616
"internal/abi"
17-
"runtime/internal/sys"
17+
"internal/runtime/sys"
1818
"unsafe"
1919
)
2020

src/runtime/debuglog.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package runtime
1818
import (
1919
"internal/abi"
2020
"internal/runtime/atomic"
21-
"runtime/internal/sys"
21+
"internal/runtime/sys"
2222
"unsafe"
2323
)
2424

src/runtime/export_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"internal/goarch"
1212
"internal/goos"
1313
"internal/runtime/atomic"
14-
"runtime/internal/sys"
14+
"internal/runtime/sys"
1515
"unsafe"
1616
)
1717

src/runtime/histogram.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package runtime
66

77
import (
88
"internal/runtime/atomic"
9-
"runtime/internal/sys"
9+
"internal/runtime/sys"
1010
"unsafe"
1111
)
1212

src/runtime/iface.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"internal/abi"
99
"internal/goarch"
1010
"internal/runtime/atomic"
11-
"runtime/internal/sys"
11+
"internal/runtime/sys"
1212
"unsafe"
1313
)
1414

src/runtime/malloc.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ import (
105105
"internal/goos"
106106
"internal/runtime/atomic"
107107
"internal/runtime/math"
108-
"runtime/internal/sys"
108+
"internal/runtime/sys"
109109
"unsafe"
110110
)
111111

@@ -1555,7 +1555,7 @@ var persistentChunks *notInHeap
15551555
// sysStat must be non-nil.
15561556
//
15571557
// Consider marking persistentalloc'd types not in heap by embedding
1558-
// runtime/internal/sys.NotInHeap.
1558+
// internal/runtime/sys.NotInHeap.
15591559
func persistentalloc(size, align uintptr, sysStat *sysMemStat) unsafe.Pointer {
15601560
var p *notInHeap
15611561
systemstack(func() {
@@ -1697,7 +1697,7 @@ func (l *linearAlloc) alloc(size, align uintptr, sysStat *sysMemStat) unsafe.Poi
16971697
// like sysAlloc or persistentAlloc.
16981698
//
16991699
// In general, it's better to use real types which embed
1700-
// runtime/internal/sys.NotInHeap, but this serves as a generic type
1700+
// internal/runtime/sys.NotInHeap, but this serves as a generic type
17011701
// for situations where that isn't possible (like in the allocators).
17021702
//
17031703
// TODO: Use this as the return type of sysAlloc, persistentAlloc, etc?

src/runtime/mbitmap.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import (
5959
"internal/abi"
6060
"internal/goarch"
6161
"internal/runtime/atomic"
62-
"runtime/internal/sys"
62+
"internal/runtime/sys"
6363
"unsafe"
6464
)
6565

src/runtime/mcache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package runtime
66

77
import (
88
"internal/runtime/atomic"
9-
"runtime/internal/sys"
9+
"internal/runtime/sys"
1010
"unsafe"
1111
)
1212

src/runtime/mcentral.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ package runtime
1414

1515
import (
1616
"internal/runtime/atomic"
17-
"runtime/internal/sys"
17+
"internal/runtime/sys"
1818
)
1919

2020
// Central list of free objects of a given size.

src/runtime/mcheckmark.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ package runtime
1515
import (
1616
"internal/goarch"
1717
"internal/runtime/atomic"
18-
"runtime/internal/sys"
18+
"internal/runtime/sys"
1919
"unsafe"
2020
)
2121

src/runtime/mfinal.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"internal/abi"
1111
"internal/goarch"
1212
"internal/runtime/atomic"
13-
"runtime/internal/sys"
13+
"internal/runtime/sys"
1414
"unsafe"
1515
)
1616

0 commit comments

Comments
 (0)