moved global state from data_heap into vm

db4
Phil Dawes 2009-08-17 21:37:13 +01:00
parent 3025cef1c6
commit 221c0ac5c8
3 changed files with 8 additions and 16 deletions

View File

@ -5,16 +5,12 @@ factor::zone nursery;
namespace factor
{
/* Set by the -securegc command line argument */
bool secure_gc;
/* new objects are allocated here */
VM_C_API zone nursery;
/* GC is off during heap walking */
bool gc_off;
data_heap *data;
cell factorvm::init_zone(zone *z, cell size, cell start)
{
@ -377,10 +373,6 @@ PRIMITIVE(data_room)
PRIMITIVE_GETVM()->vmprim_data_room();
}
/* A heap walk allows useful things to be done, like finding all
references to an object for debugging purposes. */
cell heap_scan_ptr;
/* Disables GC and activates next-object ( -- obj ) primitive */
void factorvm::begin_scan()
{

6
vm/data_heap.hpp Normal file → Executable file
View File

@ -1,8 +1,6 @@
namespace factor
{
/* Set by the -securegc command line argument */
extern bool secure_gc;
/* generational copying GC divides memory into zones */
struct zone {
@ -47,7 +45,6 @@ struct data_heap {
bool have_aging_p() { return gen_count > 2; }
};
extern data_heap *data;
static const cell max_gen_count = 3;
@ -99,9 +96,6 @@ PRIMITIVE(begin_scan);
PRIMITIVE(next_object);
PRIMITIVE(end_scan);
/* GC is off during heap walking */
extern bool gc_off;
cell find_all_words();
/* Every object has a regular representation in the runtime, which makes GC

View File

@ -131,6 +131,12 @@ struct factorvm {
bignum *digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int), unsigned int radix, int negative_p);
//data_heap
bool secure_gc; /* Set by the -securegc command line argument */
bool gc_off; /* GC is off during heap walking */
data_heap *data;
/* A heap walk allows useful things to be done, like finding all
references to an object for debugging purposes. */
cell heap_scan_ptr;
cell init_zone(zone *z, cell size, cell start);
void init_card_decks();
data_heap *alloc_data_heap(cell gens, cell young_size,cell aging_size,cell tenured_size);