diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2023-01-28 00:12:07 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2023-01-28 00:13:24 +0300 |
commit | fcbfe2a78b12148466fb2e256c3fdd4f8ea31bd4 (patch) | |
tree | f3af8ee1f1ed151d55d1c57814b422712427efb0 /tests | |
parent | d389c2d7f08ab48e7b6ec1a22c2afe9d201f5b12 (diff) | |
download | bdwgc-fcbfe2a78b12148466fb2e256c3fdd4f8ea31bd4.tar.gz |
Add minimal testing of GC_gcj_malloc_ignore_off_page
* tests/gctest.c [GC_GCJ_SUPPORT] (gcj_cons): Define cnt, d, lb local
variables; change type of r local variable from GC_word* to void*; if
(cnt&2)!=0 then call GC_gcj_malloc_ignore_off_page() instead of
GC_GCJ_MALLOC(); pass size larger than lb for several invocation of
GC_gcj_malloc_ignore_off_page().
* tests/gctest.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS
&& GC_GCJ_SUPPORT && CPPCHECK] (main): Remove
UNTESTED(GC_gcj_malloc_ignore_off_page).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gctest.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/gctest.c b/tests/gctest.c index 16959648..5f61e64b 100644 --- a/tests/gctest.c +++ b/tests/gctest.c @@ -422,14 +422,15 @@ sexpr small_cons_uncollectable (sexpr x, sexpr y) sexpr gcj_cons(sexpr x, sexpr y) { sexpr result; - GC_word * r = (GC_word *)GC_GCJ_MALLOC( - sizeof(struct SEXPR) + sizeof(struct fake_vtable*), - (AO_fetch_and_add1(&extra_count) & 1) != 0 - ? &gcj_class_struct1 - : &gcj_class_struct2); + GC_word cnt = (GC_word)AO_fetch_and_add1(&extra_count); + void *d = (cnt & 1) != 0 ? &gcj_class_struct1 : &gcj_class_struct2; + size_t lb = sizeof(struct SEXPR) + sizeof(struct fake_vtable*); + void *r = (cnt & 2) != 0 ? GC_gcj_malloc_ignore_off_page(lb + + (cnt <= HBLKSIZE / 2 ? cnt : 0), d) + : GC_GCJ_MALLOC(lb, d); CHECK_OUT_OF_MEMORY(r); - result = (sexpr)(r + 1); + result = (sexpr)((GC_word *)r + 1); result -> sexpr_car = x; GC_PTR_STORE_AND_DIRTY(&result->sexpr_cdr, y); GC_reachable_here(x); @@ -2186,9 +2187,6 @@ void enable_incremental_mode(void) UNTESTED(GC_exclude_static_roots); UNTESTED(GC_register_describe_type_fn); UNTESTED(GC_register_has_static_roots_callback); -# ifdef GC_GCJ_SUPPORT - UNTESTED(GC_gcj_malloc_ignore_off_page); -# endif # ifndef NO_DEBUGGING UNTESTED(GC_count_set_marks_in_hblk); UNTESTED(GC_dump); |