diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-29 07:17:41 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-29 07:17:41 -0700 |
commit | 43d7c3ec652ced39f960a91959bbf48efd84e190 (patch) | |
tree | a190d5c0745a1027607f5333bd02c4d854ec5211 /share | |
parent | a15ad0c137bcfb00a644cc08476c8c6797939105 (diff) | |
download | txr-43d7c3ec652ced39f960a91959bbf48efd84e190.tar.gz txr-43d7c3ec652ced39f960a91959bbf48efd84e190.tar.bz2 txr-43d7c3ec652ced39f960a91959bbf48efd84e190.zip |
compiler/assembler: bugfix: bignums can't be immediate ops.
* share/txr/stdlib/asm.tl (assembler immediate-fits-type):
Do not include bignum types as candidates for immediate
operand. We take the sys:bits representation of the object,
and that of course is a pointer. This case actually happens
on 32 bit platforms because the value that is one less than
the most negative fixnum still fits into the fixnum
representational range, due to the way two's complement works,
but is actually a bignum. Concretely, the value #x-20000000
is a bignum, but its width is 29, which falsely suggests that
its representation can fit into 32 bits as a literal.
* share/txr/stdlib/compiler.tl (compiler comp-atom): Test for
fixnum here rather than integerp, so in the above discussed
case, we don't generate a movi instruction.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/asm.tl | 2 | ||||
-rw-r--r-- | share/txr/stdlib/compiler.tl | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/share/txr/stdlib/asm.tl b/share/txr/stdlib/asm.tl index a03ead4e..74ba5866 100644 --- a/share/txr/stdlib/asm.tl +++ b/share/txr/stdlib/asm.tl @@ -135,7 +135,7 @@ (defmeth assembler immediate-fits-type (me arg operand-type) (and (member (typeof arg) - '(fixnum bignum chr)) + '(fixnum chr)) (<= (+ (width arg) [me.sign-bits (typeof arg)] 2) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 886cad47..4275daf0 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -339,7 +339,7 @@ (defmeth compiler comp-atom (me oreg form) (cond ((null form) (new (frag '(t 0) nil))) - ((or (and (integerp form) + ((or (and (fixnump form) (<= (width form) (- %imm-width% 3))) (chrp form)) (new (frag oreg ^((movi ,oreg ,form))))) |