Skip to content

Commit 29330c1

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 1948aef commit 29330c1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/runtime/mfixalloc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type fixalloc struct {
2323
first func(arg, p unsafe.Pointer) // called first time p is returned
2424
arg unsafe.Pointer
2525
list *mlink
26-
chunk *byte
26+
chunk unsafe.Pointer
2727
nchunk uint32
2828
inuse uintptr // in-use bytes now
2929
stat *uint64
@@ -64,15 +64,15 @@ func fixAlloc_Alloc(f *fixalloc) unsafe.Pointer {
6464
return v
6565
}
6666
if uintptr(f.nchunk) < f.size {
67-
f.chunk = (*uint8)(persistentalloc(_FixAllocChunk, 0, f.stat))
67+
f.chunk = persistentalloc(_FixAllocChunk, 0, f.stat)
6868
f.nchunk = _FixAllocChunk
6969
}
7070

71-
v := unsafe.Pointer(f.chunk)
71+
v := f.chunk
7272
if f.first != nil {
7373
f.first(f.arg, v)
7474
}
75-
f.chunk = (*byte)(add(unsafe.Pointer(f.chunk), f.size))
75+
f.chunk = add(f.chunk, f.size)
7676
f.nchunk -= uint32(f.size)
7777
f.inuse += f.size
7878
return v

0 commit comments

Comments
 (0)