aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2019-08-15 13:09:00 -0700
committerMatthew Dempsky <mdempsky@google.com>2019-08-27 19:51:43 +0000
commitc1df5187d007f205c31d96c8cb9c173a634a102a (patch)
tree356b5b484837592228ae595f9c7850212c16be37 /src/runtime/proc.go
parent94bf9a8d4ad479e5a9dd57b3cb8e682e841d58d4 (diff)
downloadgo-c1df5187d007f205c31d96c8cb9c173a634a102a.tar.xz
runtime: simplify some pointer conversions
Use efaceOf to safely convert from *interface{} to *_eface, and to make it clearer what the pointer arithmetic is computing. Incidentally, remove a spurious unsafe.Pointer->*uint8->unsafe.Pointer round trip conversion in newproc. No behavior change. Change-Id: I2ad9d791d35d8bd008ef43b03dad1589713c5fd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/190457 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 93d329d15e..df98783385 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -413,7 +413,7 @@ func releaseSudog(s *sudog) {
// use the result as an address at which to start executing code.
//go:nosplit
func funcPC(f interface{}) uintptr {
- return **(**uintptr)(add(unsafe.Pointer(&f), sys.PtrSize))
+ return *(*uintptr)(efaceOf(&f).data)
}
// called from assembly
@@ -3253,14 +3253,14 @@ func newproc(siz int32, fn *funcval) {
gp := getg()
pc := getcallerpc()
systemstack(func() {
- newproc1(fn, (*uint8)(argp), siz, gp, pc)
+ newproc1(fn, argp, siz, gp, pc)
})
}
// Create a new g running fn with narg bytes of arguments starting
// at argp. callerpc is the address of the go statement that created
// this. The new g is put on the queue of g's waiting to run.
-func newproc1(fn *funcval, argp *uint8, narg int32, callergp *g, callerpc uintptr) {
+func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerpc uintptr) {
_g_ := getg()
if fn == nil {
@@ -3305,7 +3305,7 @@ func newproc1(fn *funcval, argp *uint8, narg int32, callergp *g, callerpc uintpt
spArg += sys.MinFrameSize
}
if narg > 0 {
- memmove(unsafe.Pointer(spArg), unsafe.Pointer(argp), uintptr(narg))
+ memmove(unsafe.Pointer(spArg), argp, uintptr(narg))
// This is a stack-to-stack copy. If write barriers
// are enabled and the source stack is grey (the
// destination is always black), then perform a