diff --git a/vm/bignum.cpp b/vm/bignum.cpp index 62d9952364..03b34edd97 100755 --- a/vm/bignum.cpp +++ b/vm/bignum.cpp @@ -371,7 +371,7 @@ bignum *bignum_remainder(bignum * numerator, bignum * denominator) } #define FOO_TO_BIGNUM(name,type,utype) \ - bignum * name##_to_bignum(type n) \ + bignum * factorvm::name##_to_bignum(type n) \ { \ int negative_p; \ bignum_digit_type result_digits [BIGNUM_DIGITS_FOR(type)]; \ diff --git a/vm/bignum.hpp b/vm/bignum.hpp index 296f0dce4c..5f502dcc22 100644 --- a/vm/bignum.hpp +++ b/vm/bignum.hpp @@ -55,10 +55,6 @@ bignum_divide(bignum * numerator, bignum * denominator, bignum * * quotient, bignum * * remainder); bignum * bignum_quotient(bignum *, bignum *); bignum * bignum_remainder(bignum *, bignum *); -bignum * fixnum_to_bignum(fixnum); -bignum * cell_to_bignum(cell); -bignum * long_long_to_bignum(s64 n); -bignum * ulong_long_to_bignum(u64 n); fixnum bignum_to_fixnum(bignum *); cell bignum_to_cell(bignum *); s64 bignum_to_long_long(bignum *); diff --git a/vm/local_roots.hpp b/vm/local_roots.hpp index 412ef35bb4..0d6a033f82 100644 --- a/vm/local_roots.hpp +++ b/vm/local_roots.hpp @@ -1,4 +1,3 @@ namespace factor { - } diff --git a/vm/math.cpp b/vm/math.cpp index f273cede0e..74caec3074 100755 --- a/vm/math.cpp +++ b/vm/math.cpp @@ -3,10 +3,6 @@ namespace factor { -cell bignum_zero; -cell bignum_pos_one; -cell bignum_neg_one; - inline void factorvm::vmprim_bignum_to_fixnum() { drepl(tag_fixnum(bignum_to_fixnum(untag(dpeek())))); diff --git a/vm/math.hpp b/vm/math.hpp index 0f8de05218..863fa1b4af 100644 --- a/vm/math.hpp +++ b/vm/math.hpp @@ -1,10 +1,6 @@ namespace factor { -extern cell bignum_zero; -extern cell bignum_pos_one; -extern cell bignum_neg_one; - static const fixnum fixnum_max = (((fixnum)1 << (WORD_SIZE - TAG_BITS - 1)) - 1); static const fixnum fixnum_min = (-((fixnum)1 << (WORD_SIZE - TAG_BITS - 1))); static const fixnum array_size_max = ((cell)1 << (WORD_SIZE - TAG_BITS - 2)); diff --git a/vm/vm.hpp b/vm/vm.hpp index 813bf5c528..fab910be48 100644 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -243,6 +243,9 @@ struct factorvm { inline void check_tagged_pointer(cell tagged); // local roots + /* If a runtime function needs to call another function which potentially + allocates memory, it must wrap any local variable references to Factor + objects in gc_root instances */ std::vector gc_locals; std::vector gc_bignums; @@ -329,10 +332,17 @@ struct factorvm { inline void vmprim_wrapper(); //math + cell bignum_zero; + cell bignum_pos_one; + cell bignum_neg_one; inline void vmprim_bignum_to_fixnum(); inline void vmprim_float_to_fixnum(); inline void vmprim_fixnum_divint(); inline void vmprim_fixnum_divmod(); + bignum *fixnum_to_bignum(fixnum); + bignum *cell_to_bignum(cell); + bignum *long_long_to_bignum(s64 n); + bignum *ulong_long_to_bignum(u64 n); inline fixnum sign_mask(fixnum x); inline fixnum branchless_max(fixnum x, fixnum y); inline fixnum branchless_abs(fixnum x);