Changeset 11503


Ignore:
Timestamp:
12/29/08 15:26:20 (12 years ago)
Author:
vvoutilainen
Message:

Small refactoring combining common bits in p2-car/p2-cdr.
This is in preparation for combining both the Cons special
case and the function call case. After that it's much easier
to remove the Cons special case, if profiling so suggests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r11502 r11503  
    45874587      (emit-move-from-stack target))))
    45884588
     4589(defun emit-cast/getfield-for-car/cdr (arg target representation field)
     4590  (compile-form arg 'stack nil)
     4591  (emit 'checkcast +lisp-cons-class+)
     4592  (emit 'getfield +lisp-cons-class+ field +lisp-object+)
     4593  (fix-boxing representation nil)
     4594  (emit-move-from-stack target representation))
     4595
    45894596(defun p2-car (form target representation)
    45904597  (unless (check-arg-count form 1)
     
    45984605           (emit-invoke-method "cadr" target representation))
    45994606          ((eq (derive-type arg) 'CONS)
    4600            (compile-form arg 'stack nil)
    4601            (emit 'checkcast +lisp-cons-class+)
    4602            (emit 'getfield +lisp-cons-class+ "car" +lisp-object+)
    4603            (fix-boxing representation nil)
    4604            (emit-move-from-stack target representation))
     4607     (emit-cast/getfield-for-car/cdr arg target representation "car"))
    46054608          (t
    46064609     (compile-forms-and-maybe-emit-clear-values arg 'stack nil)
     
    46134616  (let ((arg (%cadr form)))
    46144617    (cond ((eq (derive-type arg) 'CONS)
    4615            (compile-form arg 'stack nil)
    4616            (emit 'checkcast +lisp-cons-class+)
    4617            (emit 'getfield +lisp-cons-class+ "cdr" +lisp-object+)
    4618            (fix-boxing representation nil)
    4619            (emit-move-from-stack target representation))
     4618     (emit-cast/getfield-for-car/cdr arg target representation "cdr"))
    46204619          (t
    46214620     (compile-forms-and-maybe-emit-clear-values arg 'stack nil)
Note: See TracChangeset for help on using the changeset viewer.