1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Fix cross-compilation of negative fixnums

* module/system/vm/assembler.scm (encoder): Use immediate-bits instead
  of object-address, to fix cross-compilation.
This commit is contained in:
Andy Wingo 2016-09-06 21:03:36 +02:00
parent 32f309d5ce
commit 5f4a2ac3e7

View file

@ -551,7 +551,7 @@ later by the linker."
(record-label-reference asm label)
(emit asm opcode))
((X8_S8_I16 a imm)
(emit asm (pack-u8-u8-u16 opcode a (object-address imm))))
(emit asm (pack-u8-u8-u16 opcode a (immediate-bits asm imm))))
((X8_S12_S12 a b)
(emit asm (pack-u8-u12-u12 opcode a b)))
((X8_S12_C12 a b)
@ -573,15 +573,14 @@ later by the linker."
((C32 a)
(emit asm a))
((I32 imm)
(let ((val (object-address imm)))
(unless (zero? (ash val -32))
(error "FIXME: enable truncation of negative fixnums when cross-compiling"))
(let ((val (immediate-bits asm imm)))
(emit asm val)))
((A32 imm)
(unless (= (asm-word-size asm) 8)
(error "make-long-immediate unavailable for this target"))
(emit asm (ash (object-address imm) -32))
(emit asm (logand (object-address imm) (1- (ash 1 32)))))
(let ((bits (immediate-bits asm imm)))
(emit asm (ash bits -32))
(emit asm (logand bits (1- (ash 1 32))))))
((AF32 f64)
(let ((u64 (u64vector-ref (f64vector f64) 0)))
(emit asm (ash u64 -32))