mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: consolidate mheap.lookup* and spanOf*
I think we'd forgotten about the mheap.lookup APIs when we introduced spanOf*, but, at any rate, the spanOf* functions are used far more widely at this point, so this CL eliminates the mheap.lookup* functions in favor of spanOf*. Change-Id: I15facd0856e238bb75d990e838a092b5bef5bdfc Reviewed-on: https://go-review.googlesource.com/85879 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
058bb7ea27
commit
a90f9a00ca
2 changed files with 23 additions and 33 deletions
|
|
@ -209,7 +209,7 @@ func stackpoolalloc(order uint8) gclinkptr {
|
|||
|
||||
// Adds stack x to the free pool. Must be called with stackpoolmu held.
|
||||
func stackpoolfree(x gclinkptr, order uint8) {
|
||||
s := mheap_.lookup(unsafe.Pointer(x))
|
||||
s := spanOfUnchecked(uintptr(x))
|
||||
if s.state != _MSpanManual {
|
||||
throw("freeing stack not in a stack span")
|
||||
}
|
||||
|
|
@ -455,7 +455,7 @@ func stackfree(stk stack) {
|
|||
c.stackcache[order].size += n
|
||||
}
|
||||
} else {
|
||||
s := mheap_.lookup(v)
|
||||
s := spanOfUnchecked(uintptr(v))
|
||||
if s.state != _MSpanManual {
|
||||
println(hex(s.base()), v)
|
||||
throw("bad span state")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue