forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
major_gc.h
68 lines (57 loc) · 2.64 KB
/
major_gc.h
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
65
66
67
68
/**************************************************************************/
/* */
/* OCaml */
/* */
/* Damien Doligez, projet Para, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. */
/* */
/* All rights reserved. This file is distributed under the terms of */
/* the GNU Lesser General Public License version 2.1, with the */
/* special exception on linking described in the file LICENSE. */
/* */
/**************************************************************************/
#ifndef CAML_MAJOR_GC_H
#define CAML_MAJOR_GC_H
#ifdef CAML_INTERNALS
typedef enum {
Phase_sweep_and_mark_main,
Phase_mark_final,
Phase_sweep_ephe
} gc_phase_t;
extern gc_phase_t caml_gc_phase;
intnat caml_opportunistic_major_work_available (void);
void caml_opportunistic_major_collection_slice (intnat);
/* auto-triggered slice from within the GC */
#define AUTO_TRIGGERED_MAJOR_SLICE -1
/* external triggered slice, but GC will compute the amount of work */
#define GC_CALCULATE_MAJOR_SLICE 0
void caml_major_collection_slice (intnat);
void caml_finish_sweeping(void);
void caml_finish_marking (void);
int caml_init_major_gc(caml_domain_state*);
void caml_teardown_major_gc(void);
void caml_darken(void*, value, volatile value* ignored);
void caml_darken_cont(value);
void caml_mark_root(value, value*);
void caml_empty_mark_stack(void);
void caml_finish_major_cycle(int force_compaction);
#ifdef DEBUG
int caml_mark_stack_is_empty(void);
#endif
void caml_orphan_ephemerons(caml_domain_state*);
void caml_orphan_finalisers(caml_domain_state*);
/* Forces finalisation of all heap-allocated values,
disregarding both local and global roots.
Warning: finalisation is performed by means of forced sweeping, which may
result in pointers referencing nonexistent values; therefore the function
should only be used on runtime shutdown.
*/
void caml_finalise_heap (void);
/* This variable is only written with the world stopped,
so it need not be atomic */
extern uintnat caml_major_cycles_completed;
double caml_mean_space_overhead(void);
#endif /* CAML_INTERNALS */
#endif /* CAML_MAJOR_GC_H */