github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/src/pkg/runtime/hashmap.h (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 struct Hmap; /* opaque */ 6 7 /* Used by the garbage collector */ 8 struct hash_gciter 9 { 10 Hmap *h; 11 int32 phase; 12 uintptr bucket; 13 struct Bucket *b; 14 uintptr i; 15 }; 16 17 // this data is used by the garbage collector to keep the map's 18 // internal structures from being reclaimed. The iterator must 19 // return in st every live object (ones returned by mallocgc) so 20 // that those objects won't be collected, and it must return 21 // every key & value in key_data/val_data so they can get scanned 22 // for pointers they point to. Note that if you malloc storage 23 // for keys and values, you need to do both. 24 struct hash_gciter_data 25 { 26 uint8 *st; /* internal structure, or nil */ 27 uint8 *key_data; /* key data, or nil */ 28 uint8 *val_data; /* value data, or nil */ 29 bool indirectkey; /* storing pointers to keys */ 30 bool indirectval; /* storing pointers to values */ 31 }; 32 bool hash_gciter_init (struct Hmap *h, struct hash_gciter *it); 33 bool hash_gciter_next (struct hash_gciter *it, struct hash_gciter_data *data);