Refactoring

This commit is contained in:
Justin Ethier 2016-07-15 21:22:50 -04:00
parent 336eaa5059
commit 9e2a51fdae
2 changed files with 6 additions and 6 deletions

View file

@ -132,7 +132,7 @@ object apply_va(void *data, object cont, int argc, object func, ...);
object Cyc_string_cmp(void *data, object str1, object str2); object Cyc_string_cmp(void *data, object str1, object str2);
void dispatch_string_91append(void *data, int argc, object clo, object cont, void dispatch_string_91append(void *data, int argc, object clo, object cont,
object str1, ...); object str1, ...);
list mcons(object, object); list malloc_make_pair(object, object);
cvar_type *mcvar(object * var); cvar_type *mcvar(object * var);
object Cyc_display(object, FILE * port); object Cyc_display(object, FILE * port);
object dispatch_display_va(void *data, int argc, object clo, object cont, object dispatch_display_va(void *data, int argc, object clo, object cont,

View file

@ -325,7 +325,7 @@ void add_global(object * glo)
// It would probably be more efficient to allocate // It would probably be more efficient to allocate
// a contiguous block of memory for this... for now // a contiguous block of memory for this... for now
// this is more expedient // this is more expedient
global_table = mcons(mcvar(glo), global_table); global_table = malloc_make_pair(mcvar(glo), global_table);
} }
void debug_dump_globals() void debug_dump_globals()
@ -363,11 +363,11 @@ void add_mutation(void *data, object var, int index, object value)
gc_thread_data *thd = (gc_thread_data *) data; gc_thread_data *thd = (gc_thread_data *) data;
if (is_object_type(value)) { if (is_object_type(value)) {
if (index >= 0) { if (index >= 0) {
// For vectors only, mcons index as another var. That way // For vectors only, malloc_make_pair index as another var. That way
// the write barrier only needs to inspect the mutated index. // the write barrier only needs to inspect the mutated index.
thd->mutations = mcons(obj_int2obj(index), thd->mutations); thd->mutations = malloc_make_pair(obj_int2obj(index), thd->mutations);
} }
thd->mutations = mcons(var, thd->mutations); thd->mutations = malloc_make_pair(var, thd->mutations);
} }
} }
@ -2437,7 +2437,7 @@ object Cyc_io_peek_char(void *data, object cont, object port)
} }
// Functions internal to the runtime that use malloc // Functions internal to the runtime that use malloc
list mcons(object a, object d) list malloc_make_pair(object a, object d)
{ {
pair_type *c = malloc(sizeof(pair_type)); pair_type *c = malloc(sizeof(pair_type));
c->hdr.mark = gc_color_red; c->hdr.mark = gc_color_red;