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-84-gd5dbe0c


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. v2.1.0-84-gd5dbe0c
Date: Sat, 03 Mar 2012 20:48:00 +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=d5dbe0c1d5c0d53a652285ca565fa6c30a668f7f

The branch, master has been updated
       via  d5dbe0c1d5c0d53a652285ca565fa6c30a668f7f (commit)
       via  deaae8e9d7cbd0f8fc794fab5f4b4923d432ced0 (commit)
      from  9ede013f68361df731cadc62844be11d1bfea7e5 (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 d5dbe0c1d5c0d53a652285ca565fa6c30a668f7f
Author: Andy Wingo <address@hidden>
Date:   Sat Mar 3 21:46:38 2012 +0100

    optimize dynamic-wind when we know winders are thunks
    
    * libguile/vm-i-system.c (wind):
    * module/language/tree-il/compile-glil.scm (flatten-lambda-case):
      Instead of making `wind' call `scm_thunk_p' on the winder and unwinder
      at runtime, make it the responsibility of the compiler to emit code to
      call thunk? and error, but only if the compiler cannot prove them to
      be thunks.
    
    * libguile/vm-engine.c (vm_engine): Remove a now-unused error block.

commit deaae8e9d7cbd0f8fc794fab5f4b4923d432ced0
Author: Andy Wingo <address@hidden>
Date:   Sat Mar 3 21:06:49 2012 +0100

    remove out-of-date comment
    
    * libguile/dynwind.c (scm_dynwind_end): Remove out-of-date comment.

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

Summary of changes:
 libguile/dynwind.c                       |    1 -
 libguile/vm-engine.c                     |    8 +-------
 libguile/vm-i-system.c                   |   14 +++-----------
 module/language/tree-il/compile-glil.scm |   24 ++++++++++++++++++++++++
 4 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/libguile/dynwind.c b/libguile/dynwind.c
index 0579186..4a0b0dd 100644
--- a/libguile/dynwind.c
+++ b/libguile/dynwind.c
@@ -66,7 +66,6 @@ scm_dynwind_begin (scm_t_dynwind_flags flags)
   scm_dynstack_push_frame (&thread->dynstack, flags);
 }
 
-/* FIXME -- breaking abstractions */
 void
 scm_dynwind_end (void)
 {
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index c90458d..8bc37a9 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -251,12 +251,6 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
     /* shouldn't get here */
     goto vm_error;
 
-  vm_error_not_a_thunk:
-    SYNC_ALL ();
-    scm_wrong_type_arg_msg ("dynamic-wind", 1, finish_args, "thunk");
-    /* shouldn't get here */
-    goto vm_error;
-
   vm_error_no_values:
     err_msg  = scm_from_latin1_string ("Zero values returned to single-valued 
continuation");
     finish_args = SCM_EOL;
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index f30ed9d..2fce834 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -1616,17 +1616,9 @@ VM_DEFINE_INSTRUCTION (86, wind, "wind", 0, 2, 0)
   SYNC_REGISTER ();
   /* Push wind and unwind procedures onto the dynamic stack. Note that neither
      are actually called; the compiler should emit calls to wind and unwind for
-     the normal dynamic-wind control flow. */
-  if (SCM_UNLIKELY (scm_is_false (scm_thunk_p (wind))))
-    {
-      finish_args = wind;
-      goto vm_error_not_a_thunk;
-    }
-  if (SCM_UNLIKELY (scm_is_false (scm_thunk_p (unwind))))
-    {
-      finish_args = unwind;
-      goto vm_error_not_a_thunk;
-    }
+     the normal dynamic-wind control flow.  Also note that the compiler
+     should have inserted checks that they wind and unwind procs are
+     thunks, if it could not prove that to be the case.  */
   scm_dynstack_push_dynwind (&current_thread->dynstack, wind, unwind);
   NEXT;
 }
diff --git a/module/language/tree-il/compile-glil.scm 
b/module/language/tree-il/compile-glil.scm
index 81defa1..4b94462 100644
--- a/module/language/tree-il/compile-glil.scm
+++ b/module/language/tree-il/compile-glil.scm
@@ -921,7 +921,31 @@
       ;; then proceed with returning or dropping or what-have-you, interacting
       ;; with RA and MVRA. What have you, I say.
       ((<dynwind> src winder pre body post unwinder)
+       (define (thunk? x)
+         (and (lambda? x)
+              (null? (lambda-case-gensyms (lambda-body x)))))
+       (define (make-wrong-type-arg x)
+         (make-primcall src 'scm-error
+                        (list
+                         (make-const #f 'wrong-type-arg)
+                         (make-const #f "dynamic-wind")
+                         (make-const #f "Wrong type (expecting thunk): ~S")
+                         (make-primcall #f 'list (list x))
+                         (make-primcall #f 'list (list x)))))
+       (define (emit-thunk-check x)
+         (comp-drop (make-conditional
+                     src
+                     (make-primcall src 'thunk? (list x))
+                     (make-void #f)
+                     (make-wrong-type-arg x))))
+
+       ;; We know at this point that `winder' and `unwinder' are
+       ;; constant expressions and can be duplicated.
+       (if (not (thunk? winder))
+           (emit-thunk-check winder))
        (comp-push winder)
+       (if (not (thunk? unwinder))
+           (emit-thunk-check unwinder))
        (comp-push unwinder)
        (comp-drop pre)
        (emit-code #f (make-glil-call 'wind 2))


hooks/post-receive
-- 
GNU Guile



reply via email to

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