Changeset 14756


Ignore:
Timestamp:
Apr 29, 2011, 2:49:16 PM (14 years ago)
Author:
Gary Byers
Message:

sysutils.lisp: REQUIRE-STRUCTURE-TYPE; basically inlines a
STRUCTURE-TYPEP test and allows the error signalling to happen
out-of-line if the test fails.

optimizers.lisp: if REQUIRE-STRUCTURE-TYPE is defined, transform
(REQUIRE-TYPE thing 'structure-class-name) into a call to
REQUIRE-STRUCTURE-TYPE.

Location:
trunk/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/optimizers.lisp

    r14725 r14756  
    941941  (if first-p
    942942    (if rest call first)))
     943
     944
     945
    943946
    944947;;; This isn't quite right... The idea is that (car (require-type foo
     
    10031006                           ((and (symbolp type)(find-class type nil env))
    10041007                            `(%require-type-class-cell ,arg (load-time-value (find-class-cell ',type t))))
     1008                           ((and (symbolp type)
     1009                                 #-bootstrapped-this (fboundp 'require-structure-type)
     1010                                 (structure-class-p type env))
     1011                            `(require-structure-type ,arg (load-time-value (find-class-cell ',type t))))
    10051012                           (t (let* ((val (gensym)))
    10061013                                `(the ,type
  • trunk/source/level-1/sysutils.lisp

    r14577 r14756  
    310310      (%kernel-restart $xwrongtype arg type))))
    311311
     312
     313
    312314;;; Might want to use an inverted mapping instead of (satisfies ccl::obscurely-named)
    313315(defun %require-type (arg predsym)
     
    321323    (%kernel-restart $xwrongtype arg (car type-cell))))
    322324
    323 
     325(defun require-structure-type (arg token)
     326  (or(and (= (the fixnum (typecode arg)) target::subtag-struct)
     327           (dolist (x (%svref arg 0))
     328             (declare (optimize (speed 3) (safety 0)))
     329             (when (eq x token) (return arg))))
     330    (%kernel-restart $xwrongtype arg (if (typep token 'class-cell) (class-cell-name token) token))))
    324331
    325332;;; In lieu of an inverted mapping, at least try to find cases involving
Note: See TracChangeset for help on using the changeset viewer.