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 */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* Automatique. Distributed only by permission. */
|
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $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;
|
|
|
|
extern unsigned long extra_heap_memory;
|
|
|
|
|
|
|
|
#define Phase_mark 0
|
|
|
|
#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
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
extern char *heap_start;
|
|
|
|
extern char *heap_end;
|
|
|
|
extern unsigned long total_heap_size;
|
1995-07-24 05:46:59 -07:00
|
|
|
extern page_table_entry *page_table;
|
1995-05-04 03:15:53 -07:00
|
|
|
extern asize_t page_table_size;
|
|
|
|
extern char *gc_sweep_hp;
|
|
|
|
|
|
|
|
#define In_heap 1
|
|
|
|
#define Not_in_heap 0
|
|
|
|
#define Page(p) (((addr) (p) - (addr) heap_start) >> Page_log)
|
|
|
|
#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
|
|
|
|
|
|
|
void init_major_heap P((asize_t));
|
|
|
|
asize_t round_heap_chunk_size P((asize_t));
|
1997-05-13 07:45:38 -07:00
|
|
|
void darken P((value, value *));
|
1995-05-04 03:15:53 -07:00
|
|
|
void major_collection_slice P((void));
|
|
|
|
void major_collection P((void));
|
|
|
|
void finish_major_cycle P((void));
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _major_gc_ */
|