From 221c0ac5c892612800d38e83e06cf81870c91d2e Mon Sep 17 00:00:00 2001 From: Phil Dawes Date: Mon, 17 Aug 2009 21:37:13 +0100 Subject: [PATCH] moved global state from data_heap into vm --- vm/data_heap.cpp | 12 ++---------- vm/data_heap.hpp | 6 ------ vm/vm.hpp | 6 ++++++ 3 files changed, 8 insertions(+), 16 deletions(-) mode change 100644 => 100755 vm/data_heap.hpp diff --git a/vm/data_heap.cpp b/vm/data_heap.cpp index 34284659f0..020954bf05 100755 --- a/vm/data_heap.cpp +++ b/vm/data_heap.cpp @@ -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() { diff --git a/vm/data_heap.hpp b/vm/data_heap.hpp old mode 100644 new mode 100755 index 4ef72a6fcb..2bec35b8c1 --- a/vm/data_heap.hpp +++ b/vm/data_heap.hpp @@ -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 diff --git a/vm/vm.hpp b/vm/vm.hpp index 59d9d277f8..1e30c13136 100644 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -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);