Comment 6 for bug 309125

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote :

The attached patch updates all the test cases, as well as being an up-to-date fix for the code.

However, it really is horrible. One major problem with the patch as it stands is that it's impossible to compile multiple local functions with different policies: in the old world

(labels ((foo (x) (declare (optimize safety) (type fixnum x)) (foo/unsafe x))
       (foo/unsafe (x) (declare (optimize speed (safety 0))) (frob-unsafely x)))
  ...)

would do the "right" (really "wrong") thing, with FOO doing type checking and FOO/UNSAFE being as fast as possible. Now, however, the lambda bindings and typechecking depend on any outer policy, and (crucially) is necessarily the same for all the local functions. We can see the contortions that this causes even in simple cases in the fixups to the debug.impure.lisp tests; complex cases become impossible to express.

This could be mitigated somewhat by deciding that free optimize declarations at the head of a lambda cause the component as a whole to gain those optimize qualities (as they currently do), irrespective of the freeness of the declaration -- while still being careful not to have any arguments evaluated under that policy. This would help for insertion of debug catch tags and step conditions and the like, leaving arg-count checking as the major loser (which might be acceptable).

Argh. (still, at least this bug isn't tagged "easy")