From 1ddadac28767d5ccf76260b4c0f1730e36b3e01a Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 6 May 2015 18:20:24 -0400 Subject: [PATCH] Refactored globals --- runtime.c | 22 ++++++++++++++++++++++ runtime.h | 42 ++++++++++++++++-------------------------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/runtime.c b/runtime.c index 01d29445..f7f8cba3 100644 --- a/runtime.c +++ b/runtime.c @@ -1,6 +1,28 @@ #include "cyclone.h" #include "runtime.h" +/* Global variables. */ +clock_t start; /* Starting time. */ +char *stack_begin; /* Initialized by main. */ +char *stack_limit1; /* Initialized by main. */ +char *stack_limit2; +char *bottom; /* Bottom of tospace. */ +char *allocp; /* Cheney allocate pointer. */ +char *alloc_end; +/* TODO: not sure this is the best strategy for strings, especially if there + are a lot of long, later gen strings because that will cause a lot of + copying to occur during GC */ +char *dhbottom; /* Bottom of data heap */ +char *dhallocp; /* Current place in data heap */ +char *dhalloc_end; +long no_gcs = 0; /* Count the number of GC's. */ +long no_major_gcs = 0; /* Count the number of GC's. */ +object gc_cont; /* GC continuation closure. */ +object gc_ans[NUM_GC_ANS]; /* argument for GC continuation closure. */ +int gc_num_ans; +jmp_buf jmp_main; /* Where to jump to. */ + +//static object test_exp1, test_exp2; /* Expressions used within test. */ object Cyc_global_variables = nil; static symbol_type __EOF = {eof_tag, "", nil}; // symbol_type in lieu of custom type diff --git a/runtime.h b/runtime.h index fd3636b3..25823a02 100644 --- a/runtime.h +++ b/runtime.h @@ -156,36 +156,26 @@ void do_dispatch(int argc, function_type func, object clo, object *buffer); } \ } - -// JAE TODO: not sure how to refactor global section yet /* Global variables. */ - -static clock_t start; /* Starting time. */ - -static char *stack_begin; /* Initialized by main. */ -static char *stack_limit1; /* Initialized by main. */ -static char *stack_limit2; - -static char *bottom; /* Bottom of tospace. */ -static char *allocp; /* Cheney allocate pointer. */ -static char *alloc_end; - +extern clock_t start; /* Starting time. */ +extern char *stack_begin; /* Initialized by main. */ +extern char *stack_limit1; /* Initialized by main. */ +extern char *stack_limit2; +extern char *bottom; /* Bottom of tospace. */ +extern char *allocp; /* Cheney allocate pointer. */ +extern char *alloc_end; /* TODO: not sure this is the best strategy for strings, especially if there are a lot of long, later gen strings because that will cause a lot of copying to occur during GC */ -static char *dhbottom; /* Bottom of data heap */ -static char *dhallocp; /* Current place in data heap */ -static char *dhalloc_end; - -static long no_gcs = 0; /* Count the number of GC's. */ -static long no_major_gcs = 0; /* Count the number of GC's. */ - -static object gc_cont; /* GC continuation closure. */ -static object gc_ans[NUM_GC_ANS]; /* argument for GC continuation closure. */ -static int gc_num_ans; -static jmp_buf jmp_main; /* Where to jump to. */ - -//static object test_exp1, test_exp2; /* Expressions used within test. */ +extern char *dhbottom; /* Bottom of data heap */ +extern char *dhallocp; /* Current place in data heap */ +extern char *dhalloc_end; +extern long no_gcs; /* Count the number of GC's. */ +extern long no_major_gcs; /* Count the number of GC's. */ +extern object gc_cont; /* GC continuation closure. */ +extern object gc_ans[NUM_GC_ANS]; /* argument for GC continuation closure. */ +extern int gc_num_ans; +extern jmp_buf jmp_main; /* Where to jump to. */ /* Define the Lisp atoms that we need. */ extern const object boolean_t;