Damien | dcced92 | 2013-10-21 23:45:08 +0100 | [diff] [blame] | 1 | void gc_init(void *start, void *end); |
Damien George | 443e018 | 2014-04-08 11:31:21 +0000 | [diff] [blame] | 2 | |
| 3 | // These lock/unlock functions can be nested. |
| 4 | // They can be used to prevent the GC from allocating/freeing. |
| 5 | void gc_lock(void); |
| 6 | void gc_unlock(void); |
| 7 | |
| 8 | // A given port must implement gc_collect by using the other collect functions. |
| 9 | void gc_collect(void); |
Damien | 8b3a7c2 | 2013-10-23 20:20:17 +0100 | [diff] [blame] | 10 | void gc_collect_start(void); |
Damien | dcced92 | 2013-10-21 23:45:08 +0100 | [diff] [blame] | 11 | void gc_collect_root(void **ptrs, machine_uint_t len); |
Damien | 8b3a7c2 | 2013-10-23 20:20:17 +0100 | [diff] [blame] | 12 | void gc_collect_end(void); |
Damien George | 443e018 | 2014-04-08 11:31:21 +0000 | [diff] [blame] | 13 | |
Damien George | 12bab72 | 2014-04-05 20:35:48 +0100 | [diff] [blame] | 14 | void *gc_alloc(machine_uint_t n_bytes, bool has_finaliser); |
Damien | fd8b6bc | 2013-10-22 20:26:36 +0100 | [diff] [blame] | 15 | void gc_free(void *ptr); |
| 16 | machine_uint_t gc_nbytes(void *ptr); |
Damien | dcced92 | 2013-10-21 23:45:08 +0100 | [diff] [blame] | 17 | void *gc_realloc(void *ptr, machine_uint_t n_bytes); |
Damien | eefcc79 | 2013-10-22 15:25:25 +0100 | [diff] [blame] | 18 | |
| 19 | typedef struct _gc_info_t { |
| 20 | machine_uint_t total; |
| 21 | machine_uint_t used; |
| 22 | machine_uint_t free; |
| 23 | machine_uint_t num_1block; |
| 24 | machine_uint_t num_2block; |
| 25 | machine_uint_t max_block; |
| 26 | } gc_info_t; |
| 27 | |
| 28 | void gc_info(gc_info_t *info); |
Paul Sokolovsky | 550d804 | 2014-02-11 23:53:34 +0200 | [diff] [blame] | 29 | void gc_dump_info(void); |
Damien George | ce1162a | 2014-02-26 22:55:59 +0000 | [diff] [blame] | 30 | void gc_dump_alloc_table(void); |