Added more init code to vm constructor.

Also removed dummy variables file as have fixed that problem now
db4
Phil Dawes 2009-09-07 07:41:11 +01:00
parent c7b7517f36
commit 617a7cbd65
3 changed files with 5 additions and 216 deletions

View File

@ -247,102 +247,4 @@ VM_C_API THREADHANDLE start_standalone_factor_in_new_thread(int argc, vm_char **
return start_thread(start_standalone_factor_thread,args); return start_thread(start_standalone_factor_thread,args);
} }
// if you change this struct, also change vm.factor k--------
context *stack_chain;
zone nursery; /* new objects are allocated here */
cell cards_offset;
cell decks_offset;
cell userenv[USER_ENV]; /* TAGGED user environment data; see getenv/setenv prims */
// -------------------------------
// contexts
cell ds_size, rs_size;
context *unused_contexts;
// run
cell T; /* Canonical T object. It's just a word */
// profiler
bool profiling_p;
// errors
/* Global variables used to pass fault handler state from signal handler to
user-space */
cell signal_number;
cell signal_fault_addr;
unsigned int signal_fpu_status;
stack_frame *signal_callstack_top;
//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;
//write barrier
cell allot_markers_offset;
//data_gc
/* used during garbage collection only */
zone *newspace;
bool performing_gc;
bool performing_compaction;
cell collecting_gen;
/* if true, we are collecting aging space for the second time, so if it is still
full, we go on to collect tenured */
bool collecting_aging_again;
/* in case a generation fills up in the middle of a gc, we jump back
up to try collecting the next generation. */
jmp_buf gc_jmp;
gc_stats stats[max_gen_count];
u64 cards_scanned;
u64 decks_scanned;
u64 card_scan_time;
cell code_heap_scans;
/* What generation was being collected when copy_code_heap_roots() was last
called? Until the next call to add_code_block(), future
collections of younger generations don't have to touch the code
heap. */
cell last_code_heap_scan;
/* sometimes we grow the heap */
bool growing_data_heap;
data_heap *old_data_heap;
// local roots
/* If a runtime function needs to call another function which potentially
allocates memory, it must wrap any local variable references to Factor
objects in gc_root instances */
std::vector<cell> gc_locals;
std::vector<cell> gc_bignums;
//debug
bool fep_disabled;
bool full_output;
cell look_for;
cell obj;
//math
cell bignum_zero;
cell bignum_pos_one;
cell bignum_neg_one;
//code_heap
heap code;
unordered_map<heap_block *,char *> forwarding;
//image
cell code_relocation_base;
cell data_relocation_base;
//dispatch
cell megamorphic_cache_hits;
cell megamorphic_cache_misses;
//inline cache
cell max_pic_size;
cell cold_call_to_ic_transitions;
cell ic_to_pic_transitions;
cell pic_to_mega_transitions;
cell pic_counts[4]; /* PIC_TAG, PIC_HI_TAG, PIC_TUPLE, PIC_HI_TAG_TUPLE */
} }

View File

@ -1,116 +0,0 @@
namespace factor
{
// if you change this struct, also change vm.factor k--------
extern "C" context *stack_chain;
extern "C" zone nursery; /* new objects are allocated here */
extern "C" cell cards_offset;
extern "C" cell decks_offset;
//extern "C" cell userenv[USER_ENV]; /* TAGGED user environment data; see getenv/setenv prims */
// -------------------------------
// contexts
extern "C" cell ds_size, rs_size;
extern "C" context *unused_contexts;
// profiler
extern "C" bool profiling_p;
// errors
/* Global variables used to pass fault handler state from signal handler to
user-space */
extern "C" cell signal_number;
extern "C" cell signal_fault_addr;
extern "C" unsigned int signal_fpu_status;
extern "C" stack_frame *signal_callstack_top;
//data_heap
extern "C" bool secure_gc; /* Set by the -securegc command line argument */
extern "C" bool gc_off; /* GC is off during heap walking */
extern "C" data_heap *data;
/* A heap walk allows useful things to be done, like finding all
references to an object for debugging purposes. */
extern "C" cell heap_scan_ptr;
//write barrier
extern "C" cell allot_markers_offset;
//data_gc
/* used during garbage collection only */
extern "C" zone *newspace;
extern "C" bool performing_gc;
extern "C" bool performing_compaction;
extern "C" cell collecting_gen;
/* if true, we are collecting aging space for the second time, so if it is still
full, we go on to collect tenured */
extern "C" bool collecting_aging_again;
/* in case a generation fills up in the middle of a gc, we jump back
up to try collecting the next generation. */
extern "C" jmp_buf gc_jmp;
extern "C" gc_stats stats[max_gen_count];
extern "C" u64 cards_scanned;
extern "C" u64 decks_scanned;
extern "C" u64 card_scan_time;
extern "C" cell code_heap_scans;
/* What generation was being collected when copy_code_heap_roots() was last
called? Until the next call to add_code_block(), future
collections of younger generations don't have to touch the code
heap. */
extern "C" cell last_code_heap_scan;
/* sometimes we grow the heap */
extern "C" bool growing_data_heap;
extern "C" data_heap *old_data_heap;
// local roots
/* If a runtime function needs to call another function which potentially
allocates memory, it must wrap any local variable references to Factor
objects in gc_root instances */
//extern "C" segment *gc_locals_region;
//extern "C" cell gc_locals;
//extern "C" segment *gc_bignums_region;
//extern "C" cell gc_bignums;
//debug
extern "C" bool fep_disabled;
extern "C" bool full_output;
extern "C" cell look_for;
extern "C" cell obj;
//math
extern "C" cell bignum_zero;
extern "C" cell bignum_pos_one;
extern "C" cell bignum_neg_one;
//code_heap
extern "C" heap code;
extern "C" unordered_map<heap_block *,char *> forwarding;
//image
extern "C" cell code_relocation_base;
extern "C" cell data_relocation_base;
//dispatch
extern "C" cell megamorphic_cache_hits;
extern "C" cell megamorphic_cache_misses;
//inline cache
extern "C" cell max_pic_size;
extern "C" cell cold_call_to_ic_transitions;
extern "C" cell ic_to_pic_transitions;
extern "C" cell pic_to_mega_transitions;
extern "C" cell pic_counts[4]; /* PIC_TAG, PIC_HI_TAG, PIC_TUPLE, PIC_HI_TAG_TUPLE */
struct factorvmdata {
cell userenv[USER_ENV]; /* TAGGED user environment data; see getenv/setenv prims */
// run
cell T; /* Canonical T object. It's just a word */
// local roots
/* If a runtime function needs to call another function which potentially
allocates memory, it must wrap any local variable references to Factor
objects in gc_root instances */
std::vector<cell> gc_locals;
std::vector<cell> gc_bignums;
};
}

View File

@ -110,8 +110,11 @@ struct factorvmdata {
collecting_aging_again(false), collecting_aging_again(false),
growing_data_heap(false), growing_data_heap(false),
fep_disabled(false), fep_disabled(false),
full_output(false) full_output(false),
{} max_pic_size(0)
{
memset(this,0,sizeof(this)); // just to make sure
}
}; };