guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. v2.1.0-460-gc30edbb


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. v2.1.0-460-gc30edbb
Date: Tue, 26 Nov 2013 09:49:21 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=c30edbbd5b6cfeeca6b8a66578107df17ec96a51

The branch, master has been updated
       via  c30edbbd5b6cfeeca6b8a66578107df17ec96a51 (commit)
       via  310da5e1efe70503e52f7a13f709775c319e6b7f (commit)
       via  7338a49fa19311adc0eb00d6752235d6af8b3751 (commit)
      from  22d425ec551f265a8c700d224c3d0953a98b14bf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c30edbbd5b6cfeeca6b8a66578107df17ec96a51
Author: Andy Wingo <address@hidden>
Date:   Tue Nov 26 10:47:29 2013 +0100

    Build psyntax-pp serially after eval.go.
    
    * module/Makefile.am: Arrange to build psyntax-pp.go in serial mode,
      after eval.go.  Before the expander is compiled, expanding all the
      Scheme files dominates compile-time, even for larger files like
      psyntax-pp.scm.  If we compile psyntax in parallel with other files,
      it could be one of the other files finishes first, leading to two
      consecutive compiles that have to use an uncompiled psyntax expander.
      Ordering the compilation minimizes total real and user time, at least
      locally on a 4-core machine.
    
      Also take the opportunity to shuffle compile order for the rest of the
      Scheme files, to build parts of the RTL compiler early.

commit 310da5e1efe70503e52f7a13f709775c319e6b7f
Author: Andy Wingo <address@hidden>
Date:   Mon Nov 25 20:07:27 2013 +0100

    Contification converges more quickly
    
    * module/language/cps/contification.scm (compute-contification):
      Converge more quickly by using the information we compute within a
      compute-contification pass.

commit 7338a49fa19311adc0eb00d6752235d6af8b3751
Author: Andy Wingo <address@hidden>
Date:   Sun Nov 24 13:59:18 2013 +0100

    Compute-contification also visits body
    
    * module/language/cps/contification.scm (compute-contification): If we
      decide to contify, don't forget to visit the body.  Should make
      contification converge faster.

-----------------------------------------------------------------------

Summary of changes:
 module/Makefile.am                    |   35 +++++++++--------
 module/language/cps/contification.scm |   66 ++++++++++++++++++++++++++------
 2 files changed, 71 insertions(+), 30 deletions(-)

diff --git a/module/Makefile.am b/module/Makefile.am
index b5a31f2..64ded63 100644
--- a/module/Makefile.am
+++ b/module/Makefile.am
@@ -24,13 +24,16 @@ include $(top_srcdir)/am/guilec
 # We're at the root of the module hierarchy.
 modpath =
 
-# Build eval.go first.
-$(GOBJECTS): ice-9/eval.go
-CLEANFILES += ice-9/eval.go
-nobase_mod_DATA += ice-9/eval.scm
-nobase_ccache_DATA += ice-9/eval.go
-EXTRA_DIST += ice-9/eval.scm
-ETAGS_ARGS += ice-9/eval.scm
+# Build eval.go first.  Then build psyntax-pp.go, as the expander has to
+# run on every loaded scheme file.  It doesn't pay off at compile-time
+# to interpret the expander in parallel!
+$(GOBJECTS): ice-9/psyntax-pp.go
+ice-9/psyntax-pp.go: ice-9/eval.go
+CLEANFILES += ice-9/eval.go ice-9/psyntax-pp.go
+nobase_mod_DATA += ice-9/eval.scm ice-9/psyntax-pp.scm
+nobase_ccache_DATA += ice-9/eval.go ice-9/psyntax-pp.go
+EXTRA_DIST += ice-9/eval.scm ice-9/psyntax-pp.scm
+ETAGS_ARGS += ice-9/eval.scm ice-9/psyntax-pp.scm
 
 VM_TARGETS := system/vm/assembler.go system/vm/disassembler.go
 $(VM_TARGETS): $(top_builddir)/libguile/vm-operations.h
@@ -39,15 +42,17 @@ ice-9/boot-9.go: ice-9/boot-9.scm ice-9/quasisyntax.scm 
ice-9/r6rs-libraries.scm
 ice-9/match.go: ice-9/match.scm ice-9/match.upstream.scm
 
 # We can compile these in any order, but it's fastest if we compile
-# psyntax and boot-9 first, then the compiler itself, then the rest of
-# the code.
+# boot-9 first, then the compiler itself, then the rest of the code.
 SOURCES =                                      \
-  ice-9/psyntax-pp.scm                         \
   ice-9/boot-9.scm                             \
-  ice-9/vlist.scm                               \
-  srfi/srfi-1.scm                               \
   language/tree-il/peval.scm                    \
   language/tree-il/cse.scm                      \
+  system/vm/elf.scm                            \
+  ice-9/vlist.scm                               \
+  srfi/srfi-1.scm                               \
+  system/vm/linker.scm                         \
+  system/vm/dwarf.scm                          \
+  system/vm/assembler.scm                      \
                                                \
   language/tree-il.scm                         \
   $(TREE_IL_LANG_SOURCES)                      \
@@ -58,10 +63,10 @@ SOURCES =                                   \
   $(SYSTEM_BASE_SOURCES)                       \
                                                \
   $(ICE_9_SOURCES)                             \
+  $(SYSTEM_SOURCES)                            \
   $(SRFI_SOURCES)                              \
   $(RNRS_SOURCES)                              \
   $(OOP_SOURCES)                               \
-  $(SYSTEM_SOURCES)                            \
   $(SCRIPTS_SOURCES)                           \
   $(ECMASCRIPT_LANG_SOURCES)                   \
   $(ELISP_LANG_SOURCES)                                \
@@ -351,16 +356,12 @@ OOP_SOURCES = \
 SYSTEM_SOURCES =                               \
   system/vm/inspect.scm                                \
   system/vm/coverage.scm                       \
-  system/vm/dwarf.scm                          \
-  system/vm/elf.scm                            \
-  system/vm/linker.scm                         \
   system/vm/frame.scm                          \
   system/vm/loader.scm                         \
   system/vm/program.scm                                \
   system/vm/trace.scm                          \
   system/vm/traps.scm                          \
   system/vm/trap-state.scm                     \
-  system/vm/assembler.scm                      \
   system/vm/debug.scm                          \
   system/vm/disassembler.scm                   \
   system/vm/vm.scm                             \
diff --git a/module/language/cps/contification.scm 
b/module/language/cps/contification.scm
index 7a9252e..7d1f651 100644
--- a/module/language/cps/contification.scm
+++ b/module/language/cps/contification.scm
@@ -41,6 +41,7 @@
 (define (compute-contification fun)
   (let* ((dfg (compute-dfg fun))
          (cont-table (dfg-cont-table dfg))
+         (scope-table (make-hash-table))
          (call-substs '())
          (cont-substs '())
          (fun-elisions '())
@@ -52,9 +53,17 @@
     (define (elide-function! k cont)
       (set! fun-elisions (acons k cont fun-elisions)))
     (define (splice-conts! scope conts)
+      (for-each (match-lambda
+                 (($ $cont k) (hashq-set! scope-table k scope)))
+                conts)
       (hashq-set! cont-splices scope
                   (append conts (hashq-ref cont-splices scope '()))))
 
+    (define (lookup-return-cont k)
+      (match (assq-ref cont-substs k)
+        (#f k)
+        (k (lookup-return-cont k))))
+
     ;; If K is a continuation that binds one variable, and it has only
     ;; one predecessor, return that variable.
     (define (bound-symbol k)
@@ -101,7 +110,9 @@
         (match (find-call (lookup-cont use cont-table))
           (($ $continue k src ($ $call proc* args))
            (and (eq? proc proc*) (not (memq proc args)) (applicable? proc args)
-                k))
+                ;; Converge more quickly by resolving already-contified
+                ;; call targets.
+                (lookup-return-cont k)))
           (_ #f)))
 
       ;; If this set of functions is always called with one
@@ -132,23 +143,49 @@
       ;; defined, whose free variables are a superset of the free
       ;; variables of the functions.
       ;;
+      ;; There is some slight trickiness here.  Call-target already uses
+      ;; the information we compute within this pass.  Previous
+      ;; contifications may cause functions to be contified not at their
+      ;; point of definition but at their point of non-recursive use.
+      ;; That will cause the scope nesting to change.  (It may
+      ;; effectively push a function deeper down the tree -- the second
+      ;; case above, a call within the letrec body.)  What if we contify
+      ;; to the tail of a previously contified function?  We have to
+      ;; track what the new scope tree will be when asking whether K
+      ;; will be bound in TERM-K's scope, not the scope tree that
+      ;; existed when we started the pass.
+      ;;
       ;; FIXME: Does this choose the right scope for contified let-bound
       ;; functions?
       (define (find-contification-scope k)
-        (if (continuation-bound-in? k term-k dfg)
-            term-k
-            (let ((scope (lookup-block-scope k dfg)))
-              (match (lookup-cont scope cont-table)
-                ;; The common continuation was the tail of some function
-                ;; inside the letrec body.  If that function has just
-                ;; one clause, contify into that clause.  Otherwise
-                ;; bail.
+        (define (scope-contains? scope k)
+          (let ((k-scope (or (hashq-ref scope-table k)
+                             (let ((k-scope (lookup-block-scope k dfg)))
+                               (hashq-set! scope-table k k-scope)
+                               k-scope))))
+            (or (eq? scope k-scope)
+                (and k-scope (scope-contains? scope k-scope)))))
+
+        ;; Find the scope of K.
+        (define (continuation-scope k)
+          (or (hashq-ref scope-table k)
+              (let ((scope (lookup-block-scope k dfg)))
+                (hashq-set! scope-table k scope)
+                scope)))
+
+        (let ((k-scope (continuation-scope k)))
+          (if (scope-contains? k-scope term-k)
+              term-k
+              (match (lookup-cont k-scope cont-table)
                 (($ $kentry self tail clauses)
+                 ;; K is the tail of some function.  If that function
+                 ;; has just one clause, return that clause.  Otherwise
+                 ;; bail.
                  (match clauses
                    ((($ $cont _ ($ $kclause arity ($ $cont kargs))))
                     kargs)
                    (_ #f)))
-                (_ scope)))))
+                (_ k-scope)))))
 
       ;; We are going to contify.  Mark all SYMs for replacement in
       ;; calls, and mark the tail continuations for replacement by K.
@@ -219,8 +256,9 @@
                            (($ $cont _ ($ $kclause arity body))
                             ...))))
                   ...)
-                 (unless (contify-funs term-k sym self tail-k arity body)
-                   (for-each visit-fun fun)))))))
+                 (if (contify-funs term-k sym self tail-k arity body)
+                     (for-each (cut for-each visit-cont <>) body)
+                     (for-each visit-fun fun)))))))
          (visit-term body term-k)
          (for-each visit-component
                    (split-components (map list names syms funs))))
@@ -234,7 +272,9 @@
             (if (and=> (bound-symbol k)
                        (lambda (sym)
                          (contify-fun term-k sym self tail-k arity body)))
-                (elide-function! k (lookup-cont k cont-table))
+                (begin
+                  (elide-function! k (lookup-cont k cont-table))
+                  (for-each visit-cont body))
                 (visit-fun exp)))
            (_ #t)))))
 


hooks/post-receive
-- 
GNU Guile



reply via email to

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