Christophe Rhodes | 2 Aug 2003 11:31
Picon
Picon
Favicon

Re: useless type assertion

Alexey Dejneka <adejneka <at> comail.ru> writes:

> Hello,
>
> (defoptimizer (aref derive-type) ((array &rest indices) node)
>   (assert-array-rank array (length indices))
>   ;; If the node continuation has a single use then assert its type.
>   (let ((cont (node-cont node)))
>     (when (= (length (find-uses cont)) 1)
>       (assert-continuation-type cont (extract-upgraded-element-type array)
>                                 (lexenv-policy (node-lexenv node)))))
>   (extract-upgraded-element-type array))
>
> This type assertion is useless - the asserted type is exactly the same
> as derived, so no type check will be done. Before 0.7.3.8 the asserted
> type was (EXTRACT-ELEMENT-TYPE ARRAY). And this is not the best way to
> put type assertions (A-C-T is not idempotent anymore, but it may be
> fixed if needed). I think the same effect is now achieved in some
> other way. Any comments?

Originally (before 0.7.3.8) this was the mechanism for dealing with
declarations of the form (VECTOR CONS).  In a fit of hubris, I removed
it, because I thought it was causing problems -- unfortunately I don't
recall the exact problem it was causing.  I've since reimplemented the
treatment of (VECTOR CONS)ish declarations in
src/compiler/generic/vm-tran.lisp, by wrapping accesses to the array
in THE forms if the element-type and upgraded-element-type differ.

Is that better?  As far as I'm concerned, the assertion in the
optimizer above can be deleted.

Cheers,

Christophe
--

-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

Gmane