|
Macaulay2 Engine
|
Inline helpers that move GMP / MPFR / MPFI limbs from malloc-managed storage into the bdwgc heap. More...
#include "engine-includes.hpp"Go to the source code of this file.
Classes | |
| struct | CC_struct |
| Immutable view of a complex number as a pair of mpfr_srcptr real and imaginary parts. More... | |
| struct | CCmutable_struct |
| Mutable view of a complex number as a pair of mpfr_ptr real and imaginary parts. More... | |
| struct | CCi_struct |
| Immutable view of a complex interval as a pair of mpfi_srcptr real and imaginary parts. More... | |
| struct | CCimutable_struct |
| Mutable view of a complex interval as a pair of mpfi_ptr real and imaginary parts. More... | |
Functions | |
| void | mpz_reallocate_limbs (mpz_ptr _z) |
| gmp_QQ | moveTo_gmpQQ (mpq_ptr z) |
| void | mpfr_reallocate_limbs (mpfr_ptr _z) |
| void | mpfi_reallocate_limbs (mpfi_ptr _z) |
| mpfr_srcptr | moveTo_gmpRR (mpfr_ptr _z) |
| mpfi_srcptr | moveTo_gmpRRi (mpfi_ptr _z) |
| gmp_CC | moveTo_gmpCC (gmp_CCmutable _z) |
| gmp_CCi | moveTo_gmpCCi (gmp_CCimutable _z) |
Inline helpers that move GMP / MPFR / MPFI limbs from malloc-managed storage into the bdwgc heap.
Declares the small family of mpz_reallocate_limbs / mpfr_reallocate_limbs / mpfi_reallocate_limbs rewriters and the typed moveTo_gmpQQ / moveTo_gmpRR / moveTo_gmpRRi / moveTo_gmpCC / moveTo_gmpCCi wrappers (integer values go through mpz_reallocate_limbs directly) that the engine uses to launder every GMP-allocated number through getmem_atomic before handing it back to the interpreter. The pattern is the same in every case: allocate a fresh atomic GC buffer of the right limb size, memcpy the existing limbs into it, mpz_clear / mpfr_clear the original malloc-backed payload, and rewire the multiprecision struct to point at the new GC-managed storage.
Without this laundering the engine would interleave two memory regimes inside the same value and the bdwgc collector would be unable to see the limbs — so any rational, real, or complex number crossing the engine-to-interpreter boundary gets passed through a moveTo_* helper first. The CC_struct / CCi_struct typedefs at the bottom carry the complex (and complex-interval) layouts the helpers operate on.
Definition in file gmp-util.h.