Commit 29330c11 authored by Matthew Dempsky's avatar Matthew Dempsky

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: default avatarIan Lance Taylor <iant@golang.org>
parent 1948aef6
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment