Changeset 10278


Ignore:
Timestamp:
10/30/05 01:18:04 (16 years ago)
Author:
piso
Message:

P2-READ-LINE

File:
1 edited

Legend:

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

    r9933 r10278  
    22;;;
    33;;; Copyright (C) 2003-2005 Peter Graves
    4 ;;; $Id: jvm.lisp,v 1.613 2005-08-28 15:15:01 piso Exp $
     4;;; $Id: jvm.lisp,v 1.614 2005-10-30 01:18:04 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    60266026           (compile-function-call form target representation)))))
    60276027
     6028(defun p2-read-line (form target representation)
     6029;;   (format t "p2-read-line~%")
     6030  (let* ((args (cdr form))
     6031         (len (length args)))
     6032    (case len
     6033      (1
     6034       (let* ((arg1 (%car args))
     6035              (type1 (derive-compiler-type arg1)))
     6036         (cond ((compiler-subtypep type1 'stream)
     6037;;                 (format t "p2-read-line optimized case 1~%")
     6038                (compile-form arg1 'stack nil)
     6039                (maybe-emit-clear-values arg1)
     6040                (emit 'checkcast +lisp-stream-class+)
     6041                (emit-push-constant-int 1)
     6042                (emit-push-nil)
     6043                (emit-invokevirtual +lisp-stream-class+ "readLine"
     6044                                    (list "Z" +lisp-object+) +lisp-object+)
     6045                (when target
     6046                  (emit-move-from-stack target)))
     6047               (t
     6048                (compile-function-call form target representation)))))
     6049      (2
     6050       (let* ((arg1 (%car args))
     6051              (type1 (derive-compiler-type arg1))
     6052              (arg2 (%cadr args)))
     6053         (cond ((and (compiler-subtypep type1 'stream) (null arg2))
     6054;;                 (format t "p2-read-line optimized case 2~%")
     6055                (compile-form arg1 'stack nil)
     6056                (maybe-emit-clear-values arg1)
     6057                (emit 'checkcast +lisp-stream-class+)
     6058                (emit-push-constant-int 0)
     6059                (emit-push-nil)
     6060                (emit-invokevirtual +lisp-stream-class+ "readLine"
     6061                                    (list "Z" +lisp-object+) +lisp-object+)
     6062                (when target
     6063                  (emit-move-from-stack target))
     6064                )
     6065               (t
     6066                (compile-function-call form target representation)))))
     6067      (t
     6068       (compile-function-call form target representation)))))
     6069
    60286070(declaim (ftype (function (t) t) derive-type-aref))
    60296071(defun derive-type-aref (form)
     
    63756417              (second form))
    63766418             (t
    6377               (let ((type (ftype-result-type (proclaimed-ftype op))))
     6419              (let ((type (or (function-result-type op)
     6420                              (ftype-result-type (proclaimed-ftype op)))))
    63786421                (if (eq type '*) t type))))))
    63796422        ((null form)
     
    85958638  (install-p2-handler 'puthash             'p2-puthash)
    85968639  (install-p2-handler 'quote               'p2-quote)
     8640  (install-p2-handler 'read-line           'p2-read-line)
    85978641  (install-p2-handler 'return-from         'p2-return-from)
    85988642  (install-p2-handler 'rplacd              'p2-rplacd)
Note: See TracChangeset for help on using the changeset viewer.