Mercurial > hg > xemacs-beta
diff src/data.c @ 5769:ffc0c5a66ab1
Be lazy converting markers to integers, bytecode_{arithcompare,arithop}().
src/ChangeLog addition:
2013-12-15 Aidan Kehoe <kehoea@parhasard.net>
* bytecode.c (bytecode_arithcompare):
* bytecode.c (bytecode_arithop):
Call promote_args_lazy () in these two functions, only converting
markers to fixnums if absolutely necessary (since that is ON with
large, mule buffers).
* data.c (BIGNUM_CASE):
* data.c (RATIO_CASE):
* data.c (BIGFLOAT_CASE):
* data.c (ARITHCOMPARE_MANY):
Call promote_args_lazy () here too if WITH_NUMBER_TYPES is defined.
We're not doing the equivalent with the non-NUMBER_TYPES code, but
that's mostly fine, we are doing it in the bytecode.
* number.h:
* number.h (NUMBER_TYPES):
* number.h (promote_args_lazy):
Add this, returning LAZY_MARKER_T if both arguments are markers
that point to the same buffer.
tests/ChangeLog addition:
2013-12-15 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
Test arithmetic comparisons with markers, check the type of the
returned values for #'min and #'max.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 15 Dec 2013 10:26:31 +0000 |
parents | 3bfcdeb65578 |
children | 750fab17b299 574f0cded429 |
line wrap: on
line diff
--- a/src/data.c Sun Dec 15 09:57:28 2013 +0000 +++ b/src/data.c Sun Dec 15 10:26:31 2013 +0000 @@ -899,7 +899,7 @@ #ifdef HAVE_BIGNUM #define BIGNUM_CASE(op) \ - case BIGNUM_T: \ + case LAZY_BIGNUM_T: \ if (!bignum_##op (XBIGNUM_DATA (obj1), XBIGNUM_DATA (obj2))) \ return Qnil; \ break; @@ -909,7 +909,7 @@ #ifdef HAVE_RATIO #define RATIO_CASE(op) \ - case RATIO_T: \ + case LAZY_RATIO_T: \ if (!ratio_##op (XRATIO_DATA (obj1), XRATIO_DATA (obj2))) \ return Qnil; \ break; @@ -919,7 +919,7 @@ #ifdef HAVE_BIGFLOAT #define BIGFLOAT_CASE(op) \ - case BIGFLOAT_T: \ + case LAZY_BIGFLOAT_T: \ if (!bigfloat_##op (XBIGFLOAT_DATA (obj1), XBIGFLOAT_DATA (obj2))) \ return Qnil; \ break; @@ -936,24 +936,33 @@ { \ obj1 = args[i - 1]; \ obj2 = args[i]; \ - switch (promote_args (&obj1, &obj2)) \ + switch (promote_args_lazy (&obj1, &obj2)) \ { \ - case FIXNUM_T: \ - if (!(XREALFIXNUM (obj1) c_op XREALFIXNUM (obj2))) \ + case LAZY_FIXNUM_T: \ + if (!(XREALFIXNUM (obj1) c_op XREALFIXNUM (obj2))) \ return Qnil; \ break; \ BIGNUM_CASE (op) \ RATIO_CASE (op) \ - case FLOAT_T: \ + case LAZY_FLOAT_T: \ if (!(XFLOAT_DATA (obj1) c_op XFLOAT_DATA (obj2))) \ return Qnil; \ break; \ BIGFLOAT_CASE (op) \ + case LAZY_MARKER_T: \ + if (!(byte_marker_position (obj1) c_op \ + byte_marker_position (obj2))) \ + return Qnil; \ + break; \ } \ } \ return Qt; \ } #else /* !WITH_NUMBER_TYPES */ +/* We don't convert markers lazily here, although we could. It's more + important that we do this lazily in bytecode, which is the case; see + bytecode_arithcompare(). + */ #define ARITHCOMPARE_MANY(c_op,op) \ { \ int_or_double iod1, iod2, *p = &iod1, *q = &iod2; \