Skip to content

Commit d4837ce

Browse files
committed
workaround lack of varargs macros in msvc
1 parent 29601c9 commit d4837ce

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/gc.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,13 @@ static void add_lostval_parent(jl_value_t* parent)
306306
} \
307307
} while(0);
308308

309+
#define verify_parent1(ty,obj,slot,arg1) verify_parent(ty,obj,slot,arg1)
310+
#define verify_parent2(ty,obj,slot,arg1,arg2) verify_parent(ty,obj,slot,arg1,arg2)
311+
309312
#else
310313
#define verify_val(v)
311-
#define verify_parent(ty,obj,slot,args...)
314+
#define verify_parent1(ty,obj,slot,arg1)
315+
#define verify_parent2(ty,obj,slot,arg1,arg2)
312316
#endif
313317

314318
#ifdef OBJPROFILE
@@ -1408,7 +1412,7 @@ static void gc_mark_stack(jl_value_t* ta, jl_gcframe_t *s, ptrint_t offset, int
14081412
else {
14091413
for(size_t i=0; i < nr; i++) {
14101414
if (rts[i] != NULL) {
1411-
verify_parent("task", ta, &rts[i], "stack(%d)", i);
1415+
verify_parent2("task", ta, &rts[i], "stack(%d)", i);
14121416
gc_push_root(rts[i], d);
14131417
}
14141418
}
@@ -1428,10 +1432,10 @@ NOINLINE static int gc_mark_module(jl_module_t *m, int d)
14281432
gc_setmark_buf(b, gc_bits(m));
14291433
#ifdef GC_VERIFY
14301434
void* vb = gc_val_buf(b);
1431-
verify_parent("module", m, &vb, "binding_buff");
1435+
verify_parent1("module", m, &vb, "binding_buff");
14321436
#endif
14331437
if (b->value != NULL) {
1434-
verify_parent("module", m, &b->value, "binding(%s)", b->name->name);
1438+
verify_parent2("module", m, &b->value, "binding(%s)", b->name->name);
14351439
refyoung |= gc_push_root(b->value, d);
14361440
}
14371441
if (b->type != (jl_value_t*)jl_any_type) {
@@ -1447,7 +1451,7 @@ NOINLINE static int gc_mark_module(jl_module_t *m, int d)
14471451
refyoung |= gc_push_root(m->usings.items[i], d);
14481452
}
14491453
if (m->constant_table) {
1450-
verify_parent("module", m, &m->constant_table, "constant_table");
1454+
verify_parent1("module", m, &m->constant_table, "constant_table");
14511455
refyoung |= gc_push_root(m->constant_table, d);
14521456
}
14531457
return refyoung;
@@ -1540,7 +1544,7 @@ static int push_root(jl_value_t *v, int d, int bits)
15401544
for(size_t i=0; i < l; i++) {
15411545
jl_value_t *elt = data[i];
15421546
if (elt != NULL) {
1543-
verify_parent("tuple", v, &data[i], "elem(%d)", i);
1547+
verify_parent2("tuple", v, &data[i], "elem(%d)", i);
15441548
refyoung |= gc_push_root(elt, d);
15451549
}
15461550
}
@@ -1581,7 +1585,7 @@ static int push_root(jl_value_t *v, int d, int bits)
15811585
else if (a->how == 1) {
15821586
#ifdef GC_VERIFY
15831587
void* val_buf = gc_val_buf((char*)a->data - a->offset*a->elsize);
1584-
verify_parent("array", v, &val_buf, "buffer ('loc' addr is meaningless)");
1588+
verify_parent1("array", v, &val_buf, "buffer ('loc' addr is meaningless)");
15851589
#endif
15861590
gc_setmark_buf((char*)a->data - a->offset*a->elsize, gc_bits(v));
15871591
}
@@ -1597,7 +1601,7 @@ static int push_root(jl_value_t *v, int d, int bits)
15971601
for(size_t i=0; i < l; i++) {
15981602
jl_value_t *elt = ((jl_value_t**)data)[i];
15991603
if (elt != NULL) {
1600-
verify_parent("array", v, &((jl_value_t**)data)[i], "elem(%d)", i);
1604+
verify_parent2("array", v, &((jl_value_t**)data)[i], "elem(%d)", i);
16011605
refyoung |= gc_push_root(elt, d);
16021606
}
16031607
// try to split large array marking (incremental mark TODO)
@@ -1641,7 +1645,7 @@ static int push_root(jl_value_t *v, int d, int bits)
16411645
jl_value_t **slot = (jl_value_t**)((char*)v + fields[i].offset + sizeof(void*));
16421646
jl_value_t *fld = *slot;
16431647
if (fld) {
1644-
verify_parent("object", v, slot, "field(%d)", i);
1648+
verify_parent2("object", v, slot, "field(%d)", i);
16451649
//children[ci++] = fld;
16461650
refyoung |= gc_push_root(fld, d);
16471651
}

0 commit comments

Comments
 (0)