1995-08-09 08:06:35 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/* Damien Doligez, projet Para, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1999-11-17 10:59:06 -08:00
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
2001-12-07 05:41:02 -08:00
|
|
|
/* under the terms of the GNU Library General Public License, with */
|
|
|
|
/* the special exception on linking described in file ../LICENSE. */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
#ifndef _major_gc_
|
|
|
|
#define _major_gc_
|
|
|
|
|
|
|
|
|
|
|
|
#include "freelist.h"
|
|
|
|
#include "misc.h"
|
|
|
|
|
|
|
|
typedef struct {
|
1997-05-13 07:45:38 -07:00
|
|
|
void *block; /* address of the malloced block this chunk live in */
|
|
|
|
asize_t alloc; /* in bytes, used for compaction */
|
|
|
|
asize_t size; /* in bytes */
|
1995-05-04 03:15:53 -07:00
|
|
|
char *next;
|
|
|
|
} heap_chunk_head;
|
|
|
|
|
1997-05-13 07:45:38 -07:00
|
|
|
#define Chunk_size(c) (((heap_chunk_head *) (c)) [-1]).size
|
|
|
|
#define Chunk_alloc(c) (((heap_chunk_head *) (c)) [-1]).alloc
|
|
|
|
#define Chunk_next(c) (((heap_chunk_head *) (c)) [-1]).next
|
|
|
|
#define Chunk_block(c) (((heap_chunk_head *) (c)) [-1]).block
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
extern int gc_phase;
|
|
|
|
extern unsigned long allocated_words;
|
1998-08-07 11:43:39 -07:00
|
|
|
extern double extra_heap_memory;
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
#define Phase_mark 0
|
2000-01-07 08:51:58 -08:00
|
|
|
#define Phase_mark_final 3
|
1995-05-04 03:15:53 -07:00
|
|
|
#define Phase_sweep 1
|
1997-05-13 07:45:38 -07:00
|
|
|
#define Phase_idle 2
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-24 05:46:59 -07:00
|
|
|
#ifdef __alpha
|
|
|
|
typedef int page_table_entry;
|
|
|
|
#else
|
|
|
|
typedef char page_table_entry;
|
|
|
|
#endif
|
|
|
|
|
2001-08-28 07:47:48 -07:00
|
|
|
CAMLextern char *heap_start;
|
|
|
|
CAMLextern char *heap_end;
|
1995-05-04 03:15:53 -07:00
|
|
|
extern unsigned long total_heap_size;
|
2001-08-28 07:47:48 -07:00
|
|
|
CAMLextern page_table_entry *page_table;
|
1998-08-07 11:43:39 -07:00
|
|
|
extern asize_t page_low, page_high;
|
1995-05-04 03:15:53 -07:00
|
|
|
extern char *gc_sweep_hp;
|
|
|
|
|
|
|
|
#define In_heap 1
|
|
|
|
#define Not_in_heap 0
|
1998-08-07 11:43:39 -07:00
|
|
|
#define Page(p) ((unsigned long) (p) >> Page_log)
|
1995-05-04 03:15:53 -07:00
|
|
|
#define Is_in_heap(p) \
|
|
|
|
((addr)(p) >= (addr)heap_start && (addr)(p) < (addr)heap_end \
|
1995-07-24 05:46:59 -07:00
|
|
|
&& page_table [Page (p)])
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1997-09-02 05:55:01 -07:00
|
|
|
void init_major_heap (asize_t);
|
|
|
|
asize_t round_heap_chunk_size (asize_t);
|
|
|
|
void darken (value, value *);
|
|
|
|
void major_collection_slice (void);
|
|
|
|
void major_collection (void);
|
|
|
|
void finish_major_cycle (void);
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* _major_gc_ */
|