[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/01: Add closure effects

From: Andy Wingo
Subject: [Guile-commits] 01/01: Add closure effects
Date: Mon, 27 Jul 2015 13:23:03 +0000

wingo pushed a commit to branch master
in repository guile.

commit 48412395c6501d0f4f98494cfe20c1c18b14d7a6
Author: Andy Wingo <address@hidden>
Date:   Mon Jul 27 15:11:09 2015 +0200

    Add closure effects
    * module/language/cps/effects-analysis.scm: Add closure effects, to
      enable hoisting/CSE of free-ref/free-set!.
 module/language/cps/effects-analysis.scm |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/module/language/cps/effects-analysis.scm 
index af1a529..778855d 100644
--- a/module/language/cps/effects-analysis.scm
+++ b/module/language/cps/effects-analysis.scm
@@ -63,6 +63,7 @@
+            &closure
@@ -180,7 +181,10 @@
   ;; Indicates that an expression depends on the contents of a
   ;; bytevector.  We cannot be more precise, as bytevectors may alias
   ;; other bytevectors.
-  &bytevector)
+  &bytevector
+  ;; Indicates a dependency on a free variable of a closure.
+  &closure)
 (define-inlinable (&field kind field)
   (ash (logior (ash field &memory-kind-bits) kind) &effect-kind-bits))
@@ -373,6 +377,17 @@ is or might be a read or a write to the same location as 
   ((bv-f32-set! bv n x)            (&write-object &bytevector) &type-check)
   ((bv-f64-set! bv n x)            (&write-object &bytevector) &type-check))
+;; Closures.
+(define (closure-field n constants)
+  (indexed-field &closure n constants))
+(define (read-closure-field n constants)
+  (logior &read (closure-field n constants)))
+(define (write-closure-field n constants)
+  (logior &write (closure-field n constants)))
+(define-primitive-effects* constants
+  ((free-ref closure idx)          (read-closure-field idx constants))
+  ((free-set! closure idx val)     (write-closure-field idx constants)))
 ;; Modules.
   ((current-module)                (&read-object &module))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]