guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-169-g01291


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-169-g0129130
Date: Sat, 15 Oct 2011 15:43:39 +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=0129130439548d4a988af89302e91d61266959f8

The branch, stable-2.0 has been updated
       via  0129130439548d4a988af89302e91d61266959f8 (commit)
       via  43e53d64ca34ef7dd6b7f135114c72c9b39b399e (commit)
       via  7c42e426dcf621af0d375ef27d5144efaf33fef6 (commit)
       via  c7519da3eaef6cf6d862a87e2d050766eb6c4388 (commit)
      from  02f91898deb058768d09c2f8b6278d4ec3ee7252 (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 0129130439548d4a988af89302e91d61266959f8
Author: Ludovic Courtès <address@hidden>
Date:   Sat Oct 15 17:05:23 2011 +0200

    coverage: Add tests for `case-lambda'.
    
    * test-suite/tests/coverage.test
      ("line-execution-counts")["case-lambda"]: New test.
      ("procedure-execution-count")["case-lambda"]: New test.

commit 43e53d64ca34ef7dd6b7f135114c72c9b39b399e
Author: Ludovic Courtès <address@hidden>
Date:   Sat Oct 15 17:34:48 2011 +0200

    doc: Mention the partial evaluator next to `define-inlinable'.
    
    * doc/ref/api-procedures.texi (Inlinable Procedures): Mention inlining
      performed by the partial evaluator.

commit 7c42e426dcf621af0d375ef27d5144efaf33fef6
Author: Ludovic Courtès <address@hidden>
Date:   Sat Oct 15 16:46:29 2011 +0200

    coverage: Add test with `eval'.
    
    * test-suite/tests/coverage.test (test-procedure): New procedure.
      ("procedure-execution-count")["called from eval"]: New test.

commit c7519da3eaef6cf6d862a87e2d050766eb6c4388
Author: Cedric Cellier <address@hidden>
Date:   Sat Oct 15 16:25:21 2011 +0200

    Default to using poll(2) in `fport_input_waiting'.
    
    * libguile/fports.c (fport_input_waiting): Use poll(2) instead of
      select(2) when possible.  Cosmetic changes by Ludovic Courtès.

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

Summary of changes:
 doc/ref/api-procedures.texi    |   20 +++++++++++++++++++
 libguile/fports.c              |   19 ++++++++++++++++-
 test-suite/tests/coverage.test |   41 ++++++++++++++++++++++++++++++++++++++-
 3 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/doc/ref/api-procedures.texi b/doc/ref/api-procedures.texi
index 5c6d380..f1861a5 100644
--- a/doc/ref/api-procedures.texi
+++ b/doc/ref/api-procedures.texi
@@ -801,11 +801,31 @@ setter or an operator struct.
 @node Inlinable Procedures
 @subsection Inlinable Procedures
 
address@hidden inlining
address@hidden procedure inlining
 You can define an @dfn{inlinable procedure} by using
 @code{define-inlinable} instead of @code{define}.  An inlinable
 procedure behaves the same as a regular procedure, but direct calls will
 result in the procedure body being inlined into the caller.
 
address@hidden partial evaluator
+Bear in mind that starting from version 2.0.3, Guile has a partial
+evaluator that can inline the body of inner procedures when deemed
+appropriate:
+
address@hidden
+scheme@@(guile-user)> ,optimize (define (foo x)
+                                 (define (bar) (+ x 3))
+                                 (* (bar) 2))
+$1 = (define foo
+       (lambda (address@hidden address@hidden) (* (+ address@hidden 
address@hidden 3) 2)))
address@hidden example
+
address@hidden
+The partial evaluator does not inline top-level bindings, though, so
+this is a situation where you may find it interesting to use
address@hidden
+
 Procedures defined with @code{define-inlinable} are @emph{always}
 inlined, at all direct call sites.  This eliminates function call
 overhead at the expense of an increase in code size.  Additionally, the
diff --git a/libguile/fports.c b/libguile/fports.c
index 0b84d44..1348b8b 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -49,7 +49,9 @@
 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
 #include <sys/stat.h>
 #endif
-
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
 #include <errno.h>
 #include <sys/types.h>
 
@@ -585,8 +587,21 @@ scm_fdes_to_port (int fdes, char *mode, SCM name)
 static int
 fport_input_waiting (SCM port)
 {
-#ifdef HAVE_SELECT
   int fdes = SCM_FSTREAM (port)->fdes;
+
+  /* `FD_SETSIZE', which is 1024 on GNU systems, effectively limits the
+     highest numerical value of file descriptors that can be monitored.
+     Thus, use poll(2) whenever that is possible.  */
+
+#ifdef HAVE_POLL
+  struct pollfd pollfd = { fdes, POLLIN, 0 };
+
+  if (poll (&pollfd, 1, 0) < 0)
+    scm_syserror ("fport_input_waiting");
+
+  return pollfd.revents & POLLIN ? 1 : 0;
+
+#elif defined(HAVE_SELECT)
   struct timeval timeout;
   SELECT_TYPE read_set;
   SELECT_TYPE write_set;
diff --git a/test-suite/tests/coverage.test b/test-suite/tests/coverage.test
index 6869a3a..4ac4043 100644
--- a/test-suite/tests/coverage.test
+++ b/test-suite/tests/coverage.test
@@ -1,6 +1,6 @@
 ;;;; coverage.test --- Code coverage.    -*- mode: scheme; coding: utf-8; -*-
 ;;;;
-;;;;   Copyright (C) 2010 Free Software Foundation, Inc.
+;;;;   Copyright (C) 2010, 2011 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
@@ -35,6 +35,12 @@
 
 (define %test-vm (make-vm))
 
+(define test-procedure
+  (compile '(lambda (x)
+              (if (> x 2)
+                  (- x 2)
+                  (+ x 2)))))
+
 
 (with-test-prefix "instrumented/executed-lines"
 
@@ -156,6 +162,18 @@
                             (else    #f))))
                       counts))))))
 
+  (pass-if "case-lambda"
+    (let ((proc (code "cl.scm"  "(case-lambda       ;; 0
+                                   ((x)   (+ x 3))  ;; 1
+                                   ((x y) (+ x y))) ;; 2")))
+      (let-values (((data result)
+                    (with-code-coverage %test-vm
+                      (lambda ()
+                        (+ (proc 1) (proc 2 3))))))
+        (let ((counts (line-execution-counts data "cl.scm")))
+          (and (pair? counts)
+               (lset= equal? '((0 . 2) (1 . 1) (2 . 1)) counts))))))
+
   (pass-if "all code on one line"
     ;; There are several proc/IP pairs pointing to this source line, yet the 
hit
     ;; count for the line should be 1.
@@ -179,6 +197,16 @@
              (= 3 result)
              (= (procedure-execution-count data proc) 2)))))
 
+  (pass-if "case-lambda"
+    (let ((proc (code "foo.scm" "(case-lambda ((x) x) ((x y) (+ x y)))")))
+      (let-values (((data result)
+                    (with-code-coverage %test-vm
+                      (lambda ()
+                        (+ (proc 1) (proc 2 3))))))
+        (and (coverage-data? data)
+             (= 6 result)
+             (= (procedure-execution-count data proc) 2)))))
+
   (pass-if "never"
     (let ((proc (code "foo.scm" "(lambda (x y) x)")))
       (let-values (((data result)
@@ -204,7 +232,16 @@
                               (make-pointer (object-address 2)))))))
         (and (coverage-data? data)
              (= (object-address 3) (pointer-address result))
-             (= (procedure-execution-count data proc) 1))))))
+             (= (procedure-execution-count data proc) 1)))))
+
+  (pass-if "called from eval"
+    (let-values (((data result)
+                  (with-code-coverage %test-vm
+                    (lambda ()
+                      (eval '(test-procedure 123) (current-module))))))
+      (and (coverage-data? data)
+           (= (test-procedure 123) result)
+           (= (procedure-execution-count data test-procedure) 1)))))
 
 
 (with-test-prefix "instrumented-source-files"


hooks/post-receive
-- 
GNU Guile



reply via email to

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