- (let ((acons (assoc quality-name policy)))
- (unless acons
- (error "Argh! no such optimization quality ~S in~% ~S"
- quality-name policy))
- (let ((result (cdr acons)))
- (unless (typep result '(rational 0 3))
- (error "Argh! bogus optimization quality ~S" acons))
- result)))
-
-;;; Return a list of symbols naming the optimization qualities which
-;;; appear in EXPR.
-;;;
-;;; FIXME: Doing this is slightly flaky (since we can't do it right
-;;; without all the headaches of true code walking), and it shouldn't
-;;; be necessary with modern Python anyway, as long as POLICY-QUALITY
-;;; is properly DEFKNOWNed to have no side-effects so that it can be
-;;; optimized away if unused. So this should probably go away.
-(defun policy-qualities-used-by (expr)
- (let ((result nil))
- (labels ((recurse (x)
- (if (listp x)
- (map nil #'recurse x)
- (when (policy-quality-name-p x)
- (pushnew x result)))))
- (recurse expr)
- result)))
+ (aver (policy-quality-name-p quality-name))
+ (let* ((acons (assoc quality-name policy))
+ (result (or (cdr acons) 1)))
+ result))