Skip to content

Commit

Permalink
runtime: change fixalloc's chunk field to unsafe.Pointer
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
mdempsky committed Oct 22, 2015
1 parent 1948aef commit 29330c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/mfixalloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 29330c1

Please sign in to comment.