Index: /branches/x8664-call/ccl/compiler/X86/X8664/x8664-vinsns.lisp
===================================================================
--- /branches/x8664-call/ccl/compiler/X86/X8664/x8664-vinsns.lisp	(revision 6292)
+++ /branches/x8664-call/ccl/compiler/X86/X8664/x8664-vinsns.lisp	(revision 6293)
@@ -274,4 +274,6 @@
   (movsd (:%xmm val) (:@ (:apply + x8664::misc-data-offset (:apply ash idx 3)) (:%q v))))
 
+
+
 (define-x8664-vinsn (call-known-symbol :call) (((result (:lisp x8664::arg_z)))
 					       ())
@@ -282,5 +284,6 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:% x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp)
 
 ;;; It's neccessary to use x8664:xfn to reference the current function
@@ -995,5 +998,7 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:% x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp
+)
 
 (define-x8664-vinsn fixnum-subtract-from (((dest t)
@@ -1148,5 +1153,6 @@
   (:long (:^ :back))
   :back
-  ;; We don't lose FN while consing the bignum.
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp
   ((:not (:pred = x8664::arg_z
                 (:apply %hard-regspec-value val)))
@@ -1169,5 +1175,6 @@
   (:long (:^ :back))
   :back
-  ;; We don't lose FN while consing the bignum.
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp
   ((:not (:pred = x8664::arg_z
                 (:apply %hard-regspec-value val)))
@@ -1295,5 +1302,7 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:% x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp
+  )
 
 (define-x8664-vinsn double-float-compare (()
@@ -1539,5 +1548,5 @@
   (pushq (:%q x8664::ra0)))
 
-
+;; ????
 (define-x8664-vinsn emit-aligned-label (()
                                         ((label :label)))
@@ -1590,5 +1599,7 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:% x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp
+)
 
 (define-x8664-vinsn (jump-known-function :jumplr) (()
@@ -1604,5 +1615,7 @@
   (:align 3)
   (:long (:^ :back))
-  :back)
+  :back
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp  )
 
 
@@ -1675,5 +1688,5 @@
 
 
-(defmacro define-x8664-subprim-call-vinsn ((name &rest other-attrs) spno &optional (recover-fn nil))
+(defmacro define-x8664-subprim-call-vinsn ((name &rest other-attrs) spno)
   `(define-x8664-vinsn (,name :call :subprim-call ,@other-attrs) (() ())
     (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
@@ -1682,6 +1695,6 @@
     (:long (:^ :back))
     :back
-    ,@(if recover-fn
-          `((leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn))))))
+    (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+    :disp))
 
 (defmacro define-x8664-subprim-jump-vinsn ((name &rest other-attrs) spno)
@@ -1773,5 +1786,6 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp )
 
 (define-x8664-vinsn (mkcatch1v :call :subprim-call) (()
@@ -1783,5 +1797,6 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp)
 
 (define-x8664-vinsn (mkunwind :call :subprim-call) (()
@@ -1815,5 +1830,6 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp)
 
 (define-x8664-vinsn tail-funcall (()
@@ -1854,6 +1870,8 @@
   (jmp (:@ .SPspecrefcheck))
   (:align 3)
-  (:long (:^ :back))
-  :back)
+  (:long (:^ :back))  
+  :back
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp )
 
 (define-x8664-vinsn ref-symbol-value-inline (((dest :lisp))
@@ -1884,5 +1902,7 @@
   (:align 3)
   (:long (:^ :back))
-  :back)
+  :back
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp  )
 
 (define-x8664-vinsn %ref-symbol-value-inline (((dest :lisp))
@@ -2952,6 +2972,4 @@
   (movq (:@ x8664::misc-data-offset (:%q vcell)) (:%q dest)))
 
-;;; The only current use of this - calling .SPgvset - doesn't need
-;;; to recover %fn from %ra0.
 (define-x8664-vinsn (call-subprim-3 :call :subprim-call) (((dest t))
 							  ((spno :s32const)
@@ -2963,5 +2981,7 @@
   (:align 3)
   (:long (:^ :back))
-  :back)
+  :back
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp)
 
 (define-x8664-vinsn setup-vcell-allocation (()
@@ -3185,5 +3205,6 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp)
 
 (define-x8664-vinsn set-z-flag-if-istruct-typep (()
@@ -3209,5 +3230,5 @@
 (define-x8664-subprim-call-vinsn (ksignalerr) .SPksignalerr)
 
-(define-x8664-subprim-call-vinsn (misc-alloc-init) .SPmisc-alloc-init t)
+(define-x8664-subprim-call-vinsn (misc-alloc-init) .SPmisc-alloc-init)
 
 (define-x8664-subprim-call-vinsn (misc-alloc) .SPmisc-alloc) 
@@ -3265,5 +3286,6 @@
   (:long (:^ :back))
   :back
-  (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp)
 
 (define-x8664-vinsn set-macptr-address (()
@@ -3331,5 +3353,7 @@
   (:align 3)
   (:long (:^ :back))
-  :back)
+  :back
+  (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+  :disp )
 
 
@@ -3424,5 +3448,5 @@
 (define-x8664-subprim-call-vinsn (req-heap-rest-arg) .SPreq-heap-rest-arg)
 
-(define-x8664-subprim-call-vinsn (stack-misc-alloc-init)  .SPstack-misc-alloc-init t)
+(define-x8664-subprim-call-vinsn (stack-misc-alloc-init)  .SPstack-misc-alloc-init)
 
 (define-x8664-vinsn fixnum->unsigned-natural (((dest :u64))
@@ -3500,4 +3524,9 @@
 
 (define-x8664-subprim-call-vinsn (setqsym) .SPsetqsym)
+
+(define-x8664-vinsn recover-fn-from-rip (()
+                                         ())
+  (leaq (:@ (:apply - (:^ :disp)) (:%q x8664::rip)) (:%q x8664::fn))
+  :disp)
 
 (define-x8664-vinsn recover-fn-from-ra0 (()
@@ -3546,6 +3575,8 @@
     (jmp (:@ .SPunbind)))
    (:align 3)
-   (:long (:^ :back))
-   :back))  
+   (:long (:^ :back))   
+   :back
+   (leaq (:@ (:apply - (:^ :disp)) (:% x8664::rip)) (:%q x8664::fn))
+   :disp))  
 
 (define-x8664-subprim-jump-vinsn (tail-call-sym-gen) .SPtcallsymgen)
