svm: Make fixnum->integer instruction work with TC_FALSE fixnums.
authorMatt Birkholz <matt@birchwood-abbey.net>
Wed, 1 Feb 2017 07:17:13 +0000 (00:17 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Wed, 1 Feb 2017 07:51:57 +0000 (00:51 -0700)
Bytevectors store their length with TC_FALSE(?).  Use the
FIXNUM_TO_LONG from liarc.h which does not assume TC_FIXNUM.

src/microcode/svm1-interp.c

index 26a41d954219d46fdf3e9772696398dc820c99dc..7f4137ceb6bc34f142a92b9c2b10ad600d688da7 100644 (file)
@@ -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)