mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-07 13:16:34 +02:00
Fixed wait for handshake
This commit is contained in:
parent
b609e1556f
commit
56c9d48c89
1 changed files with 11 additions and 6 deletions
13
gc.c
13
gc.c
|
@ -532,16 +532,16 @@ void gc_mut_update(gc_thread_data *thd, object old_obj, object value)
|
||||||
int status = ATOMIC_GET(&gc_status_col),
|
int status = ATOMIC_GET(&gc_status_col),
|
||||||
stage = ATOMIC_GET(&gc_stage);
|
stage = ATOMIC_GET(&gc_stage);
|
||||||
if (thd->gc_status != STATUS_ASYNC) {
|
if (thd->gc_status != STATUS_ASYNC) {
|
||||||
printf("DEBUG - GC sync marking heap obj ");
|
printf("DEBUG - GC sync marking heap obj %p ", old_obj);
|
||||||
Cyc_display(old_obj, stdout);
|
Cyc_display(old_obj, stdout);
|
||||||
printf(" and new value ");
|
printf(" and new value %p ", value);
|
||||||
Cyc_display(value, stdout);
|
Cyc_display(value, stdout);
|
||||||
//printf(" for heap object ");
|
//printf(" for heap object ");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
gc_mark_gray(thd, old_obj);
|
gc_mark_gray(thd, old_obj);
|
||||||
gc_mark_gray(thd, value);
|
gc_mark_gray(thd, value);
|
||||||
} else if (stage == STAGE_TRACING) {
|
} else if (stage == STAGE_TRACING) {
|
||||||
printf("DEBUG - GC async tracing marking heap obj ");
|
printf("DEBUG - GC async tracing marking heap obj %p ", old_obj);
|
||||||
Cyc_display(old_obj, stdout);
|
Cyc_display(old_obj, stdout);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
gc_mark_gray(thd, old_obj);
|
gc_mark_gray(thd, old_obj);
|
||||||
|
@ -777,9 +777,14 @@ void gc_wait_handshake()
|
||||||
// TODO: same as in other places, need to either sync access to
|
// TODO: same as in other places, need to either sync access to
|
||||||
// mutator vars, or ensure only the collector uses them
|
// mutator vars, or ensure only the collector uses them
|
||||||
for (i = 0; i < Cyc_num_mutators; i++) {
|
for (i = 0; i < Cyc_num_mutators; i++) {
|
||||||
|
while (1) {
|
||||||
statusc = ATOMIC_GET(&gc_status_col);
|
statusc = ATOMIC_GET(&gc_status_col);
|
||||||
statusm = ATOMIC_GET(&(Cyc_mutators[i]->gc_status));
|
statusm = ATOMIC_GET(&(Cyc_mutators[i]->gc_status));
|
||||||
if (statusc != statusm) {
|
if (statusc == statusm) {
|
||||||
|
// Handshake succeeded, check next mutator
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// At least for now, just give up quantum and come back to
|
// At least for now, just give up quantum and come back to
|
||||||
// this quickly to test again. This probably could be more
|
// this quickly to test again. This probably could be more
|
||||||
// efficient.
|
// efficient.
|
||||||
|
|
Loading…
Add table
Reference in a new issue