0.8.5.29:
[sbcl.git] / src / compiler / ppc / call.lisp
index 2087a31..fb9cd13 100644 (file)
 ;;; otherwise use any legal location.  Even in the non-standard case,
 ;;; this may be restricted by a desire to use a subroutine call
 ;;; instruction.
-;;;
 (!def-vm-support-routine make-return-pc-passing-location (standard)
   (if standard
       (make-wired-tn *backend-t-primitive-type* register-arg-scn lra-offset)
       (make-restricted-tn *backend-t-primitive-type* register-arg-scn)))
 
-;;; Make-Old-FP-Passing-Location  --  Interface
-;;;
-;;;    Similar to Make-Return-PC-Passing-Location, but makes a location to pass
-;;; Old-FP in.  This is (obviously) wired in the standard convention, but is
-;;; totally unrestricted in non-standard conventions, since we can always fetch
-;;; it off of the stack using the arg pointer.
-;;;
+;;; This is similar to MAKE-RETURN-PC-PASSING-LOCATION, but makes a
+;;; location to pass OLD-FP in. This is (obviously) wired in the
+;;; standard convention, but is totally unrestricted in non-standard
+;;; conventions, since we can always fetch it off of the stack using
+;;; the arg pointer.
 (!def-vm-support-routine make-old-fp-passing-location (standard)
   (if standard
       (make-wired-tn *fixnum-primitive-type* immediate-arg-scn ocfp-offset)
       (make-normal-tn *fixnum-primitive-type*)))
 
-;;; Make-Old-FP-Save-Location, Make-Return-PC-Save-Location  --  Interface
-;;;
-;;;    Make the TNs used to hold Old-FP and Return-PC within the current
-;;; function.  We treat these specially so that the debugger can find them at a
-;;; known location.
-;;;
+;;; Make the TNs used to hold OLD-FP and RETURN-PC within the current
+;;; function. We treat these specially so that the debugger can find
+;;; them at a known location.
 (!def-vm-support-routine make-old-fp-save-location (env)
   (specify-save-tn
    (physenv-debug-live-tn (make-normal-tn *fixnum-primitive-type*) env)
    (make-wired-tn *fixnum-primitive-type*
                  control-stack-arg-scn
                  ocfp-save-offset)))
-;;;
 (!def-vm-support-routine make-return-pc-save-location (env)
   (specify-save-tn
    (physenv-debug-live-tn (make-normal-tn *backend-t-primitive-type*) env)
 (!def-vm-support-routine make-number-stack-pointer-tn ()
   (make-normal-tn *fixnum-primitive-type*))
 
-;;; Make-Unknown-Values-Locations  --  Interface
-;;;
-;;;    Return a list of TNs that can be used to represent an unknown-values
+;;; Return a list of TNs that can be used to represent an unknown-values
 ;;; continuation within a function.
-;;;
 (!def-vm-support-routine make-unknown-values-locations ()
   (list (make-stack-pointer-tn)
        (make-normal-tn *fixnum-primitive-type*)))
 
-
-;;; Select-Component-Format  --  Interface
-;;;
-;;;    This function is called by the Entry-Analyze phase, allowing
-;;; VM-dependent initialization of the IR2-Component structure.  We push
+;;; This function is called by the ENTRY-ANALYZE phase, allowing
+;;; VM-dependent initialization of the IR2-COMPONENT structure.  We push
 ;;; placeholder entries in the Constants to leave room for additional
 ;;; noise in the code object header.
-;;;
 (!def-vm-support-routine select-component-format (component)
   (declare (type component component))
   (dotimes (i code-constants-offset)
 \f
 ;;;; Frame hackery:
 
-;;; Return the number of bytes needed for the current non-descriptor stack
-;;; frame.  Non-descriptor stack frames must be multiples of 16 bytes under
-;;; the PPC SVr4 ABI (though the EABI may be less restrictive.)  Two words
-;;; are reserved for the stack backlink and saved LR (see SB!VM::NUMBER-STACK-
-;;; DISPLACEMENT.)
-;;;
-;;; Duh.  PPC Linux (and VxWorks) adhere to the EABI.
-
 ;;; this is the first function in this file that differs materially from 
 ;;; ../alpha/call.lisp
 (defun bytes-needed-for-non-descriptor-stack-frame ()
-  (logandc2 (+ 7 number-stack-displacement
-              (* (sb-allocated-size 'non-descriptor-stack) sb!vm:n-word-bytes))
-           7))
+  (logandc2 (+ +stack-alignment-bytes+ number-stack-displacement
+              (* (sb-allocated-size 'non-descriptor-stack) n-word-bytes))
+           +stack-alignment-bytes+))
 
 
 ;;; Used for setting up the Old-FP in local call.
     (emit-label start-lab)
     ;; Allocate function header.
     (inst simple-fun-header-word)
-    (dotimes (i (1- sb!vm:simple-fun-code-offset))
+    (dotimes (i (1- simple-fun-code-offset))
       (inst word 0))
     (let* ((entry-point (gen-label)))
       (emit-label entry-point)
 
 
 ;;; Emit code needed at the return-point from an unknown-values call
-;;; for a fixed number of values.  Values is the head of the TN-Ref
+;;; for a fixed number of values.  Values is the head of the TN-REF
 ;;; list for the locations that the values are to be received into.
 ;;; Nvals is the number of values that are to be received (should
 ;;; equal the length of Values).
 ;;;
-;;; Move-Temp is a Descriptor-Reg TN used as a temporary.
+;;; MOVE-TEMP is a DESCRIPTOR-REG TN used as a temporary.
 ;;;
 ;;; This code exploits the fact that in the unknown-values convention,
 ;;; a single value return returns at the return PC + 8, whereas a
@@ -350,8 +328,6 @@ default-value-8
 \f
 ;;;; Unknown values receiving:
 
-;;; Receive-Unknown-Values  --  Internal
-;;;
 ;;;    Emit code needed at the return point for an unknown-values call for an
 ;;; arbitrary number of values.
 ;;;
@@ -603,35 +579,32 @@ default-value-8
 ;;; arguments, we don't bother allocating a partial frame, and instead set FP
 ;;; to SP just before the call.
 
-;;; Define-Full-Call  --  Internal
-;;;
 ;;;    This macro helps in the definition of full call VOPs by avoiding code
 ;;; replication in defining the cross-product VOPs.
 ;;;
-;;; Name is the name of the VOP to define.
+;;; NAME is the name of the VOP to define.
 ;;; 
-;;; Named is true if the first argument is a symbol whose global function
+;;; NAMED is true if the first argument is a symbol whose global function
 ;;; definition is to be called.
 ;;;
-;;; Return is either :Fixed, :Unknown or :Tail:
-;;; -- If :Fixed, then the call is for a fixed number of values, returned in
+;;; RETURN is either :FIXED, :UNKNOWN or :TAIL:
+;;; -- If :FIXED, then the call is for a fixed number of values, returned in
 ;;;    the standard passing locations (passed as result operands).
-;;; -- If :Unknown, then the result values are pushed on the stack, and the
+;;; -- If :UNKNOWN, then the result values are pushed on the stack, and the
 ;;;    result values are specified by the Start and Count as in the
 ;;;    unknown-values continuation representation.
-;;; -- If :Tail, then do a tail-recursive call.  No values are returned.
+;;; -- If :TAIL, then do a tail-recursive call.  No values are returned.
 ;;;    The Old-Fp and Return-PC are passed as the second and third arguments.
 ;;;
 ;;; In non-tail calls, the pointer to the stack arguments is passed as the last
-;;; fixed argument.  If Variable is false, then the passing locations are
-;;; passed as a more arg.  Variable is true if there are a variable number of
-;;; arguments passed on the stack.  Variable cannot be specified with :Tail
+;;; fixed argument.  If VARIABLE is false, then the passing locations are
+;;; passed as a more arg.  VARIABLE is true if there are a variable number of
+;;; arguments passed on the stack.  VARIABLE cannot be specified with :TAIL
 ;;; return.  TR variable argument call is implemented separately.
 ;;;
 ;;; In tail call with fixed arguments, the passing locations are passed as a
 ;;; more arg, but there is no new-FP, since the arguments have been set up in
 ;;; the current frame.
-;;;
 (defmacro define-full-call (name named return variable)
   (assert (not (and variable (eq return :tail))))
   `(define-vop (,name
@@ -803,10 +776,10 @@ default-value-8
                      (do-next-filler))
                     (constant
                      (loadw lexenv code-tn (tn-offset arg-fun)
-                            sb!vm:other-pointer-lowtag)
+                            other-pointer-lowtag)
                      (do-next-filler)))
-                  (loadw function lexenv sb!vm:closure-fun-slot
-                   sb!vm:fun-pointer-lowtag)
+                  (loadw function lexenv closure-fun-slot
+                   fun-pointer-lowtag)
                   (do-next-filler)
                   (inst addi entry-point function
                    (- (ash simple-fun-code-offset word-shift)
@@ -1094,10 +1067,10 @@ default-value-8
 
       (emit-label loop)
       ;; *--dst = *--src, --count
-      (inst addi src src (- sb!vm:n-word-bytes))
+      (inst addi src src (- n-word-bytes))
       (inst addic. count count (- (fixnumize 1)))
       (loadw temp src)
-      (inst addi dst dst (- sb!vm:n-word-bytes))
+      (inst addi dst dst (- n-word-bytes))
       (storew temp dst)
       (inst bgt loop)