diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-28 23:37:45 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-28 23:37:45 -0800 |
commit | 752f8309a72bacef5ce03ac8e98211b1df2ff0a8 (patch) | |
tree | 273a223a69d6dfd8f735f18ae07da52141630c39 /lib.h | |
parent | 94750af472e12acf3a5970c98e4dab6feada2e84 (diff) | |
download | txr-752f8309a72bacef5ce03ac8e98211b1df2ff0a8.tar.gz txr-752f8309a72bacef5ce03ac8e98211b1df2ff0a8.tar.bz2 txr-752f8309a72bacef5ce03ac8e98211b1df2ff0a8.zip |
Turn *gensym-counter* into proper special variable.
* eval.c (eval_init): Save *gensym-counter* symbol in gensym_counter_s
symbol variable right after interning, and use zero as the inital value
rather than the gensym_counter variable which is removed now.
* lib.c (gensym_counter_s): New symbol variable.
(gensym_counter): Variable removed.
(gensym): Slight refactoring to avoid a double variable lookup.
Also, for generational GC correctness, use the set macro to update it,
since the variable could live inside heap object and the counter
could overflow to bignums which are heap objects.
(obj_init): Remove initialization of gensym_counter.
* lib.h (gensym_counter_s): Declared.
(gensym_counter): Declaration removed, replaced by macro.
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -340,6 +340,9 @@ extern val eof_s, eol_s; extern val error_s, type_error_s, internal_error_s; extern val numeric_error_s, range_error_s; extern val query_error_s, file_error_s, process_error_s; +extern val gensym_counter_s; + +#define gensym_counter (*lookup_var_l(nil, gensym_counter_s)) extern val nothrow_k, args_k, colon_k, auto_k; @@ -348,7 +351,6 @@ extern val null_list; /* (nil) */ extern val identity_f, equal_f, eql_f, eq_f, car_f, cdr_f, null_f; -extern val gensym_counter; extern const wchar_t *progname; extern val prog_string; |