Revert "Clean up %more-arg-values."
authorStas Boukarev <stassats@gmail.com>
Sat, 24 Aug 2013 21:37:17 +0000 (01:37 +0400)
committerStas Boukarev <stassats@gmail.com>
Sat, 24 Aug 2013 21:37:17 +0000 (01:37 +0400)
This reverts commit 1e5296127f5b384a2171646747021ebeee73b801.
It breaks slime, a better solution to come in the next release cycle.

17 files changed:
contrib/sb-sprof/sb-sprof.lisp
src/code/debug-int.lisp
src/code/debug.lisp
src/code/profile.lisp
src/compiler/alpha/values.lisp
src/compiler/fndb.lisp
src/compiler/hppa/values.lisp
src/compiler/ir1tran-lambda.lisp
src/compiler/ir2tran.lisp
src/compiler/mips/values.lisp
src/compiler/ppc/values.lisp
src/compiler/sparc/values.lisp
src/compiler/srctran.lisp
src/compiler/x86-64/values.lisp
src/compiler/x86/values.lisp
src/pcl/boot.lisp
src/pcl/dlisp.lisp

index 765ded9..0ce3209 100644 (file)
@@ -1409,7 +1409,9 @@ functions during statistical profiling."
                   (incf (the (unsigned-byte 59)
                           (car info)))
                   (multiple-value-call original-fun
-                    (sb-c:%more-arg-values more-context more-count)))))))))
+                    (sb-c:%more-arg-values more-context
+                                           0
+                                           more-count)))))))))
 
 \f
 ;;; silly examples
index 38dcf42..e8a188d 100644 (file)
@@ -2656,6 +2656,7 @@ register."
              (let ((count-var (fourth bind)))
                (specs `(,name (multiple-value-list
                                (sb!c:%more-arg-values (debug-var-value ',var ,n-frame)
+                                                      0
                                                       (debug-var-value ',count-var ,n-frame)))))))
             (:unknown
              (specs `(,name (debug-signal 'invalid-value
index f7138e3..588419a 100644 (file)
@@ -508,7 +508,7 @@ thread, NIL otherwise."
                            (setf reversed-result
                                  (append (reverse
                                           (multiple-value-list
-                                           (sb!c::%more-arg-values context count)))
+                                           (sb!c::%more-arg-values context 0 count)))
                                          reversed-result))
                            (return-from enumerating))
                          (push (make-unprintable-object "unavailable &MORE argument")
@@ -559,7 +559,7 @@ thread, NIL otherwise."
                  (butlast args 2)
                  (if (fixnump count)
                      (multiple-value-list
-                      (sb!c:%more-arg-values context count))
+                      (sb!c:%more-arg-values context 0 count))
                      (list
                       (make-unprintable-object "more unavailable arguments")))))
               args)
@@ -1595,7 +1595,7 @@ and LDB (the low-level debugger).  See also ENABLE-DEBUGGER."
           (when (and more-context more-count)
             (format *debug-io* "~S  =  ~S~%"
                     'more
-                    (multiple-value-list (sb!c:%more-arg-values more-context more-count))))
+                    (multiple-value-list (sb!c:%more-arg-values more-context 0 more-count))))
           (cond
            ((not any-p)
             (format *debug-io*
index ec881ba..da4f0b6 100644 (file)
              (dconsing 0)
              (inner-enclosed-profiles 0)
              (dgc-run-time 0))
-         (declare (truly-dynamic-extent dticks dconsing
-                                        inner-enclosed-profiles))
+         (declare (truly-dynamic-extent dticks dconsing inner-enclosed-profiles))
          (unwind-protect
              (let* ((start-ticks (get-internal-ticks))
                     (start-gc-run-time *gc-run-time*)
                     (nbf0 *n-bytes-freed-or-purified*)
                     (dynamic-usage-0 (sb-kernel:dynamic-usage))
                     (*enclosed-gc-run-time* (make-counter)))
-               (declare (dynamic-extent *enclosed-ticks* *enclosed-consing*
-                                        *enclosed-profiles*
-                                        *enclosed-gc-run-time*))
+               (declare (dynamic-extent *enclosed-ticks* *enclosed-consing* *enclosed-profiles* *enclosed-gc-run-time*))
                (unwind-protect
                    (multiple-value-call encapsulated-fun
                                         (sb-c:%more-arg-values arg-context
+                                                               0
                                                                arg-count))
                  (let ((*computing-profiling-data-for* encapsulated-fun)
                        (dynamic-usage-1 (sb-kernel:dynamic-usage)))
index 766f1f0..c0fc37f 100644 (file)
 ;;; them as function arguments.
 (define-vop (%more-arg-values)
   (:args (context :scs (descriptor-reg any-reg) :target src)
+         (skip :scs (any-reg zero immediate))
          (num :scs (any-reg) :target count))
-  (:arg-types * positive-fixnum)
+  (:arg-types * positive-fixnum positive-fixnum)
   (:temporary (:sc any-reg :from (:argument 0)) src)
   (:temporary (:sc any-reg :from (:argument 2)) dst)
   (:temporary (:sc descriptor-reg :from (:argument 1)) temp)
   (:results (start :scs (any-reg))
             (count :scs (any-reg)))
   (:generator 20
-    (move context src)
+    (sc-case skip
+      (zero
+       (move context src))
+      (immediate
+       (inst lda src (* (tn-value skip) n-word-bytes) context))
+      (any-reg
+       (inst addq context skip src)))
     (move num count)
     (inst move csp-tn start)
     (inst beq num done)
index 2945554..4089b77 100644 (file)
 ;;; FIXME: The second argument here should really be NEGATIVE-INDEX, but doing that
 ;;; breaks the build, and I cannot seem to figure out why. --NS 2006-06-29
 (defknown %more-kw-arg (t fixnum) (values t t))
-(defknown %more-arg-values (t index) * (flushable))
+(defknown %more-arg-values (t index index) * (flushable))
 (defknown %verify-arg-count (index index) (values))
 (defknown %arg-count-error (t) nil)
 (defknown %unknown-values () *)
index 96af71f..44df9fe 100644 (file)
 ;;;
 (define-vop (%more-arg-values)
   (:args (context :scs (descriptor-reg any-reg) :target src)
+         (skip :scs (any-reg zero immediate))
          (num :scs (any-reg) :target count))
-  (:arg-types * positive-fixnum)
+  (:arg-types * positive-fixnum positive-fixnum)
   (:temporary (:sc any-reg :from (:argument 0)) src)
   (:temporary (:sc any-reg :from (:argument 2)) dst end)
   (:temporary (:sc descriptor-reg :from (:argument 1)) temp)
   (:results (start :scs (any-reg))
             (count :scs (any-reg)))
   (:generator 20
-    (move context src)
+    (sc-case skip
+      (zero
+       (move context src))
+      (immediate
+       (inst addi (* (tn-value skip) n-word-bytes) context src))
+      (any-reg
+       (inst add skip context src)))
     (move num count)
     (inst comb := num zero-tn done)
     (move csp-tn start t)
index 399b948..ce06727 100644 (file)
       (unless (lambda-var-ignorep rest)
         ;; Make up two extra variables, and squirrel them away in
         ;; ARG-INFO-DEFAULT for transforming (VALUES-LIST REST) into
-        ;; (%MORE-ARG-VALUES CONTEXT COUNT) when possible.
+        ;; (%MORE-ARG-VALUES CONTEXT 0 COUNT) when possible.
         (let* ((context-name (sb!xc:gensym "REST-CONTEXT-"))
                (context (make-lambda-var :%source-name context-name
                                          :arg-info (make-arg-info :kind :more-context)))
index 568c898..026dd5f 100644 (file)
                        (eq (ir2-lvar-kind 2lvar) :fixed)))
              (ir2-convert-full-call node block)))))
 
-(defoptimizer (%more-arg-values ir2-convert) ((context count) node block)
+(defoptimizer (%more-arg-values ir2-convert) ((context start count) node block)
   (binding* ((lvar (node-lvar node) :exit-if-null)
              (2lvar (lvar-info lvar)))
     (ecase (ir2-lvar-kind 2lvar)
        (let ((locs (ir2-lvar-locs 2lvar)))
          (vop* %more-arg-values node block
                ((lvar-tn node block context)
+                (lvar-tn node block start)
                 (lvar-tn node block count)
                 nil)
                ((reference-tn-list locs t))))))))
index da85978..a04921b 100644 (file)
 ;;; as function arguments.
 (define-vop (%more-arg-values)
   (:args (context :scs (descriptor-reg any-reg) :target src)
+         (skip :scs (any-reg zero immediate))
          (num :scs (any-reg) :target count))
-  (:arg-types * positive-fixnum)
+  (:arg-types * positive-fixnum positive-fixnum)
   (:temporary (:sc any-reg :from (:argument 0)) src)
   (:temporary (:sc any-reg :from (:argument 2)) dst)
   (:temporary (:sc descriptor-reg :from (:argument 1)) temp)
   (:results (start :scs (any-reg))
             (count :scs (any-reg)))
   (:generator 20
-    (move src context)
+    (sc-case skip
+      (zero
+       (move src context))
+      (immediate
+       (inst addu src context (* (tn-value skip) n-word-bytes)))
+      (any-reg
+       (inst addu src context skip)))
     (move count num)
     (inst beq num done)
     (move start csp-tn t)
index ddead7c..7f868c1 100644 (file)
 ;;;
 (define-vop (%more-arg-values)
   (:args (context :scs (descriptor-reg any-reg) :target src)
+         (skip :scs (any-reg zero immediate))
          (num :scs (any-reg) :target count))
-  (:arg-types * positive-fixnum)
+  (:arg-types * positive-fixnum positive-fixnum)
   (:temporary (:sc any-reg :from (:argument 0)) src)
   (:temporary (:sc any-reg :from (:argument 2)) dst)
   (:temporary (:sc descriptor-reg :from (:argument 1)) temp)
   (:results (start :scs (any-reg))
             (count :scs (any-reg)))
   (:generator 20
-    (inst mr src context)
+    (sc-case skip
+      (zero
+       (inst mr src context))
+      (immediate
+       (inst addi src context (* (tn-value skip) n-word-bytes)))
+      (any-reg
+       (inst add src context skip)))
     (inst mr. count num)
     (inst mr start csp-tn)
     (inst beq done)
index 468176e..a7ac2b1 100644 (file)
 ;;; as function arguments.
 (define-vop (%more-arg-values)
   (:args (context :scs (descriptor-reg any-reg) :target src)
+         (skip :scs (any-reg zero immediate))
          (num :scs (any-reg) :target count))
-  (:arg-types * positive-fixnum)
+  (:arg-types * positive-fixnum positive-fixnum)
   (:temporary (:sc any-reg :from (:argument 0)) src)
   (:temporary (:sc any-reg :from (:argument 2)) dst)
   (:temporary (:sc descriptor-reg :from (:argument 1)) temp)
   (:results (start :scs (any-reg))
             (count :scs (any-reg)))
   (:generator 20
-    (move src context)
+    (sc-case skip
+      (zero
+       (move src context))
+      (immediate
+       (inst add src context (* (tn-value skip) n-word-bytes)))
+      (any-reg
+       (inst add src context skip)))
     (inst orcc count zero-tn num)
     (inst b :eq done)
     (inst move start csp-tn)
index c7207d6..69275ff 100644 (file)
 
 (deftransform %rest-values ((list context count))
   (if (rest-var-more-context-ok list)
-      `(%more-arg-values context count)
+      `(%more-arg-values context 0 count)
       `(values-list list)))
 
 (deftransform %rest-ref ((n list context count))
index 3c9b4cf..624483b 100644 (file)
 ;;; defining a new stack frame.
 (define-vop (%more-arg-values)
   (:args (context :scs (descriptor-reg any-reg) :target src)
+         (skip :scs (any-reg immediate))
          (num :scs (any-reg) :target count))
-  (:arg-types * positive-fixnum)
-  (:temporary (:sc any-reg :from (:argument 0)) src)
-  (:temporary (:sc descriptor-reg) temp)
+  (:arg-types * positive-fixnum positive-fixnum)
+  (:temporary (:sc any-reg :offset rsi-offset :from (:argument 0)) src)
+  (:temporary (:sc descriptor-reg :offset rax-offset) temp)
   (:temporary (:sc unsigned-reg :offset rcx-offset) loop-index)
   (:results (start :scs (any-reg))
             (count :scs (any-reg)))
   (:generator 20
-    (move src context)
-    (move count num)
+    (sc-case skip
+      (immediate
+       (cond ((zerop (tn-value skip))
+              (move src context)
+              (move count num))
+             (t
+              (inst lea src (make-ea :dword :base context
+                                     :disp (- (* (tn-value skip)
+                                                 n-word-bytes))))
+              (move count num)
+              (inst sub count (* (tn-value skip) n-word-bytes)))))
+
+      (any-reg
+       (move src context)
+       #!+#.(cl:if (cl:= sb!vm:word-shift sb!vm:n-fixnum-tag-bits) '(and) '(or))
+       (inst sub src skip)
+       #!-#.(cl:if (cl:= sb!vm:word-shift sb!vm:n-fixnum-tag-bits) '(and) '(or))
+       (progn
+         ;; FIXME: This can't be efficient, but LEA (my first choice)
+         ;; doesn't do subtraction.
+         (inst shl skip (- word-shift n-fixnum-tag-bits))
+         (inst sub src skip)
+         (inst shr skip (- word-shift n-fixnum-tag-bits)))
+       (move count num)
+       (inst sub count skip)))
 
     (inst lea loop-index (make-ea :byte :index count
-                                        :scale (ash 1 (- word-shift n-fixnum-tag-bits))))
+                                  :scale (ash 1 (- word-shift n-fixnum-tag-bits))))
     (inst mov start rsp-tn)
     (inst jrcxz DONE)  ; check for 0 count?
 
index c7c294b..082ad2c 100644 (file)
 ;;; defining a new stack frame.
 (define-vop (%more-arg-values)
   (:args (context :scs (descriptor-reg any-reg) :target src)
+         (skip :scs (any-reg immediate))
          (num :scs (any-reg) :target count))
-  (:arg-types * positive-fixnum)
+  (:arg-types * positive-fixnum positive-fixnum)
   (:temporary (:sc any-reg :offset esi-offset :from (:argument 0)) src)
   (:temporary (:sc descriptor-reg :offset eax-offset) temp)
   (:temporary (:sc unsigned-reg :offset ecx-offset) loop-index)
   (:results (start :scs (any-reg))
             (count :scs (any-reg)))
   (:generator 20
-    (move src context)
-    (move count num)
+    (sc-case skip
+      (immediate
+       (cond ((zerop (tn-value skip))
+              (move src context)
+              (move count num))
+             (t
+              (inst lea src (make-ea :dword :base context
+                                     :disp (- (* (tn-value skip)
+                                                 n-word-bytes))))
+              (move count num)
+              (inst sub count (* (tn-value skip) n-word-bytes)))))
+
+      (any-reg
+       (move src context)
+       (inst sub src skip)
+       (move count num)
+       (inst sub count skip)))
 
     (move loop-index count)
     (inst mov start esp-tn)
     (inst mov (make-ea :dword :base esp-tn :index loop-index) temp)
     (inst jmp :nz LOOP)
 
-    DONE))
+    DONE
+    ))
 
index cbf6259..e470eb4 100644 (file)
@@ -1076,7 +1076,7 @@ bootstrapping.
             (values (fast-method-call-pv ,method-call))
             (values (fast-method-call-next-method-call ,method-call))
             ,@required-args
-            (sb-c::%more-arg-values ,more-context ,more-count))))))
+            (sb-c::%more-arg-values ,more-context 0 ,more-count))))))
 
 (defstruct (fast-instance-boundp (:copier nil))
   (index 0 :type fixnum))
index b568cf3..27f601c 100644 (file)
   (if applyp
       `(multiple-value-call ,miss-fn ,@args
                             (sb-c::%more-arg-values .more-context.
+                                                    0
                                                     .more-count.))
       `(funcall ,miss-fn ,@args)))