summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/hashmap.h
blob: 2988417f68380054372f8d626ecbdda24e332e65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// 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.

struct Hmap;		/* opaque */

/* Used by the garbage collector */
struct hash_gciter
{
	Hmap *h;
	int32 phase;
	uintptr bucket;
	struct Bucket *b;
	uintptr i;
};

// 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.
struct hash_gciter_data
{
	uint8 *st;			/* internal structure, or nil */
	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);