diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libgo/go/runtime/malloc_defs.go | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libgo/go/runtime/malloc_defs.go')
-rw-r--r-- | libgo/go/runtime/malloc_defs.go | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/libgo/go/runtime/malloc_defs.go b/libgo/go/runtime/malloc_defs.go new file mode 100644 index 000000000..11d6627e1 --- /dev/null +++ b/libgo/go/runtime/malloc_defs.go @@ -0,0 +1,130 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Go definitions of internal structures. Master is malloc.h + +package runtime + +import "unsafe" + +const ( + pageShift = 12 + pageSize = 1 << pageShift + pageMask = pageSize - 1 +) + +type pageID uintptr + +const ( + numSizeClasses = 67 + maxSmallSize = 32 << 10 + fixAllocChunk = 128 << 10 + maxMCacheListLen = 256 + maxMCacheSize = 2 << 20 + maxMHeapList = 1 << 8 // 1 << (20 - pageShift) + heapAllocChunk = 1 << 20 +) + +type mLink struct { + next *mLink +} + +type fixAlloc struct { + size uintptr + alloc func(uintptr) + first func(unsafe.Pointer, *byte) + arg unsafe.Pointer + list *mLink + chunk *byte + nchunk uint32 + inuse uintptr + sys uintptr +} + + +// MStats? used to be in extern.go + +type mCacheList struct { + list *mLink + nlist uint32 + nlistmin uint32 +} + +type mCache struct { + list [numSizeClasses]mCacheList + size uint64 + local_alloc int64 + local_objects int64 + next_sample int32 +} + +type mSpan struct { + next *mSpan + prev *mSpan + allnext *mSpan + start pageID + npages uintptr + freelist *mLink + ref uint32 + sizeclass uint32 + state uint32 + // union { + gcref *uint32 // sizeclass > 0 + // gcref0 uint32; // sizeclass == 0 + // } +} + +type mCentral struct { + // lock + sizeclass int32 + nonempty mSpan + empty mSpan + nfree int32 +} + +type mHeap struct { + // lock + free [maxMHeapList]mSpan + large mSpan + allspans *mSpan + // map_ mHeapMap + min *byte + max *byte + closure_min *byte + closure_max *byte + + central [numSizeClasses]struct { + pad [64]byte + // union: mCentral + } + + spanalloc fixAlloc + cachealloc fixAlloc +} + +const ( + refFree = iota + refStack + refNone + refSome + refcountOverhead = 4 + refNoPointers = 0x80000000 + refHasFinalizer = 0x40000000 + refProfiled = 0x20000000 + refNoProfiling = 0x10000000 + refFlags = 0xFFFF0000 +) + +const ( + mProf_None = iota + mProf_Sample + mProf_All +) + +type finalizer struct { + next *finalizer + fn func(unsafe.Pointer) + arg unsafe.Pointer + nret int32 +} |