aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-01-27 01:06:52 -0500
committerRuss Cox <rsc@golang.org>2021-02-19 00:01:38 +0000
commit8ac23a1f151a9b1842797652ed7761f397055b5b (patch)
treec3948d0a51feb71a12a7696df67cff07ae30e3b8 /src/runtime/proc.go
parent678568a5cfe1806c16bf478234d6dac283c3474d (diff)
downloadgo-8ac23a1f151a9b1842797652ed7761f397055b5b.tar.gz
go-8ac23a1f151a9b1842797652ed7761f397055b5b.zip
runtime: document, clean up internal/sys
Document what the values in internal/sys mean. Remove various special cases for arm64 in the code using StackAlign. Delete Uintreg - it was for GOARCH=amd64p32, which was specific to GOOS=nacl and has been retired. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I40e8fa07b4e192298b6536b98a72a751951a4383 Reviewed-on: https://go-review.googlesource.com/c/go/+/288795 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 4092dd55cb..1dbd01ed40 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -1900,7 +1900,7 @@ func oneNewExtraM() {
gp := malg(4096)
gp.sched.pc = funcPC(goexit) + sys.PCQuantum
gp.sched.sp = gp.stack.hi
- gp.sched.sp -= 4 * sys.RegSize // extra space in case of reads slightly beyond frame
+ gp.sched.sp -= 4 * sys.PtrSize // extra space in case of reads slightly beyond frame
gp.sched.lr = 0
gp.sched.g = guintptr(unsafe.Pointer(gp))
gp.syscallpc = gp.sched.pc
@@ -4009,9 +4009,9 @@ func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerp
// We could allocate a larger initial stack if necessary.
// Not worth it: this is almost always an error.
- // 4*sizeof(uintreg): extra space added below
- // sizeof(uintreg): caller's LR (arm) or return address (x86, in gostartcall).
- if siz >= _StackMin-4*sys.RegSize-sys.RegSize {
+ // 4*PtrSize: extra space added below
+ // PtrSize: caller's LR (arm) or return address (x86, in gostartcall).
+ if siz >= _StackMin-4*sys.PtrSize-sys.PtrSize {
throw("newproc: function arguments too large for new goroutine")
}
@@ -4030,8 +4030,8 @@ func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerp
throw("newproc1: new g is not Gdead")
}
- totalSize := 4*sys.RegSize + uintptr(siz) + sys.MinFrameSize // extra space in case of reads slightly beyond frame
- totalSize += -totalSize & (sys.SpAlign - 1) // align to spAlign
+ totalSize := 4*sys.PtrSize + uintptr(siz) + sys.MinFrameSize // extra space in case of reads slightly beyond frame
+ totalSize += -totalSize & (sys.StackAlign - 1) // align to StackAlign
sp := newg.stack.hi - totalSize
spArg := sp
if usesLR {