runtime: introduce, use funcPC to convert Go func to PC

This removes the ** unsafe hack.

Real bug fixed at chan.go:101.

LGTM=dave, r, iant
R=golang-codereviews, dave, r, iant
CC=dvyukov, golang-codereviews, khr
https://golang.org/cl/140870044
This commit is contained in:
Russ Cox 2014-09-03 11:10:38 -04:00
parent 2c780a35b9
commit 0e07f1c99f
9 changed files with 33 additions and 72 deletions

View file

@ -86,7 +86,7 @@ func ParForSetup(desc *ParFor, nthr, n uint32, ctx *byte, wait bool, body func(*
mp := acquirem()
mp.ptrarg[0] = unsafe.Pointer(desc)
mp.ptrarg[1] = unsafe.Pointer(ctx)
mp.ptrarg[2] = **(**unsafe.Pointer)(unsafe.Pointer(&body))
mp.ptrarg[2] = unsafe.Pointer(funcPC(body)) // TODO(rsc): Should be a scalar.
mp.scalararg[0] = uintptr(nthr)
mp.scalararg[1] = uintptr(n)
mp.scalararg[2] = 0