1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 22:10:21 +02:00

Fix mismatch between CPS and Scheme "complex?" predicate

* module/system/base/types/internal.scm (heap-tags): Rename complex and
  fraction predicates to "compnum?" and "fracnum?", as they aren't the
  same as the Scheme predicates "complex?" and "fraction?".
This commit is contained in:
Andy Wingo 2017-12-26 21:38:46 +01:00
parent a5dfbf5d0a
commit f75d0adc3f
4 changed files with 11 additions and 15 deletions

View file

@ -315,7 +315,10 @@ the LABELS that are clobbered by the effects of LABEL."
((procedure? arg))
((thunk? arg))
((heap-number? arg))
((bignum? arg)))
((bignum? arg))
((flonum? arg))
((compnum? arg))
((fracnum? arg)))
;; Fluids.
(define-primitive-effects

View file

@ -675,6 +675,9 @@ minimum, and maximum."
(define-simple-predicate-inferrer number? &number)
(define-simple-predicate-inferrer char? &char)
(define-simple-predicate-inferrer procedure? &procedure)
(define-simple-predicate-inferrer flonum? &flonum)
(define-simple-predicate-inferrer compnum? &complex)
(define-simple-predicate-inferrer fracnum? &fraction)
(define-predicate-inferrer (eq? a b true?)
;; We can only propagate information down the true leg.
@ -1458,16 +1461,6 @@ minimum, and maximum."
(define! result &special-immediate &true &true))
(else
(define! result &special-immediate &false &true))))
;; Bah, needs rewrite to turn into actual control flow.
(define-syntax-rule (define-simple-type-predicate-inferrer name type)
(define-type-inferrer (name val result)
(define-type-predicate-result val result type)))
(define-simple-type-predicate-inferrer complex? &number)
(define-simple-type-predicate-inferrer real? &real)
(define-simple-type-predicate-inferrer rational? &exact-number)
;; FIXME: If it's a flonum it may be an integer, but if it's not an
;; integer it also may be still be a flonum.
;; (define-simple-type-predicate-inferrer integer? (logior &exact-integer &flonum))
(define-simple-type-checker (exact? &number))
(define-type-inferrer (exact? val result)

View file

@ -151,8 +151,8 @@
;(heap-number heap-number? #b1111111 #b0010111)
(bignum bignum? #b111111111111 #b000100010111)
(flonum flonum? #b111111111111 #b001000010111)
(complex complex? #b111111111111 #b001100010111)
(fraction fraction? #b111111111111 #b010000010111))
(complex compnum? #b111111111111 #b001100010111)
(fraction fracnum? #b111111111111 #b010000010111))
(define-syntax define-tag
(lambda (x)

View file

@ -135,8 +135,8 @@
emit-smob?
emit-bignum?
emit-flonum?
emit-complex?
emit-fraction?
emit-compnum?
emit-fracnum?
emit-allocate-words
emit-allocate-words/immediate