aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mfixalloc.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2015-10-16 16:21:26 -0700
committerMatthew Dempsky <mdempsky@google.com>2015-10-17 00:26:26 +0000
commit4562784baed3b64e4ffdd3b2ea3c6d4b11391335 (patch)
tree4c37c8aa01d768e147c15b2af22d426a819a2311 /src/runtime/mfixalloc.go
parent368f73bcd9651129c1753c3486cf5b0757d4707d (diff)
downloadgo-4562784baed3b64e4ffdd3b2ea3c6d4b11391335.tar.xz
runtime: remove some unnecessary unsafe code in mfixalloc
Change-Id: Ie9ea4af4315a4d0eb69d0569726bb3eca2b397af Reviewed-on: https://go-review.googlesource.com/16005 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/mfixalloc.go')
-rw-r--r--src/runtime/mfixalloc.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/runtime/mfixalloc.go b/src/runtime/mfixalloc.go
index ec926323d8..57a136d06b 100644
--- a/src/runtime/mfixalloc.go
+++ b/src/runtime/mfixalloc.go
@@ -20,7 +20,7 @@ import "unsafe"
// smashed by freeing and reallocating.
type fixalloc struct {
size uintptr
- first unsafe.Pointer // go func(unsafe.pointer, unsafe.pointer); f(arg, p) called first time p is returned
+ first func(arg, p unsafe.Pointer) // called first time p is returned
arg unsafe.Pointer
list *mlink
chunk *byte
@@ -40,9 +40,9 @@ type mlink struct {
// Initialize f to allocate objects of the given size,
// using the allocator to obtain chunks of memory.
-func fixAlloc_Init(f *fixalloc, size uintptr, first func(unsafe.Pointer, unsafe.Pointer), arg unsafe.Pointer, stat *uint64) {
+func fixAlloc_Init(f *fixalloc, size uintptr, first func(arg, p unsafe.Pointer), arg unsafe.Pointer, stat *uint64) {
f.size = size
- f.first = *(*unsafe.Pointer)(unsafe.Pointer(&first))
+ f.first = first
f.arg = arg
f.list = nil
f.chunk = nil
@@ -70,8 +70,7 @@ func fixAlloc_Alloc(f *fixalloc) unsafe.Pointer {
v := unsafe.Pointer(f.chunk)
if f.first != nil {
- fn := *(*func(unsafe.Pointer, unsafe.Pointer))(unsafe.Pointer(&f.first))
- fn(f.arg, v)
+ f.first(f.arg, v)
}
f.chunk = (*byte)(add(unsafe.Pointer(f.chunk), f.size))
f.nchunk -= uint32(f.size)