aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mfixalloc.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2015-10-21 17:19:49 -0700
committerMatthew Dempsky <mdempsky@google.com>2015-10-22 01:14:23 +0000
commit29330c118d33c8d7c8b1e7f1caf51b421bd4ee04 (patch)
tree17a800a3011aee01166aa3dc0e8825538ba9b35b /src/runtime/mfixalloc.go
parent1948aef6e3d1935cb4cfdf4a52f6c278cbbe2a8b (diff)
downloadgo-29330c118d33c8d7c8b1e7f1caf51b421bd4ee04.tar.gz
go-29330c118d33c8d7c8b1e7f1caf51b421bd4ee04.zip
runtime: change fixalloc's chunk field to unsafe.Pointer
It's never used as a *byte anyway, so might as well just make it an unsafe.Pointer instead. Change-Id: I68ee418781ab2fc574eeac0498f2515b5561b7a8 Reviewed-on: https://go-review.googlesource.com/16175 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/mfixalloc.go')
-rw-r--r--src/runtime/mfixalloc.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/mfixalloc.go b/src/runtime/mfixalloc.go
index 57a136d06b..54d4a74453 100644
--- a/src/runtime/mfixalloc.go
+++ b/src/runtime/mfixalloc.go
@@ -23,7 +23,7 @@ type fixalloc struct {
first func(arg, p unsafe.Pointer) // called first time p is returned
arg unsafe.Pointer
list *mlink
- chunk *byte
+ chunk unsafe.Pointer
nchunk uint32
inuse uintptr // in-use bytes now
stat *uint64
@@ -64,15 +64,15 @@ func fixAlloc_Alloc(f *fixalloc) unsafe.Pointer {
return v
}
if uintptr(f.nchunk) < f.size {
- f.chunk = (*uint8)(persistentalloc(_FixAllocChunk, 0, f.stat))
+ f.chunk = persistentalloc(_FixAllocChunk, 0, f.stat)
f.nchunk = _FixAllocChunk
}
- v := unsafe.Pointer(f.chunk)
+ v := f.chunk
if f.first != nil {
f.first(f.arg, v)
}
- f.chunk = (*byte)(add(unsafe.Pointer(f.chunk), f.size))
+ f.chunk = add(f.chunk, f.size)
f.nchunk -= uint32(f.size)
f.inuse += f.size
return v