bignums: don't use ecl_alloc_atomic for gmp

The gmp manual (https://gmplib.org/manual/Custom-Allocation.html) states

> GMP may use allocated blocks to hold pointers to other allocated
  blocks. This will limit the assumptions a conservative garbage
  collection scheme can make.

Thus we can't use ecl_alloc_atomic. We could just use ecl_alloc
instead, however our implementation is already structured in such a
way that it is sufficient to use ecl_alloc_uncollectable. The reason
for that is that currently all bignums except those in the bignum
registers in the thread local environment are allocated as compact
objects so that we only need to call mpz_clear for the few non-compact
objects in the bignum registers.

See also commits 7b536161 and bd48b859.
Fixes #485.
This commit is contained in:
Marius Gerbershagen 2020-01-04 15:50:34 +01:00
parent f5dfc145d0
commit c301b108a7
9 changed files with 73 additions and 27 deletions

View file

@ -148,6 +148,8 @@ typedef unsigned int cl_index;
typedef unsigned int cl_hashkey;
#endif
#define ECL_BIGNUM_REGISTER_NUMBER 3
/*
* The character type
*/