]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/contrib/byterun/major_gc.h
update
[l4.git] / l4 / pkg / ocaml / contrib / byterun / major_gc.h
1 /***********************************************************************/
2 /*                                                                     */
3 /*                           Objective Caml                            */
4 /*                                                                     */
5 /*             Damien Doligez, projet Para, INRIA Rocquencourt         */
6 /*                                                                     */
7 /*  Copyright 1996 Institut National de Recherche en Informatique et   */
8 /*  en Automatique.  All rights reserved.  This file is distributed    */
9 /*  under the terms of the GNU Library General Public License, with    */
10 /*  the special exception on linking described in file ../LICENSE.     */
11 /*                                                                     */
12 /***********************************************************************/
13
14 /* $Id: major_gc.h 8766 2008-01-11 11:55:36Z doligez $ */
15
16 #ifndef CAML_MAJOR_GC_H
17 #define CAML_MAJOR_GC_H
18
19
20 #include "freelist.h"
21 #include "misc.h"
22
23 typedef struct {
24   void *block;           /* address of the malloced block this chunk live in */
25   asize_t alloc;         /* in bytes, used for compaction */
26   asize_t size;          /* in bytes */
27   char *next;
28 } heap_chunk_head;
29
30 #define Chunk_size(c) (((heap_chunk_head *) (c)) [-1]).size
31 #define Chunk_alloc(c) (((heap_chunk_head *) (c)) [-1]).alloc
32 #define Chunk_next(c) (((heap_chunk_head *) (c)) [-1]).next
33 #define Chunk_block(c) (((heap_chunk_head *) (c)) [-1]).block
34
35 extern int caml_gc_phase;
36 extern int caml_gc_subphase;
37 extern uintnat caml_allocated_words;
38 extern double caml_extra_heap_resources;
39 extern uintnat caml_dependent_size, caml_dependent_allocated;
40 extern uintnat caml_fl_size_at_phase_change;
41
42 #define Phase_mark 0
43 #define Phase_sweep 1
44 #define Phase_idle 2
45 #define Subphase_main 10
46 #define Subphase_weak1 11
47 #define Subphase_weak2 12
48 #define Subphase_final 13
49
50 CAMLextern char *caml_heap_start;
51 extern uintnat total_heap_size;
52 extern char *caml_gc_sweep_hp;
53
54 void caml_init_major_heap (asize_t);           /* size in bytes */
55 asize_t caml_round_heap_chunk_size (asize_t);  /* size in bytes */
56 void caml_darken (value, value *);
57 intnat caml_major_collection_slice (long);
58 void major_collection (void);
59 void caml_finish_major_cycle (void);
60
61
62 #endif /* CAML_MAJOR_GC_H */