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

Compiler uses target fixnum range

* module/system/base/target.scm (target-most-negative-fixnum):
  (target-most-positive-fixnum): New definitions.
* module/language/cps/types.scm (constant-type, define-exact-integer!)
  (&min/fixnum, &max/fixnum): Use new definitions.
  (&max/vector): Use target-max-vector-length.
This commit is contained in:
Andy Wingo 2017-11-09 14:27:49 +01:00
parent 8b5f9648ff
commit a268c02fa0
2 changed files with 41 additions and 24 deletions

View file

@ -30,7 +30,10 @@
target-max-size-t
target-max-size-t/scm
target-max-vector-length))
target-max-vector-length
target-most-negative-fixnum
target-most-positive-fixnum))
@ -166,3 +169,13 @@ SCM words."
;; Vector size fits in first word; the low 8 bits are taken by the
;; type tag. Additionally, restrict to 48-bit address space.
(1- (ash 1 (min (- (* (target-word-size) 8) 8) 48))))
(define (target-most-negative-fixnum)
"Return the most negative integer representable as a fixnum on the
target platform."
(- (ash 1 (- (* (target-word-size) 8) 3))))
(define (target-most-positive-fixnum)
"Return the most positive integer representable as a fixnum on the
target platform."
(1- (ash 1 (- (* (target-word-size) 8) 3))))