-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathORDER
64 lines (60 loc) · 1.17 KB
/
ORDER
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# SWEEP
tgc_alloc()
structs
tgc_start()
tgc_add()
tgc_resize()
tgc_add_ptr()
tgc_sweep()
tgc_stop()
# MARK
mark field
tgc_mark_ptr()
bottom field
tgc_mark_stack()
handle stacks that grow in either direction
tgc_mark()
stop tgc_mark_stack() from being inlined
mark heap
mark registers
minptr/maxptr optimization
# MARK & SWEEP & UNMARK
only sweep unmarked
reset all marks to 0
tgc_run()
run gc on alloc
sweepfactor
pause/resume gc
# HASH TABLE
tgc_hash()
use tgc_hash() as starting index
readd all pointers in tgc_resize()
tgc_ideal_size() with loadfactor
rename tgc_resize() to tgc_rehash()
primes
call tgc_resize_less() on sweep
keep linear probing invariant during sweep (move out-of-place items back to free spaces)
stop search when hitting an empty slot
cache hashes
use (hash == 0) instead of (ptr == NULL)
tgc_probe()
robin hood hashing
# EXTRA FEATURES
change mark to flags
TGC_ROOT flag
mark roots
don't sweep roots
tgc_alloc_opt()
tgc_get_flags() and tgc_set_flags()
tgc_get_ptr()
tgc_get_size()
TGC_LEAF flag
don't recursively mark leaves
destructors
tgc_calloc()
tgc_realloc() common cases
tgc_rem()
tgc_rem_ptr()
tgc_realloc() NULL cases
tgc_free()
remove from freelist on tgc_free()