Steel Bank Common Lisp

TYPEP transform doesn't handle the third argument

Reported by Nikodemus Siivola on 2008-12-19
2
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

The compiler's optimizers for TYPEP have not been informed
about the third argument; consequently, they will not transform
calls of the form (TYPEP 1 'INTEGER NIL), even though this is
just as optimizeable as (TYPEP 1 'INTEGER).

Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
Karol Swietlicki (abcdef123456) wrote :

This definition of the typep transform works for me:

(deftransform typep ((object type &optional env) * * :node node)
  (unless (constant-lvar-p type)
    (give-up-ir1-transform "can't open-code test of non-constant type"))
  (unless (and (constant-lvar-p env) (null (lvar-value env)))
    (give-up-ir1-transform "environment argument present and not null"))
  (multiple-value-bind (expansion fail-p)
      (source-transform-typep 'object (lvar-value type))
    (if fail-p
        (abort-ir1-transform)
        expansion)))

Builds and runs tests fine. Efficient code both with and without the optional argument.

Karol Swietlicki

 status fixcommitted

In SBCL 1.0.36.8. Thanks for the fix!

Changed in sbcl:
status: Confirmed → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers