From: Matt Birkholz Date: Wed, 1 Feb 2017 07:17:13 +0000 (-0700) Subject: svm: Make fixnum->integer instruction work with TC_FALSE fixnums. X-Git-Tag: mit-scheme-pucked-9.2.12~235^2~2 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=34244312d58eeaebd7315a4a57a7b7f50b5225f7;p=mit-scheme.git svm: Make fixnum->integer instruction work with TC_FALSE fixnums. Bytevectors store their length with TC_FALSE(?). Use the FIXNUM_TO_LONG from liarc.h which does not assume TC_FIXNUM. --- diff --git a/src/microcode/svm1-interp.c b/src/microcode/svm1-interp.c index 26a41d954..7f4137ceb 100644 --- a/src/microcode/svm1-interp.c +++ b/src/microcode/svm1-interp.c @@ -535,6 +535,9 @@ DEFINE_INST (load_immediate_fr_flt) #define X_OBJECT_ADDRESS(o) ((word_t) (OBJECT_ADDRESS (o))) +#define X_FIXNUM_TO_LONG(o) \ + ((((long) (o)) << TYPE_CODE_LENGTH) >> TYPE_CODE_LENGTH) + DEFINE_INST (load_non_pointer_tc_s8) { DECODE_SVM1_INST_LOAD_NON_POINTER_TC_S8 (target, type, datum); @@ -1188,7 +1191,7 @@ DEFINE_UNARY_WR (not, NOT, ~) DEFINE_UNARY_WR (object_type, OBJECT_TYPE, OBJECT_TYPE) DEFINE_UNARY_WR (object_datum, OBJECT_DATUM, OBJECT_DATUM) DEFINE_UNARY_WR (object_address, OBJECT_ADDRESS, X_OBJECT_ADDRESS) -DEFINE_UNARY_WR (fixnum_to_integer, FIXNUM_TO_INTEGER, FIXNUM_TO_LONG) +DEFINE_UNARY_WR (fixnum_to_integer, FIXNUM_TO_INTEGER, X_FIXNUM_TO_LONG) DEFINE_UNARY_WR (integer_to_fixnum, INTEGER_TO_FIXNUM, LONG_TO_FIXNUM) DEFINE_UNARY_WR (flonum_length, FLONUM_LENGTH, FLOATING_VECTOR_LENGTH)