From 5b290895b1926a6c59a2f8c6d5a15991dfe26b0e Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 6 Dec 2016 01:38:49 +0300 Subject: [PATCH] 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. --- tests/test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.40.0