From: Ivan Maidanski Date: Mon, 5 Dec 2016 22:38:49 +0000 (+0300) Subject: Test GCJ object creation with length-based descriptor (gctest) X-Git-Tag: v8.0.0~1009 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b290895b1926a6c59a2f8c6d5a15991dfe26b0e;p=gc Test GCJ object creation with length-based descriptor (gctest) * tests/test.c [GC_GCJ_SUPPORT] (gcj_cons): Define new static variable obj_cnt; increment obj_cnt on each call; if obj_cnt is odd then pass gcj_class_struct1 to GC_GCJ_MALLOC instead of gcj_class_struct2. --- diff --git a/tests/test.c b/tests/test.c index 8e4c4b5f..6d3dbfe0 100644 --- a/tests/test.c +++ b/tests/test.c @@ -340,10 +340,12 @@ sexpr gcj_cons(sexpr x, sexpr y) { GC_word * r; sexpr result; + static int obj_cnt = 0; r = (GC_word *) GC_GCJ_MALLOC(sizeof(struct SEXPR) + sizeof(struct fake_vtable*), - &gcj_class_struct2); + (++obj_cnt & 1) != 0 ? &gcj_class_struct1 + : &gcj_class_struct2); CHECK_OUT_OF_MEMORY(r); result = (sexpr)(r + 1); result -> sexpr_car = x;