Forked from
cmucl / cmucl
4788 commits behind the upstream repository.
gencgc.c 196.53 KiB
/*
* Generational Conservative Garbage Collector for CMUCL x86.
*
* This code was written by Douglas T. Crosher, based on Public Domain
* codes from Carnegie Mellon University. This code has been placed in
* the public domain, and is provided 'as is'.
*
* Douglas Crosher, 1996, 1997, 1998, 1999.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.c,v 1.55 2004/05/19 22:20:49 cwang Exp $
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "lisp.h"
#include "arch.h"
#include "internals.h"
#include "os.h"
#include "globals.h"
#include "interrupt.h"
#include "validate.h"
#include "lispregs.h"
#include "interr.h"
#include "gencgc.h"
#define gc_abort() lose("GC invariant lost! File \"%s\", line %d\n", \
__FILE__, __LINE__)
#if (defined(i386) || defined(__x86_64))
#define set_alloc_pointer(value) \
SetSymbolValue (ALLOCATION_POINTER, (value))
#define get_alloc_pointer() \
SymbolValue (ALLOCATION_POINTER)
#define get_binding_stack_pointer() \
SymbolValue (BINDING_STACK_POINTER)
#define get_pseudo_atomic_atomic() \
SymbolValue (PSEUDO_ATOMIC_ATOMIC)
#define set_pseudo_atomic_atomic() \
SetSymbolValue (PSEUDO_ATOMIC_ATOMIC, make_fixnum (1))
#define clr_pseudo_atomic_atomic() \
SetSymbolValue (PSEUDO_ATOMIC_ATOMIC, make_fixnum (0))
#define get_pseudo_atomic_interrupted() \
SymbolValue (PSEUDO_ATOMIC_INTERRUPTED)
#define clr_pseudo_atomic_interrupted() \
SetSymbolValue (PSEUDO_ATOMIC_INTERRUPTED, make_fixnum (0))
#define set_current_region_free(value) \
SetSymbolValue(CURRENT_REGION_FREE_POINTER, (value))
#define set_current_region_end(value) \
SetSymbolValue(CURRENT_REGION_END_ADDR, (value))
#define get_current_region_free() \
SymbolValue(CURRENT_REGION_FREE_POINTER)
#define set_current_region_end(value) \
SetSymbolValue(CURRENT_REGION_END_ADDR, (value))
#elif defined(sparc)
/*
* current_dynamic_space_free_pointer contains the pseudo-atomic
* stuff, so we need to preserve those bits when we give it a value.
* This value better not have any bits set there either!
*/
/*
* On sparc, we don't need to set the alloc_pointer in the code here
* because the alloc pointer (current_dynamic_space_free_pointer) is