diff options
author | Andy Wingo <wingo@pobox.com> | 2016-09-06 21:03:36 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-09-06 21:03:36 +0200 |
commit | 5f4a2ac3e793dc45c797f64f3292f6d160068b7b (patch) | |
tree | 854730c6015925a46df5c68619d35aae9348a638 /module/system | |
parent | 32f309d5ce3263bde34d392e3df2d1062796d762 (diff) |
Fix cross-compilation of negative fixnums
* module/system/vm/assembler.scm (encoder): Use immediate-bits instead
of object-address, to fix cross-compilation.
Diffstat (limited to 'module/system')
-rw-r--r-- | module/system/vm/assembler.scm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm index c72622e70..a2992b495 100644 --- a/module/system/vm/assembler.scm +++ b/module/system/vm/assembler.scm @@ -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)) |