func stkbucket(typ bucketType, size uintptr, stk []uintptr, alloc bool) *bucket {
	if buckhash == nil {
		buckhash = (*[buckHashSize]*bucket)(sysAlloc(unsafe.Sizeof(*buckhash), &memstats.buckhash_sys))
		if buckhash == nil {
			throw("runtime: cannot allocate memory")
		}
	}

	// Hash stack.
	var h uintptr
	for _, pc := range stk {
		h += pc
		h += h << 10
		h ^= h >> 6
	}
	// hash in size
	h += size
	h += h << 10
	h ^= h >> 6
	// finalize
	h += h << 3
	h ^= h >> 11

	i := int(h % buckHashSize)
	for b := buckhash[i]; b != nil; b = b.next {
		if b.typ == typ && b.hash == h && b.size == size && eqslice(b.stk(), stk) {
			return b
		}
	}

	if !alloc {
		return nil
	}

	// Create new bucket.
	b := newBucket(typ, len(stk))
	copy(b.stk(), stk)
	b.hash = h
	b.size = size
	b.next = buckhash[i]
	buckhash[i] = b
	if typ == memProfile {
		b.allnext = mbuckets
		mbuckets = b
	} else {
		b.allnext = bbuckets
		bbuckets = b
	}
	return b
}
// Return the bucket for stk[0:nstk], allocating new bucket if needed.
Return the bucket for stk[0:nstk], allocating new bucket if needed.
// Return the bucket for stk [ 0 : nstk ] allocating new bucket if needed .
func stkbucket(typ bucketType, size uintptr, stk []uintptr, alloc bool) *bucket {
	if buckhash == nil {
		buckhash = (*[buckHashSize]*bucket)(sysAlloc(unsafe.Sizeof(*buckhash), &memstats.buckhash_sys))
		if buckhash == nil {
			throw("runtime: cannot allocate memory")
		}
	}
	var h uintptr
	for _, pc := range stk {
		h += pc
		h += h << 10
		h ^= h >> 6
	}
	h += size
	h += h << 10
	h ^= h >> 6
	h += h << 3
	h ^= h >> 11
	i := int(h % buckHashSize)
	for b := buckhash[i]; b != nil; b = b.next {
		if b.typ == typ && b.hash == h && b.size == size && eqslice(b.stk(), stk) {
			return b
		}
	}
	if !alloc {
		return nil
	}
	b := newBucket(typ, len(stk))
	copy(b.stk(), stk)
	b.hash = h
	b.size = size
	b.next = buckhash[i]
	buckhash[i] = b
	if typ == memProfile {
		b.allnext = mbuckets
		mbuckets = b
	} else {
		b.allnext = bbuckets
		bbuckets = b
	}
	return b
}
func stkbucket ( typ bucketType , size uintptr , stk [ ] uintptr , alloc bool ) * bucket { if buckhash == nil { buckhash = ( * [ buckHashSize ] * bucket ) ( sysAlloc ( unsafe . Sizeof ( * buckhash ) , & memstats . buckhash_sys ) ) if buckhash == nil { throw ( " " ) } } var h uintptr for _ , pc := range stk { h += pc h += h << 10 h ^= h >> 6 } h += size h += h << 10 h ^= h >> 6 h += h << 3 h ^= h >> 11 i := int ( h % buckHashSize ) for b := buckhash [ i ] ; b != nil ; b = b . next { if b . typ == typ && b . hash == h && b . size == size && eqslice ( b . stk ( ) , stk ) { return b } } if ! alloc { return nil } b := newBucket ( typ , len ( stk ) ) copy ( b . stk ( ) , stk ) b . hash = h b . size = size b . next = buckhash [ i ] buckhash [ i ] = b if typ == memProfile { b . allnext = mbuckets mbuckets = b } else { b . allnext = bbuckets bbuckets = b } return b }
Return the bucket for stk[0:nstk], allocating new bucket if needed.
Return the bucket for stk [ 0 : nstk ] allocating new bucket if needed .
// Hash stack. // hash in size // finalize // Create new bucket.