more inlining in effects.scm
authorAndy Wingo <wingo@pobox.com>
Sun, 15 Apr 2012 20:41:05 +0000 (13:41 -0700)
committerAndy Wingo <wingo@pobox.com>
Mon, 23 Apr 2012 19:52:24 +0000 (21:52 +0200)
* module/language/tree-il/effects.scm (define-effects)
  (&no-effects, &all-effects-but-bailout):
  (cause, &depends-on, &causes, depends-on-effects?)
  (causes-effects?, effects-commute?): Add ham-fisted inlining.

module/language/tree-il/effects.scm

index 36436a7..67bb8b7 100644 (file)
@@ -62,9 +62,9 @@
       ((_ all name ...)
        (with-syntax (((n ...) (iota (length #'(name ...)))))
          #'(begin
-             (define name (ash 1 (* n 2)))
+             (define-syntax name (identifier-syntax (ash 1 (* n 2))))
              ...
-             (define all (logior name ...))))))))
+             (define-syntax all (identifier-syntax (logior name ...)))))))))
 
 ;; Here we define the effects, indicating the meaning of the effect.
 ;;
   ;; subexpression (+ x y).
   &type-check)
 
-(define &no-effects 0)
+(define-syntax &no-effects (identifier-syntax 0))
 
 ;; Definite bailout is an oddball effect.  Since it indicates that an
 ;; expression definitely causes bailout, it's not in the set of effects
 ;; cause an outer expression to include &definite-bailout in its
 ;; effects.  For that reason we have to treat it specially.
 ;;
-(define &all-effects-but-bailout
-  (logand &all-effects (lognot &definite-bailout)))
+(define-syntax &all-effects-but-bailout
+  (identifier-syntax
+   (logand &all-effects (lognot &definite-bailout))))
 
-(define (cause effect)
+(define-inlinable (cause effect)
   (ash effect 1))
 
-(define (&depends-on a)
+(define-inlinable (&depends-on a)
   (logand a &all-effects))
-(define (&causes a)
+(define-inlinable (&causes a)
   (logand a (cause &all-effects)))
 
 (define (exclude-effects effects exclude)
 (define (constant? effects)
   (zero? effects))
 
-(define (depends-on-effects? x effects)
+(define-inlinable (depends-on-effects? x effects)
   (not (zero? (logand (&depends-on x) effects))))
-(define (causes-effects? x effects)
+(define-inlinable (causes-effects? x effects)
   (not (zero? (logand (&causes x) (cause effects)))))
 
-(define (effects-commute? a b)
+(define-inlinable (effects-commute? a b)
   (and (not (causes-effects? a (&depends-on b)))
        (not (causes-effects? b (&depends-on a)))))