-
- Downloads
Implement a specializing CONS class as per issue CONS-TYPE-SPECIFIER:ADD.
The new cons-type which maintains the specialised CAR and CDR types: o Typep recurses, checking the respective car and cdr specialisations; two cons-types are type= if both their car and cdr types are type=. o Subtypep recurses, applying subtypep to the respective car and cdr types. If both sub-tests return true then the cons test returns true with a win only when both sub-tests win. If either sub-test returns false then the cons tests returns false with a win if either of sub-tests win. o Type-intersection is applied to the respective car and cdr types, and wins if both win. o The type-union of two cons-types handles cases for which either the respective car or cdr types are type=, in which case type-union is applied to the other type. This avoid returning an overly general result. o Ctype-of a cons object simply returns (cons * *); and does not attempt to recurse. o The compiler recursively checks the specialised type of the cons-type, which allows it to also use this type information to derive the result type car and cdr. Inline code is currently only generated when natively compiling.
Showing
- code/class.lisp 2 additions, 2 deletionscode/class.lisp
- code/exports.lisp 6 additions, 3 deletionscode/exports.lisp
- code/pred.lisp 5 additions, 1 deletioncode/pred.lisp
- code/type.lisp 75 additions, 2 deletionscode/type.lisp
- compiler/checkgen.lisp 7 additions, 1 deletioncompiler/checkgen.lisp
- compiler/generic/primtype.lisp 3 additions, 3 deletionscompiler/generic/primtype.lisp
- compiler/generic/vm-type.lisp 6 additions, 3 deletionscompiler/generic/vm-type.lisp
- compiler/seqtran.lisp 19 additions, 1 deletioncompiler/seqtran.lisp
- compiler/typetran.lisp 26 additions, 1 deletioncompiler/typetran.lisp
Loading
Please register or sign in to comment