Correct call-indirect for >32-bit addresses.
authorStas Boukarev <stassats@gmail.com>
Sun, 2 Jun 2013 18:22:44 +0000 (22:22 +0400)
committerStas Boukarev <stassats@gmail.com>
Sun, 2 Jun 2013 18:22:44 +0000 (22:22 +0400)
src/compiler/x86-64/macros.lisp

index 8088d43..2883d28 100644 (file)
   `(inst pop (make-ea-for-object-slot ,ptr ,slot ,lowtag)))
 
 (defun call-indirect (offset)
-  (let ((ea (make-ea :qword :disp offset)))
-   (cond ((immediate32-p offset)
-          (inst call ea))
-         (t
-          (inst mov temp-reg-tn ea)
-          (inst call temp-reg-tn)))))
+  (typecase offset
+    ((signed-byte 32)
+     (inst call (make-ea :qword :disp offset)))
+    (t
+     (inst mov temp-reg-tn offset)
+     (inst call (make-ea :qword :base temp-reg-tn)))))
 \f
 ;;;; macros to generate useful values