Changeset 5357


Ignore:
Timestamp:
Oct 17, 2006, 12:39:50 PM (18 years ago)
Author:
Gary Byers
Message:

Disable interrupts when necessary.

Location:
trunk/ccl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-streams.lisp

    r5354 r5357  
    36453645(defmethod stream-read-char ((s basic-character-input-stream))
    36463646  (let* ((ioblock (basic-stream-ioblock s)))
    3647     (funcall (ioblock-read-char-function ioblock) ioblock)))
     3647    (declare (optimize (speed 3)))
     3648    (without-interrupts
     3649     (values
     3650      (funcall (ioblock-read-char-function ioblock) ioblock)))))
    36483651
    36493652
     
    36513654  (let* ((ioblock (basic-stream-ioblock stream)))
    36523655    (with-ioblock-input-locked (ioblock)
    3653       (%ioblock-tyi-no-hang ioblock))))
     3656      (locally (declare (optimize (speed 3)))
     3657        (without-interrupts
     3658         (values
     3659          (%ioblock-tyi-no-hang ioblock)))))))
    36543660       
    36553661(defmethod stream-peek-char ((stream basic-character-input-stream))
    36563662  (let* ((ioblock (basic-stream-ioblock stream)))
    36573663    (with-ioblock-input-locked (ioblock)
    3658       (%ioblock-peek-char ioblock))))
     3664      (locally (declare (optimize (speed 3)))
     3665        (without-interrupts
     3666         (values
     3667          (%ioblock-peek-char ioblock)))))))
    36593668
    36603669(defmethod stream-clear-input ((stream basic-character-input-stream))
    36613670  (let* ((ioblock (basic-stream-ioblock stream)))
    36623671    (with-ioblock-input-locked (ioblock)
    3663       (%ioblock-clear-input ioblock))))
     3672      (locally (declare (optimize (speed 3)))
     3673        (without-interrupts
     3674         (values
     3675          (%ioblock-clear-input ioblock)))))))
    36643676
    36653677(defmethod stream-unread-char ((s basic-character-input-stream) char)
    36663678  (let* ((ioblock (basic-stream-ioblock s)))
    36673679    (with-ioblock-input-locked (ioblock)
    3668       (%ioblock-untyi ioblock char))))
     3680      (locally (declare (optimize (speed 3)))
     3681        (without-interrupts
     3682         (values
     3683          (%ioblock-untyi ioblock char)))))))
    36693684
    36703685(defmethod stream-read-ivector ((s basic-character-input-stream)
     
    36723687  (let* ((ioblock (basic-stream-ioblock s)))
    36733688    (with-ioblock-input-locked (ioblock)
    3674       (%ioblock-character-in-ivect ioblock iv start nb))))
     3689      (locally (declare (optimize (speed 3)))
     3690        (without-interrupts
     3691         (values
     3692          (%ioblock-character-in-ivect ioblock iv start nb)))))))
    36753693
    36763694(defmethod stream-read-vector ((stream basic-character-input-stream)
     
    36813699    (let* ((ioblock (basic-stream-ioblock stream)))
    36823700      (with-ioblock-input-locked (ioblock)
    3683         (funcall (ioblock-character-read-vector-function ioblock)
    3684                  ioblock vector start end)))))
     3701      (locally (declare (optimize (speed 3)))
     3702        (without-interrupts
     3703         (values
     3704          (funcall (ioblock-character-read-vector-function ioblock)
     3705                   ioblock vector start end))))))))
    36853706
    36863707(defmethod stream-read-line ((stream basic-character-input-stream))
    36873708  (let* ((ioblock (basic-stream-ioblock stream)))
    36883709    (with-ioblock-input-locked (ioblock)
    3689       (funcall (ioblock-read-line-function ioblock) ioblock))))
     3710      (locally (declare (optimize (speed 3)))
     3711        (without-interrupts
     3712         (values
     3713          (funcall (ioblock-read-line-function ioblock) ioblock)))))))
    36903714
    36913715                             
     
    43874411  (let* ((ioblock (stream-ioblock stream nil)))
    43884412    (when ioblock
    4389       (%ioblock-close ioblock))))
     4413      (locally (declare (optimize (speed 3)))
     4414        (without-interrupts
     4415         (values
     4416          (%ioblock-close ioblock)))))))
    43904417
    43914418(defmethod close :before ((stream buffered-output-stream-mixin) &key abort)
     
    44034430  (let* ((ioblock (basic-stream.state stream)))
    44044431    (when ioblock
    4405       (%ioblock-close ioblock))))
     4432      (locally (declare (optimize (speed 3)))
     4433        (without-interrupts
     4434         (values
     4435          (%ioblock-close ioblock)))))))
    44064436
    44074437
     
    44584488(defmethod stream-read-char ((stream buffered-character-input-stream-mixin))
    44594489  (let* ((ioblock (stream-ioblock stream t)))
    4460     (funcall (ioblock-read-char-function ioblock) ioblock)))
     4490    (locally (declare (optimize (speed 3)))
     4491      (without-interrupts
     4492       (values
     4493        (funcall (ioblock-read-char-function ioblock) ioblock))))))
    44614494
    44624495(defmethod stream-read-char-no-hang ((stream buffered-character-input-stream-mixin))
    44634496  (with-stream-ioblock-input (ioblock stream :speedy t)
    4464     (%ioblock-tyi-no-hang ioblock)))
     4497    (locally (declare (optimize (speed 3)))
     4498      (without-interrupts
     4499       (values
     4500        (%ioblock-tyi-no-hang ioblock))))))
    44654501
    44664502(defmethod stream-peek-char ((stream buffered-character-input-stream-mixin))
    44674503  (with-stream-ioblock-input (ioblock stream :speedy t)
    4468     (%ioblock-peek-char ioblock)))
     4504    (locally (declare (optimize (speed 3)))
     4505      (without-interrupts
     4506       (values
     4507        (%ioblock-peek-char ioblock))))))
    44694508
    44704509(defmethod stream-clear-input ((stream buffered-input-stream-mixin))
    44714510  (with-stream-ioblock-input (ioblock stream :speedy t)
    4472     (%ioblock-clear-input ioblock)))
     4511    (locally (declare (optimize (speed 3)))
     4512      (without-interrupts
     4513       (values
     4514        (%ioblock-clear-input ioblock))))))
    44734515
    44744516(defmethod stream-unread-char ((stream buffered-character-input-stream-mixin) char)
     
    44794521(defmethod stream-read-byte ((stream buffered-binary-input-stream-mixin))
    44804522  (with-stream-ioblock-input (ioblock stream :speedy t)
    4481     (funcall (ioblock-read-byte-function ioblock) ioblock)))
     4523    (locally (declare (optimize (speed 3)))
     4524      (without-interrupts
     4525       (values
     4526        (funcall (ioblock-read-byte-function ioblock) ioblock))))))
    44824527
    44834528(defmethod stream-read-byte ((stream basic-binary-input-stream))
    44844529  (let* ((ioblock (basic-stream-ioblock stream)))
    44854530    (with-ioblock-input-locked (ioblock)
    4486       (funcall (ioblock-read-byte-function ioblock) ioblock))))
     4531      (locally (declare (optimize (speed 3)))
     4532        (without-interrupts
     4533         (values
     4534          (funcall (ioblock-read-byte-function ioblock) ioblock)))))))
    44874535
    44884536(defmethod stream-eofp ((stream buffered-input-stream-mixin))
    44894537  (with-stream-ioblock-input (ioblock stream :speedy t)
    4490     (%ioblock-eofp ioblock)))
     4538    (locally (declare (optimize (speed 3)))
     4539      (without-interrupts
     4540       (values
     4541        (%ioblock-eofp ioblock))))))
    44914542
    44924543(defmethod stream-eofp ((stream basic-input-stream))
     
    44974548(defmethod stream-listen ((stream buffered-input-stream-mixin))
    44984549  (with-stream-ioblock-input (ioblock stream :speedy t)
    4499     (%ioblock-listen ioblock)))
     4550    (locally (declare (optimize (speed 3)))
     4551      (without-interrupts
     4552       (values
     4553        (%ioblock-listen ioblock))))))
    45004554
    45014555(defmethod stream-listen ((stream basic-input-stream))
    45024556  (let* ((ioblock (basic-stream-ioblock stream)))
    45034557    (with-ioblock-input-locked (ioblock)
    4504       (%ioblock-listen ioblock))))
    4505 
    4506 (defun flush-ioblock (ioblock finish-p)
    4507   (with-ioblock-output-locked (ioblock)
    4508     (%ioblock-force-output ioblock finish-p)))
     4558      (locally (declare (optimize (speed 3)))
     4559        (without-interrupts
     4560         (values
     4561          (%ioblock-listen ioblock)))))))
     4562
    45094563
    45104564(defmethod stream-write-byte ((stream buffered-binary-output-stream-mixin)
    45114565                              byte)
    45124566  (let* ((ioblock (stream-ioblock stream t)))
    4513     (funcall (ioblock-write-byte-function ioblock) ioblock byte)))
     4567    (locally (declare (optimize (speed 3)))
     4568      (without-interrupts
     4569       (values
     4570        (funcall (ioblock-write-byte-function ioblock) ioblock byte))))))
    45144571
    45154572(defmethod stream-write-byte ((stream basic-binary-output-stream) byte)
    45164573  (let* ((ioblock (basic-stream-ioblock stream)))
    4517     (funcall (ioblock-write-byte-function ioblock) ioblock byte)))
     4574    (locally (declare (optimize (speed 3)))
     4575      (without-interrupts
     4576       (values
     4577        (funcall (ioblock-write-byte-function ioblock) ioblock byte))))))
    45184578
    45194579(defmethod stream-write-char ((stream buffered-character-output-stream-mixin) char)
    45204580  (let* ((ioblock (stream-ioblock stream t)))
    4521     (funcall (ioblock-write-char-function ioblock) ioblock char)))
     4581    (locally (declare (optimize (speed 3)))
     4582      (without-interrupts
     4583       (values
     4584        (funcall (ioblock-write-char-function ioblock) ioblock char))))))
    45224585
    45234586(defmethod stream-write-char ((stream basic-character-output-stream) char)
    45244587  (let* ((ioblock (basic-stream-ioblock stream)))
    4525     (funcall (ioblock-write-char-function ioblock) ioblock char)))
     4588    (locally (declare (optimize (speed 3)))
     4589      (without-interrupts
     4590       (values
     4591        (funcall (ioblock-write-char-function ioblock) ioblock char))))))
    45264592
    45274593
    45284594(defmethod stream-clear-output ((stream buffered-output-stream-mixin))
    45294595  (with-stream-ioblock-output (ioblock stream :speedy t)
    4530     (%ioblock-clear-output ioblock))
     4596    (locally (declare (optimize (speed 3)))
     4597      (without-interrupts
     4598       (values
     4599        (%ioblock-clear-output ioblock)))))
    45314600  nil)
    45324601
     
    45344603  (let* ((ioblock (basic-stream-ioblock stream)))
    45354604    (with-ioblock-output-locked (ioblock)
    4536       (%ioblock-clear-output ioblock))
     4605      (locally (declare (optimize (speed 3)))
     4606        (without-interrupts
     4607         (values
     4608          (%ioblock-clear-output ioblock)))))
    45374609    nil))
    45384610
     
    45594631(defmethod stream-force-output ((stream buffered-output-stream-mixin))
    45604632  (with-stream-ioblock-output (ioblock stream :speedy t)
    4561     (%ioblock-force-output ioblock nil)
     4633    (locally (declare (optimize (speed 3)))
     4634      (without-interrupts
     4635       (values
     4636        (%ioblock-force-output ioblock nil))))
    45624637    nil))
    45634638
     
    45654640  (let* ((ioblock (basic-stream-ioblock stream)))
    45664641    (with-ioblock-output-locked (ioblock)
    4567       (%ioblock-force-output ioblock nil)
     4642      (locally (declare (optimize (speed 3)))
     4643        (without-interrupts
     4644         (values
     4645          (%ioblock-force-output ioblock nil))))
    45684646      nil)))
    45694647
    45704648(defmethod maybe-stream-force-output ((stream buffered-output-stream-mixin))
    45714649  (with-stream-ioblock-output-maybe (ioblock stream :speedy t)
    4572     (%ioblock-force-output ioblock nil)
     4650    (locally (declare (optimize (speed 3)))
     4651      (without-interrupts
     4652       (values
     4653        (%ioblock-force-output ioblock nil))))
    45734654    nil))
    45744655
     
    45764657  (let* ((ioblock (basic-stream-ioblock stream)))
    45774658    (with-ioblock-output-locked-maybe (ioblock)
    4578       (%ioblock-force-output ioblock nil)
     4659      (locally (declare (optimize (speed 3)))
     4660        (without-interrupts
     4661         (values
     4662          (%ioblock-force-output ioblock nil))))
    45794663      nil)))
    45804664
    45814665(defmethod stream-finish-output ((stream buffered-output-stream-mixin))
    45824666  (with-stream-ioblock-output (ioblock stream :speedy t)
    4583     (%ioblock-force-output ioblock t)
     4667    (locally (declare (optimize (speed 3)))
     4668      (without-interrupts
     4669       (values
     4670        (%ioblock-force-output ioblock t))))
    45844671    nil))
    45854672
     
    45874674  (let* ((ioblock (basic-stream-ioblock stream)))
    45884675    (with-ioblock-output-locked (ioblock)
    4589       (%ioblock-force-output ioblock t)
     4676      (locally (declare (optimize (speed 3)))
     4677        (without-interrupts
     4678         (values
     4679          (%ioblock-force-output ioblock t))))
    45904680      nil)))
    45914681
     
    45984688    (if (and (typep string 'simple-string)
    45994689             (not start-p))
    4600       (funcall (ioblock-write-simple-string-function ioblock)
    4601                ioblock string 0 (length string))
     4690      (locally (declare (optimize (speed 3)))
     4691        (without-interrupts
     4692         (values
     4693          (funcall (ioblock-write-simple-string-function ioblock)
     4694                   ioblock string 0 (length string)))))
    46024695      (progn
    46034696        (setq end (check-sequence-bounds string start end))
     
    46104703              (incf start offset)
    46114704              (incf end offset))
    4612             (funcall (ioblock-write-simple-string-function ioblock)
    4613                      ioblock arr start (the fixnum (- end start))))))))
     4705            (locally (declare (optimize (speed 3)))
     4706              (without-interrupts
     4707               (values
     4708                (funcall (ioblock-write-simple-string-function ioblock)
     4709                         ioblock arr start (the fixnum (- end start)))))))))))
    46144710  string)
    46154711
     
    46214717      (if (and (typep string 'simple-string)
    46224718               (not start-p))
    4623         (funcall (ioblock-write-simple-string-function ioblock)
    4624                  ioblock string 0 (length string))
     4719        (locally (declare (optimize (speed 3)))
     4720          (without-interrupts
     4721           (values
     4722            (funcall (ioblock-write-simple-string-function ioblock)
     4723                     ioblock string 0 (length string)))))
    46254724        (progn
    46264725          (setq end (check-sequence-bounds string start end))
     
    46334732                (incf start offset)
    46344733                (incf end offset))
    4635               (funcall (ioblock-write-simple-string-function ioblock)
    4636                        ioblock arr start (the fixnum (- end start)))))))))
     4734              (locally (declare (optimize (speed 3)))
     4735                (without-interrupts
     4736                 (values
     4737                  (funcall (ioblock-write-simple-string-function ioblock)
     4738                           ioblock arr start (the fixnum (- end start))))))))))))
    46374739  string)
    46384740
     
    46414743                                 iv start length)
    46424744  (with-stream-ioblock-output (ioblock s :speedy t)
    4643     (%ioblock-out-ivect ioblock iv start length)))
     4745    (locally (declare (optimize (speed 3)))
     4746      (without-interrupts
     4747       (values   
     4748        (%ioblock-out-ivect ioblock iv start length))))))
    46444749
    46454750(defmethod stream-write-ivector ((s basic-output-stream)
     
    46474752  (let* ((ioblock (basic-stream-ioblock s)))
    46484753    (with-ioblock-output-locked (ioblock)
    4649       (%ioblock-out-ivect ioblock iv start length))))
     4754      (locally (declare (optimize (speed 3)))
     4755        (without-interrupts
     4756         (values
     4757          (%ioblock-out-ivect ioblock iv start length)))))))
    46504758
    46514759
     
    46534761                                iv start nb)
    46544762  (with-stream-ioblock-input (ioblock s :speedy t)
    4655     (%ioblock-character-in-ivect ioblock iv start nb)))
     4763    (locally (declare (optimize (speed 3)))
     4764      (without-interrupts
     4765       (values
     4766        (%ioblock-character-in-ivect ioblock iv start nb))))))
    46564767
    46574768(defmethod stream-read-ivector ((s buffered-binary-input-stream-mixin)
    46584769                                iv start nb)
    46594770  (with-stream-ioblock-input (ioblock s :speedy t)
    4660     (%ioblock-binary-in-ivect ioblock iv start nb)))
     4771    (locally (declare (optimize (speed 3)))
     4772      (without-interrupts
     4773       (values
     4774        (%ioblock-binary-in-ivect ioblock iv start nb))))))
    46614775
    46624776
     
    46694783      (let* ((total (- end start)))
    46704784        (declare (fixnum total))
    4671         (funcall (ioblock-write-simple-string-function ioblock)
    4672                  ioblock vector start total)))))
     4785        (locally (declare (optimize (speed 3)))
     4786          (without-interrupts
     4787           (values
     4788            (funcall (ioblock-write-simple-string-function ioblock)
     4789                     ioblock vector start total))))))))
    46734790
    46744791(defmethod stream-write-vector ((stream basic-character-output-stream)
     
    46814798      (declare (fixnum total))
    46824799      (with-ioblock-output-locked (ioblock)
    4683                 (funcall (ioblock-write-simple-string-function ioblock)
    4684                  ioblock vector start total)))))
     4800        (locally (declare (optimize (speed 3)))
     4801          (without-interrupts
     4802           (values
     4803            (funcall (ioblock-write-simple-string-function ioblock)
     4804                     ioblock vector start total))))))))
    46854805
    46864806(defmethod stream-write-vector ((stream buffered-binary-output-stream-mixin)
     
    46884808  (declare (fixnum start end))
    46894809  (with-stream-ioblock-output (ioblock stream :speedy t)
    4690     (let* ((out (ioblock-outbuf ioblock))
    4691            (buf (io-buffer-buffer out))
    4692            (written 0)
    4693            (limit (io-buffer-limit out))
    4694            (total (- end start))
    4695            (buftype (typecode buf)))
    4696       (declare (fixnum buftype written total limit))
    4697       (if (not (= (the fixnum (typecode vector)) buftype))
    4698         (do* ((i start (1+ i))
    4699               (wbf (ioblock-write-byte-function ioblock)))
    4700              ((= i end))
    4701           (let ((byte (uvref vector i)))
    4702             (when (characterp byte)
    4703               (setq byte (char-code byte)))
    4704             (funcall wbf ioblock byte)))
    4705         (do* ((pos start (+ pos written))
    4706               (left total (- left written)))
    4707              ((= left 0))
    4708           (declare (fixnum pos left))
    4709           (setf (ioblock-dirty ioblock) t)
    4710           (let* ((index (io-buffer-idx out))
    4711                  (count (io-buffer-count out))
    4712                  (avail (- limit index)))
    4713             (declare (fixnum index avail count))
    4714             (cond
    4715               ((= (setq written avail) 0)
    4716                (%ioblock-force-output ioblock nil))
    4717               (t
    4718                (if (> written left)
    4719                  (setq written left))
    4720                (%copy-ivector-to-ivector
    4721                 vector
    4722                 (ioblock-elements-to-octets ioblock pos)
    4723                 buf
    4724                 (ioblock-elements-to-octets ioblock index)
    4725                 (ioblock-elements-to-octets ioblock written))
    4726                (setf (ioblock-dirty ioblock) t)
    4727                (incf index written)
    4728                (if (> index count)
    4729                  (setf (io-buffer-count out) index))
    4730                (setf (io-buffer-idx out) index)
    4731                (if (= index  limit)
    4732                  (%ioblock-force-output ioblock nil))))))))))
     4810    (without-interrupts
     4811     (let* ((out (ioblock-outbuf ioblock))
     4812            (buf (io-buffer-buffer out))
     4813            (written 0)
     4814            (limit (io-buffer-limit out))
     4815            (total (- end start))
     4816            (buftype (typecode buf)))
     4817       (declare (fixnum buftype written total limit))
     4818       (if (not (= (the fixnum (typecode vector)) buftype))
     4819         (do* ((i start (1+ i))
     4820               (wbf (ioblock-write-byte-function ioblock)))
     4821              ((= i end))
     4822           (let ((byte (uvref vector i)))
     4823             (funcall wbf ioblock byte)))
     4824         (do* ((pos start (+ pos written))
     4825               (left total (- left written)))
     4826              ((= left 0))
     4827           (declare (fixnum pos left))
     4828           (setf (ioblock-dirty ioblock) t)
     4829           (let* ((index (io-buffer-idx out))
     4830                  (count (io-buffer-count out))
     4831                  (avail (- limit index)))
     4832             (declare (fixnum index avail count))
     4833             (cond
     4834               ((= (setq written avail) 0)
     4835                (%ioblock-force-output ioblock nil))
     4836               (t
     4837                (if (> written left)
     4838                  (setq written left))
     4839                (%copy-ivector-to-ivector
     4840                 vector
     4841                 (ioblock-elements-to-octets ioblock pos)
     4842                 buf
     4843                 (ioblock-elements-to-octets ioblock index)
     4844                 (ioblock-elements-to-octets ioblock written))
     4845                (setf (ioblock-dirty ioblock) t)
     4846                (incf index written)
     4847                (if (> index count)
     4848                  (setf (io-buffer-count out) index))
     4849                (setf (io-buffer-idx out) index)
     4850                (if (= index  limit)
     4851                  (%ioblock-force-output ioblock nil)))))))))))
    47334852
    47344853(defmethod stream-write-vector ((stream basic-binary-output-stream)
     
    47374856  (let* ((ioblock (basic-stream-ioblock stream)))
    47384857    (with-ioblock-output-locked (ioblock)
    4739     (let* ((out (ioblock-outbuf ioblock))
    4740            (buf (io-buffer-buffer out))
    4741            (written 0)
    4742            (limit (io-buffer-limit out))
    4743            (total (- end start))
    4744            (buftype (typecode buf)))
    4745       (declare (fixnum buftype written total limit))
    4746       (if (not (= (the fixnum (typecode vector)) buftype))
    4747         (do* ((i start (1+ i))
    4748               (wbf (ioblock-write-byte-function ioblock)))
    4749              ((= i end))
    4750           (let ((byte (uvref vector i)))
    4751             (when (characterp byte)
    4752               (setq byte (char-code byte)))
    4753             (funcall wbf ioblock byte)))
    4754         (do* ((pos start (+ pos written))
    4755               (left total (- left written)))
    4756              ((= left 0))
    4757           (declare (fixnum pos left))
    4758           (setf (ioblock-dirty ioblock) t)
    4759           (let* ((index (io-buffer-idx out))
    4760                  (count (io-buffer-count out))
    4761                  (avail (- limit index)))
    4762             (declare (fixnum index avail count))
    4763             (cond
    4764               ((= (setq written avail) 0)
    4765                (%ioblock-force-output ioblock nil))
    4766               (t
    4767                (if (> written left)
    4768                  (setq written left))
    4769                (%copy-ivector-to-ivector
    4770                 vector
    4771                 (ioblock-elements-to-octets ioblock pos)
    4772                 buf
    4773                 (ioblock-elements-to-octets ioblock index)
    4774                 (ioblock-elements-to-octets ioblock written))
    4775                (setf (ioblock-dirty ioblock) t)
    4776                (incf index written)
    4777                (if (> index count)
    4778                  (setf (io-buffer-count out) index))
    4779                (setf (io-buffer-idx out) index)
    4780                (if (= index  limit)
    4781                  (%ioblock-force-output ioblock nil)))))))))))
     4858      (without-interrupts
     4859       (let* ((out (ioblock-outbuf ioblock))
     4860              (buf (io-buffer-buffer out))
     4861              (written 0)
     4862              (limit (io-buffer-limit out))
     4863              (total (- end start))
     4864              (buftype (typecode buf)))
     4865         (declare (fixnum buftype written total limit))
     4866         (if (not (= (the fixnum (typecode vector)) buftype))
     4867           (do* ((i start (1+ i))
     4868                 (wbf (ioblock-write-byte-function ioblock)))
     4869                ((= i end))
     4870             (let ((byte (uvref vector i)))
     4871               (when (characterp byte)
     4872                 (setq byte (char-code byte)))
     4873               (funcall wbf ioblock byte)))
     4874           (do* ((pos start (+ pos written))
     4875                 (left total (- left written)))
     4876                ((= left 0))
     4877             (declare (fixnum pos left))
     4878             (setf (ioblock-dirty ioblock) t)
     4879             (let* ((index (io-buffer-idx out))
     4880                    (count (io-buffer-count out))
     4881                    (avail (- limit index)))
     4882               (declare (fixnum index avail count))
     4883               (cond
     4884                 ((= (setq written avail) 0)
     4885                  (%ioblock-force-output ioblock nil))
     4886                 (t
     4887                  (if (> written left)
     4888                    (setq written left))
     4889                  (%copy-ivector-to-ivector
     4890                   vector
     4891                   (ioblock-elements-to-octets ioblock pos)
     4892                   buf
     4893                   (ioblock-elements-to-octets ioblock index)
     4894                   (ioblock-elements-to-octets ioblock written))
     4895                  (setf (ioblock-dirty ioblock) t)
     4896                  (incf index written)
     4897                  (if (> index count)
     4898                    (setf (io-buffer-count out) index))
     4899                  (setf (io-buffer-idx out) index)
     4900                  (if (= index  limit)
     4901                    (%ioblock-force-output ioblock nil))))))))))))
    47824902
    47834903
     
    47904910    (let* ((ioblock (basic-stream-ioblock stream)))
    47914911      (with-ioblock-input-locked (ioblock)
    4792         (%ioblock-binary-read-vector ioblock vector start end)))))
     4912        (locally (declare (optimize (speed 3)))
     4913          (without-interrupts
     4914           (values
     4915            (%ioblock-binary-read-vector ioblock vector start end))))))))
    47934916
    47944917(defmethod stream-read-vector ((stream buffered-character-input-stream-mixin)
     
    47984921    (call-next-method)
    47994922    (with-stream-ioblock-input (ioblock stream :speedy t)
    4800       (funcall (ioblock-character-read-vector-function ioblock)
    4801                ioblock vector start end))))
     4923        (locally (declare (optimize (speed 3)))
     4924          (without-interrupts
     4925           (values
     4926            (funcall (ioblock-character-read-vector-function ioblock)
     4927                     ioblock vector start end)))))))
    48024928
    48034929
     
    48094935    (call-next-method)
    48104936    (with-stream-ioblock-input (ioblock stream :speedy t)
    4811       (%ioblock-binary-read-vector ioblock vector start end))))
     4937        (locally (declare (optimize (speed 3)))
     4938          (without-interrupts
     4939           (values
     4940            (%ioblock-binary-read-vector ioblock vector start end)))))))
    48124941
    48134942
  • trunk/ccl/lib/streams.lisp

    r5231 r5357  
    3434(defun read-line (&optional input-stream (eof-error-p t) eof-value recursive-p)
    3535 
    36   (declare (ignore recursive-p))
     36  (declare (ignore recursive-p)
     37           (optimize (speed 3)))
    3738  (let* ((input-stream (designated-input-stream input-stream)))
    3839    (multiple-value-bind (string eof)
    3940        (if (typep input-stream 'basic-stream)
    4041          (let* ((ioblock (basic-stream-ioblock input-stream)))
    41             (with-ioblock-input-locked (ioblock)
    42               (funcall (ioblock-read-line-function ioblock) ioblock)))
     42            (without-interrupts
     43             (with-ioblock-input-locked (ioblock)
     44               (funcall (ioblock-read-line-function ioblock) ioblock))))
    4345          (stream-read-line input-stream))
    4446      (if eof
     
    5557  (setq input-stream (designated-input-stream input-stream))
    5658  (if (typep input-stream 'basic-stream)
    57     (let* ((ioblock (basic-stream.state input-stream)))
    58       (if ioblock
    59         (check-eof
    60          (funcall (ioblock-read-char-function ioblock) ioblock)
    61          input-stream eof-error-p eof-value)
    62         (stream-is-closed input-stream)))
     59    (let* ((ioblock (basic-stream-ioblock input-stream)))
     60      (check-eof
     61       (without-interrupts
     62        (values
     63         (funcall (ioblock-read-char-function ioblock) ioblock)))
     64       input-stream eof-error-p eof-value))
    6365    (check-eof (stream-read-char input-stream)
    6466               input-stream
     
    6870(defun unread-char (char &optional input-stream)
    6971  (let* ((input-stream (designated-input-stream input-stream)))
    70     (stream-unread-char input-stream char)
     72    (if (typep input-stream 'basic-stream)
     73      (let* ((flags (basic-stream.flags input-stream)))
     74        (declare (fixnum flags))
     75        (if (= (the fixnum (logand flags (logior (ash 1 basic-stream-flag.open-input)
     76                                                 (ash 1 basic-stream-flag.open-character))))
     77               (logior (ash 1 basic-stream-flag.open-input)
     78                                                 (ash 1 basic-stream-flag.open-character)))
     79          (let* ((ioblock (basic-stream-ioblock input-stream)))
     80            (without-interrupts
     81             (%ioblock-untyi ioblock char)))
     82          (stream-unread-char input-stream char)))
     83      (stream-unread-char input-stream char))
    7184    nil))
    7285
     
    96109
    97110(defun read-byte (stream &optional (eof-error-p t) eof-value)
     111  (declare (optimize (speed 3) (space 0)))
    98112  (if (typep stream 'basic-stream)
    99     (let* ((ioblock (basic-stream.state stream)))
    100       (if ioblock
    101         (check-eof (funcall (ioblock-read-byte-function ioblock) ioblock)
    102                    stream
    103                    eof-error-p
    104                    eof-value)
    105         (stream-is-closed ioblock)))
     113    (let* ((ioblock (basic-stream-ioblock stream)))
     114      (check-eof (without-interrupts
     115                  (values (funcall (ioblock-read-byte-function ioblock) ioblock)))
     116                 stream
     117                 eof-error-p
     118                 eof-value))
    106119    (check-eof
    107120     (stream-read-byte stream)
     
    129142
    130143(defun write-byte (byte stream)
     144  (declare (optimize (speed 3) (space 0)))
    131145  "Write one byte, BYTE, to STREAM."
    132146  (if (typep stream 'basic-stream)
    133147    (let* ((ioblock (basic-stream-ioblock stream)))
    134       (funcall (ioblock-write-byte-function ioblock) ioblock byte))
     148      (without-interrupts
     149       (values
     150        (funcall (ioblock-write-byte-function ioblock) ioblock byte))))
    135151    (stream-write-byte stream byte))
    136152  byte)
Note: See TracChangeset for help on using the changeset viewer.