From: Matt Birkholz Date: Sat, 26 Apr 2014 04:10:43 +0000 (-0700) Subject: Fix BIGNUM_REDUCE_LENGTH to hide the unused (non-marked) words. X-Git-Tag: release-9.2.0~18 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=750e3928ae1711e563658712e35a71f03fcb4429;p=mit-scheme.git Fix BIGNUM_REDUCE_LENGTH to hide the unused (non-marked) words. This quiets 7093 of the 7110 complaints from verify_heap during the tests. --- diff --git a/src/microcode/bignmint.h b/src/microcode/bignmint.h index 7700259c5..e644716b0 100644 --- a/src/microcode/bignmint.h +++ b/src/microcode/bignmint.h @@ -56,8 +56,18 @@ typedef long bignum_length_type; space when a bignum's length is reduced from its original value. */ #define BIGNUM_REDUCE_LENGTH(target, source, length) \ { \ - SET_VECTOR_LENGTH ((source), (BIGNUM_LENGTH_TO_GC_LENGTH (length))); \ - (target) = (source); \ + int new_gc_length = BIGNUM_LENGTH_TO_GC_LENGTH (length); \ + int old_gc_length = VECTOR_LENGTH (source); \ + int delta = old_gc_length - new_gc_length; \ + assert (delta >= 0); \ + assert ((target) == (source)); \ + if (delta == 1) \ + VECTOR_SET (source, new_gc_length, SHARP_F); \ + else if (delta > 1) \ + VECTOR_SET (source, new_gc_length, \ + (MAKE_OBJECT (TC_MANIFEST_NM_VECTOR, delta - 1))); \ + if (delta != 0) \ + SET_VECTOR_LENGTH (source, new_gc_length); \ } #define BIGNUM_LENGTH_TO_GC_LENGTH(length) \