* Implementation of Guardian is complete.

* Implementation not fully tested.  May have corner cases.
This commit is contained in:
Abdulaziz Ghuloum 2006-12-19 20:14:31 +03:00
parent 8dac92a512
commit 5ccca042a6
4 changed files with 8 additions and 5 deletions

Binary file not shown.

View File

@ -488,15 +488,16 @@ guardians_loop(gc_t* gc){
ik_guardian_table* t = pcb->guardians[i]; ik_guardian_table* t = pcb->guardians[i];
while(t){ while(t){
int j; int j;
int c = t->count; int count = t->count;
for(j=0; j<c; j++){ for(j=0; j<count; j++){
ikp tc = t->p[j].tc;
ikp obj = t->p[j].obj; ikp obj = t->p[j].obj;
if(is_live(obj, gc)){ if(is_live(obj, gc)){
pending_hold[i] = pending_hold[i] =
move_guardian(t->p[j].tc, obj, pending_hold[i]); move_guardian(tc, obj, pending_hold[i]);
} else { } else {
pending_final = pending_final =
move_guardian(t->p[j].tc, obj, pending_final); move_guardian(tc, obj, pending_final);
} }
} }
ik_guardian_table* next = t->next; ik_guardian_table* next = t->next;
@ -868,10 +869,12 @@ add_object_proc(gc_t* gc, ikp x)
if(is_fixnum(x)){ if(is_fixnum(x)){
return x; return x;
} }
#ifndef NDEBUG
if(x == forward_ptr){ if(x == forward_ptr){
fprintf(stderr, "GOTCHA\n"); fprintf(stderr, "GOTCHA\n");
exit(-1); exit(-1);
} }
#endif
int tag = tagof(x); int tag = tagof(x);
if(tag == immediate_tag){ if(tag == immediate_tag){
return x; return x;

View File

@ -833,7 +833,7 @@ ikrt_register_guardian(ikp tc, ikp obj, ikpcb* pcb){
exit(-1); exit(-1);
} }
ik_guardian_table* p = ik_guardian_table* p =
(ik_guardian_table*)ik_alloc(pcb, sizeof(ik_guardian_table)); (ik_guardian_table*)ik_mmap(sizeof(ik_guardian_table));
p->next = g; p->next = g;
p->count = 0; p->count = 0;
pcb->guardians[0] = p; pcb->guardians[0] = p;

Binary file not shown.