2008-11-13 11:35:44 -07:00
|
|
|
// Copyright 2009 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.
|
|
|
|
|
2011-01-31 04:27:28 -07:00
|
|
|
struct Hmap; /* opaque */
|
2013-02-08 14:00:33 -07:00
|
|
|
|
|
|
|
/* Used by the garbage collector */
|
|
|
|
struct hash_gciter
|
|
|
|
{
|
2013-03-20 14:51:29 -06:00
|
|
|
Hmap *h;
|
|
|
|
int32 phase;
|
|
|
|
uintptr bucket;
|
|
|
|
struct Bucket *b;
|
|
|
|
uintptr i;
|
2013-02-08 14:00:33 -07:00
|
|
|
};
|
2013-03-20 14:51:29 -06:00
|
|
|
|
|
|
|
// this data is used by the garbage collector to keep the map's
|
|
|
|
// internal structures from being reclaimed. The iterator must
|
|
|
|
// return in st every live object (ones returned by mallocgc) so
|
|
|
|
// that those objects won't be collected, and it must return
|
|
|
|
// every key & value in key_data/val_data so they can get scanned
|
|
|
|
// for pointers they point to. Note that if you malloc storage
|
|
|
|
// for keys and values, you need to do both.
|
2013-02-08 14:00:33 -07:00
|
|
|
struct hash_gciter_data
|
|
|
|
{
|
2013-03-20 14:51:29 -06:00
|
|
|
uint8 *st; /* internal structure, or nil */
|
2013-02-08 14:00:33 -07:00
|
|
|
uint8 *key_data; /* key data, or nil */
|
|
|
|
uint8 *val_data; /* value data, or nil */
|
|
|
|
bool indirectkey; /* storing pointers to keys */
|
|
|
|
bool indirectval; /* storing pointers to values */
|
|
|
|
};
|
|
|
|
bool hash_gciter_init (struct Hmap *h, struct hash_gciter *it);
|
|
|
|
bool hash_gciter_next (struct hash_gciter *it, struct hash_gciter_data *data);
|