]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: change fixalloc's chunk field to unsafe.Pointer
authorMatthew Dempsky <mdempsky@google.com>
Thu, 22 Oct 2015 00:19:49 +0000 (17:19 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 22 Oct 2015 01:14:23 +0000 (01:14 +0000)
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>
src/runtime/mfixalloc.go

index 57a136d06bfac08c22c75dd9ac726d0b09bfce61..54d4a74453a50b71952c64358371e0a67eaa70fe 100644 (file)
@@ -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