mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Generalization of globals_changed thread param
This commit is contained in:
parent
ff5d313595
commit
27970524c5
5 changed files with 23 additions and 22 deletions
1
gc.c
1
gc.c
|
@ -1905,6 +1905,7 @@ void gc_thread_data_init(gc_thread_data * thd, int mut_num, char *stack_base,
|
|||
thd->mutation_count = 0;
|
||||
thd->mutations =
|
||||
vpbuffer_realloc(thd->mutations, &(thd->mutation_buflen));
|
||||
thd->globals_changed = 1;
|
||||
thd->param_objs = NULL;
|
||||
thd->exception_handler_stack = NULL;
|
||||
thd->scm_thread_obj = NULL;
|
||||
|
|
|
@ -701,6 +701,7 @@ object register_library(const char *name);
|
|||
/**@{*/
|
||||
extern list global_table;
|
||||
void add_global(object * glo);
|
||||
void Cyc_set_globals_changed(gc_thread_data *thd);
|
||||
/**@}*/
|
||||
|
||||
#endif /* CYCLONE_RUNTIME_H */
|
||||
|
|
|
@ -265,6 +265,8 @@ struct gc_thread_data_t {
|
|||
void **mutations;
|
||||
int mutation_buflen;
|
||||
int mutation_count;
|
||||
// Is minor collection of globals necessary?
|
||||
unsigned char globals_changed;
|
||||
// List of objects moved to heap during minor GC
|
||||
void **moveBuf;
|
||||
int moveBufLen;
|
||||
|
|
22
runtime.c
22
runtime.c
|
@ -20,22 +20,12 @@
|
|||
|
||||
//int JAE_DEBUG = 0;
|
||||
//int gcMoveCountsDEBUG[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
int globals_changed = 1; // TODO: not good enough, needs to live in thread data!
|
||||
|
||||
object Cyc_global_set(void *thd, object * glo, object value)
|
||||
{
|
||||
gc_mut_update((gc_thread_data *) thd, *glo, value);
|
||||
*(glo) = value;
|
||||
|
||||
globals_changed = 1;
|
||||
//gc_thread_data *d = (gc_thread_data *) thd;
|
||||
//if (is_object_type(value)) {
|
||||
// d->mutations = vpbuffer_add(d->mutations,
|
||||
// &(d->mutation_buflen),
|
||||
// d->mutation_count,
|
||||
// ((object) (((uintptr_t)(*glo)) + 2)));
|
||||
// d->mutation_count++;
|
||||
//}
|
||||
((gc_thread_data *) thd)->globals_changed = 1;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -438,7 +428,6 @@ void add_global(object * glo)
|
|||
// a contiguous block of memory for this... for now
|
||||
// this is more expedient
|
||||
global_table = malloc_make_pair(mcvar(glo), global_table);
|
||||
globals_changed = 1;
|
||||
}
|
||||
|
||||
void debug_dump_globals()
|
||||
|
@ -461,6 +450,11 @@ void debug_dump_globals()
|
|||
}
|
||||
}
|
||||
|
||||
void Cyc_set_globals_changed(gc_thread_data *thd)
|
||||
{
|
||||
thd->globals_changed = 1;
|
||||
}
|
||||
|
||||
/* END Global table */
|
||||
|
||||
/* Mutation table functions
|
||||
|
@ -4887,8 +4881,8 @@ int gc_minor(void *data, object low_limit, object high_limit, closure cont,
|
|||
}
|
||||
clear_mutations(data); // Reset for next time
|
||||
|
||||
if (globals_changed) {
|
||||
globals_changed = 0;
|
||||
if (((gc_thread_data *) data)->globals_changed) {
|
||||
((gc_thread_data *) data)->globals_changed = 0;
|
||||
// Transport globals
|
||||
gc_move2heap(Cyc_global_variables); // Internal global used by the runtime
|
||||
{
|
||||
|
|
|
@ -1474,6 +1474,9 @@
|
|||
; DEBUG (emit (string-append "printf(\"init " (lib:name->string lib-name) "\\n\");"))
|
||||
))
|
||||
|
||||
;; Set global-changed indicator
|
||||
(emit "Cyc_set_globals_changed((gc_thread_data *)data);")
|
||||
|
||||
;; Initialize symbols
|
||||
(for-each
|
||||
(lambda (sym)
|
||||
|
|
Loading…
Add table
Reference in a new issue