Changeset 8410


Ignore:
Timestamp:
01/29/05 17:17:59 (17 years ago)
Author:
piso
Message:

Work in progress (tested).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/jvm.lisp

    r8409 r8410  
    22;;;
    33;;; Copyright (C) 2003-2005 Peter Graves
    4 ;;; $Id: jvm.lisp,v 1.376 2005-01-29 16:24:54 piso Exp $
     4;;; $Id: jvm.lisp,v 1.377 2005-01-29 17:17:59 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    287287(defvar *using-arg-array* nil)
    288288(defvar *hairy-arglist-p* nil)
    289 
    290 (defvar *val* nil) ; index of value register
    291289
    292290(defstruct node
     
    22182216    g))
    22192217
    2220 (defun compile-constant (form &key (target *val*) representation)
     2218(defun compile-constant (form &key (target :stack) representation)
    22212219  (unless target
    22222220    (return-from compile-constant))
     
    24442442            (aver nil)))))
    24452443
    2446 (defun p2-eql (form &key (target *val*) representation)
     2444(defun p2-eql (form &key (target :stack) representation)
    24472445  (unless (= (length form) 3)
    24482446    (error "Wrong number of arguments for EQL."))
     
    26892687         form)))
    26902688
    2691 (defun compile-funcall (form &key (target *val*) representation)
     2689(defun compile-funcall (form &key (target :stack) representation)
    26922690  (unless (> (length form) 1)
    26932691    (compiler-style-warn "Wrong number of arguments for ~A." (car form))
     
    28672865  (if negatep 'if_acmpne 'if_acmpeq))
    28682866
    2869 (defun p2-numeric-comparison (form &key (target *val*) representation)
     2867(defun p2-numeric-comparison (form &key (target :stack) representation)
    28702868  (let ((op (car form))
    28712869        (args (cdr form)))
     
    30443042  (if negatep 'if_acmpne 'if_acmpeq))
    30453043
    3046 (defun compile-if (form &key (target *val*) representation)
     3044(defun compile-if (form &key (target :stack) representation)
    30473045  (let* ((test (second form))
    30483046         (consequent (third form))
     
    30643062           (label LABEL2)))))
    30653063
    3066 (defun compile-multiple-value-list (form &key (target *val*) representation)
     3064(defun compile-multiple-value-list (form &key (target :stack) representation)
    30673065  (emit-clear-values)
    30683066  (compile-form (second form) :target :stack)
     
    30713069  (emit-move-from-stack target))
    30723070
    3073 (defun compile-multiple-value-prog1 (form &key (target *val*) representation)
     3071(defun compile-multiple-value-prog1 (form &key (target :stack) representation)
    30743072  (let ((first-subform (cadr form))
    30753073        (subforms (cddr form))
     
    30933091    (emit-move-from-stack target)))
    30943092
    3095 (defun compile-multiple-value-call (form &key (target *val*) representation)
     3093(defun compile-multiple-value-call (form &key (target :stack) representation)
    30963094  (case (length form)
    30973095    (1
     
    34063404    specials))
    34073405
    3408 (defun compile-locally (form &key (target *val*) representation)
     3406(defun compile-locally (form &key (target :stack) representation)
    34093407  (let ((*visible-variables* *visible-variables*)
    34103408        (specials (process-special-declarations (cdr form))))
     
    35643562      (emit-move-from-stack target))))
    35653563
    3566 (defun compile-atom (form &key (target *val*) representation)
     3564(defun compile-atom (form &key (target :stack) representation)
    35673565  (unless (= (length form) 2)
    35683566    (error "Wrong number of arguments for ATOM."))
     
    35953593;;              (return t)))))))
    35963594
    3597 (defun compile-block (form &key (target *val*) representation)
     3595(defun compile-block (form &key (target :stack) representation)
    35983596;;   (format t "compile-block ~S~%" (cadr form))
    35993597  ;; This shouldn't be called, now that we have pass 1.
     
    36583656      (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+))))
    36593657
    3660 (defun p2-return-from (form &key (target *val*) representation)
     3658(defun p2-return-from (form &key (target :stack) representation)
    36613659  (let* ((name (second form))
    36623660         (result-form (third form))
     
    37093707      (emit-move-from-stack target))))
    37103708
    3711 (defun compile-cons (form &key (target *val*) representation)
     3709(defun compile-cons (form &key (target :stack) representation)
    37123710  (unless (check-args form 2)
    37133711    (compile-function-call form target representation)
     
    37393737                   (setf must-clear-values t)))))))))
    37403738
    3741 (defun compile-progn (form &key (target *val*) representation)
     3739(defun compile-progn (form &key (target :stack) representation)
    37423740  (compile-progn-body (cdr form) target)
    37433741  (when (eq representation :unboxed-fixnum)
    37443742    (emit-unbox-fixnum)))
    37453743
    3746 (defun compile-quote (form &key (target *val*) representation)
     3744(defun compile-quote (form &key (target :stack) representation)
    37473745   (let ((obj (second form)))
    37483746     (cond ((null obj)
     
    37713769            (error "COMPILE-QUOTE: unsupported case: ~S" form)))))
    37723770
    3773 (defun compile-rplacd (form &key (target *val*) representation)
     3771(defun compile-rplacd (form &key (target :stack) representation)
    37743772  (let ((args (cdr form)))
    37753773    (unless (= (length args) 2)
     
    38473845                   *local-functions*))))))
    38483846
    3849 (defun p2-flet (form &key (target *val*) representation)
     3847(defun p2-flet (form &key (target :stack) representation)
    38503848  (let ((*local-functions* *local-functions*)
    38513849        (compilands (cadr form))
     
    39213919  (emit-move-from-stack target))
    39223920
    3923 (defun p2-function (form &key (target *val*) representation)
     3921(defun p2-function (form &key (target :stack) representation)
    39243922  (let ((name (second form))
    39253923        (local-function))
     
    39833981           (error "p2-function: unsupported case: ~S" form)))))
    39843982
    3985 (defun p2-ash (form &key (target *val*) representation)
     3983(defun p2-ash (form &key (target :stack) representation)
    39863984  (dformat t "p2-ash form = ~S representation = ~S~%" form representation)
    39873985  (unless (check-args form 2)
     
    40454043             (compile-function-call form target representation)))))
    40464044
    4047 (defun p2-logand (form &key (target *val*) representation)
     4045(defun p2-logand (form &key (target :stack) representation)
    40484046  (let* ((args (cdr form))
    40494047         (len (length args)))
     
    41254123  t)
    41264124
    4127 (defun compile-length (form &key (target *val*) representation)
     4125(defun compile-length (form &key (target :stack) representation)
    41284126  (check-args form 1)
    41294127  (let ((arg (cadr form)))
     
    41364134    (emit-move-from-stack target representation)))
    41374135
    4138 (defun compile-nth (form &key (target *val*) representation)
     4136(defun compile-nth (form &key (target :stack) representation)
    41394137  (unless (check-args form 2)
    41404138    (compile-function-call form target representation)
     
    41534151    (emit-move-from-stack target representation)))
    41544152
    4155 (defun p2-plus (form &key (target *val*) representation)
     4153(defun p2-plus (form &key (target :stack) representation)
    41564154  (case (length form)
    41574155    (3
     
    42834281     (compile-function-call form target representation))))
    42844282
    4285 (defun p2-minus (form &key (target *val*) representation)
     4283(defun p2-minus (form &key (target :stack) representation)
    42864284  (case (length form)
    42874285    (3
     
    43734371     (compile-function-call form target representation))))
    43744372
    4375 (defun compile-schar (form &key (target *val*) representation)
     4373(defun compile-schar (form &key (target :stack) representation)
    43764374  (unless (= (length form) 3)
    43774375    (error 'program-error
     
    43864384  (emit-move-from-stack target))
    43874385
    4388 (defun compile-aref (form &key (target *val*) representation)
     4386(defun compile-aref (form &key (target :stack) representation)
    43894387  (unless (= (length form) 3)
    43904388    (return-from compile-aref (compile-function-call form target representation)))
     
    43974395  (emit-move-from-stack target))
    43984396
    4399 (defun compile-not/null (form &key (target *val*) representation)
     4397(defun compile-not/null (form &key (target :stack) representation)
    44004398  (unless (= (length form) 2)
    44014399    (error 'program-error
     
    44344432  (emit-move-from-stack target))
    44354433
    4436 (defun compile-values (form &key (target *val*) representation)
     4434(defun compile-values (form &key (target :stack) representation)
    44374435  (let ((args (cdr form)))
    44384436    (case (length args)
     
    45274525        form)))
    45284526
    4529 (defun compile-setq (form &key (target *val*) representation)
     4527(defun compile-setq (form &key (target :stack) representation)
    45304528;;   (dformat t "compile-setq form = ~S target = ~S representation = ~S~%"
    45314529;;            form target representation)
     
    45894587               (emit-move-from-stack target))))))
    45904588
    4591 (defun p2-the (form &key (target *val*) representation)
     4589(defun p2-the (form &key (target :stack) representation)
    45924590;;   (compile-form (third form) :target target :representation representation)
    45934591  (cond ((subtypep (second form) 'FIXNUM)
     
    46024600         (compile-form (third form) :target target :representation representation))))
    46034601
    4604 (defun compile-catch (form &key (target *val*) representation)
     4602(defun compile-catch (form &key (target :stack) representation)
    46054603  (when (= (length form) 2) ; (catch 'foo)
    46064604    (when target
     
    46894687        form)))
    46904688
    4691 (defun compile-throw (form &key (target *val*) representation)
     4689(defun compile-throw (form &key (target :stack) representation)
    46924690  (emit-push-current-thread)
    46934691  (compile-form (second form) :target :stack) ; Tag.
     
    47574755        (push handler *handlers*)))))
    47584756
    4759 (defun compile-form (form &key (target *val*) representation)
     4757(defun compile-form (form &key (target :stack) representation)
    47604758  (cond ((consp form)
    47614759         (let ((op (car form))
     
    50365034                (list* 'LAMBDA lambda-list (mapcar #'p1 body))))))))
    50375035
    5038 (defun p2-%call-internal (form &key (target *val*) representation)
     5036(defun p2-%call-internal (form &key (target :stack) representation)
    50395037  (dformat t "p2-%call-internal~%")
    50405038  (emit 'aload_0) ; this
     
    50825080         (parameters ())
    50835081
    5084          (*val* nil)
    50855082         (*thread* nil)
    50865083         (*initialize-thread-var* nil))
     
    51835180       (setf (compiland-closure-register compiland) (allocate-register))
    51845181       (dformat t "closure register = ~S~%" (compiland-closure-register compiland)))
    5185     ;; Reserve the next available slot for the value register.
    5186     (setf *val* (allocate-register))
    51875182    ;; Reserve the next available slot for the thread register.
    51885183    (setf *thread* (allocate-register))
Note: See TracChangeset for help on using the changeset viewer.