[Top][All Lists]

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

[Guile-commits] GNU Guile branch, wip-ffi, updated. release_1-9-7-27-g66

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, wip-ffi, updated. release_1-9-7-27-g663212b
Date: Wed, 27 Jan 2010 20:51:48 +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".

The branch, wip-ffi has been updated
       via  663212bbc66b616cca9ba55d9992e2fb339d8250 (commit)
       via  d27a7811db7947bb9bba536303702c8906219165 (commit)
       via  0515661235e3c17935b918565c70145d7895d37e (commit)
       via  80e22004bd01a719578997f333aa09d907a450e4 (commit)
      from  c612ed59ab3ba92a0b778d30f21c493341160df2 (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 663212bbc66b616cca9ba55d9992e2fb339d8250
Author: Andy Wingo <address@hidden>
Date:   Wed Jan 27 21:52:05 2010 +0100

    statprof bugfixes
    * module/statprof.scm (get-call-data): For closures, get call data by
      the program's objcode.
      (statprof-start, statprof-stop): Fix bug in which all statprof runs
      were enabling the apply hook regardless of the setting of
      #:count-calls?. The result was distorted timings, where procedure
      calls were unfairly penalized.
      (procedure=?): Streamline.

commit d27a7811db7947bb9bba536303702c8906219165
Author: Andy Wingo <address@hidden>
Date:   Wed Jan 27 21:48:06 2010 +0100

    inline calls to variable-bound?
    * module/language/tree-il/compile-glil.scm (*primcall-ops*):
    * module/language/tree-il/primitives.scm
      (*interesting-primitive-names*): Actually resolve calls to
      `variable-bound?' to the opcode that we have for it.

commit 0515661235e3c17935b918565c70145d7895d37e
Author: Andy Wingo <address@hidden>
Date:   Wed Jan 27 21:47:01 2010 +0100

    fix to variable-bound? instruction prototype
    * libguile/vm-i-system.c (variable-bound?): Correctly declare as popping
      one item.

commit 80e22004bd01a719578997f333aa09d907a450e4
Author: Andy Wingo <address@hidden>
Date:   Wed Jan 27 21:45:47 2010 +0100

    remove incremental NEWS entries in preparation for 1.9.8
    * NEWS


Summary of changes:
 NEWS                                     |  209 +-----------------------------
 libguile/vm-i-system.c                   |    2 +-
 module/language/tree-il/compile-glil.scm |    1 +
 module/language/tree-il/primitives.scm   |    1 +
 module/statprof.scm                      |   42 +++----
 5 files changed, 23 insertions(+), 232 deletions(-)

diff --git a/NEWS b/NEWS
index dbe5b11..a0bde90 100644
--- a/NEWS
+++ b/NEWS
@@ -8,214 +8,7 @@ Please send Guile bug reports to address@hidden
 (During the 1.9 series, we will keep an incremental NEWS for the latest
 prerelease, and a full NEWS corresponding to 1.8 -> 2.0.)
-Changes in 1.9.7 (since the 1.9.6 prerelease):
-** Complete support for version information in Guile's `module' form
-Guile modules now have a `#:version' field. They may be loaded by
-version as well. See "R6RS Version References", "General Information
-about Modules", "Using Guile Modules", and "Creating Guile Modules" in
-the manual for more information.
-** Support for renaming bindings on module export
-Wherever Guile accepts a symbol as an argument to specify a binding to
-export, it now also accepts a pair of symbols, indicating that a binding
-should be renamed on export. See "Creating Guile Modules" in the manual
-for more information.
-** Imported statprof, SSAX, and texinfo modules from Guile-Lib
-The statprof statistical profiler, the SSAX XML toolkit, and the texinfo
-toolkit from Guile-Lib have been imported into Guile proper. See
-"Standard Library" in the manual for more details.
-** Function profiling and tracing at the REPL
-The `,profile FORM' REPL meta-command can now be used to statistically
-profile execution of a form, to see which functions are taking the most
-time. See `,help profile' for more information.
-Similarly, `,trace FORM' traces all function applications that occur
-during the execution of `FORM'. See `,help trace' for more information.
-** New debugger
-By default, if an exception is raised at the REPL and not caught by user
-code, Guile will drop the user into a debugger. The user may request a
-backtrace, inspect frames, or continue raising the exception. Full
-documentation is available from within the debugger.
-** New function, `truncated-print', with `format' support
-`(ice-9 pretty-print)' now exports `truncated-print', a printer that
-will ensure that the output stays within a certain width, truncating the
-output in what is hopefully an intelligent manner. See the manual for
-more details.
-There is a new `format' specifier, address@hidden', for doing a truncated
-print (as opposed to `~y', which does a pretty-print). See the `format'
-documentation for more details.
-** Primitive procedures are now VM trampoline procedures
-Guile's old evaluator used to have special cases for applying "gsubrs",
-primitive procedures with specified numbers of required, optional, and
-rest arguments. Now, however, Guile represents gsubrs as normal VM
-procedures, with appropriate bytecode to parse out the correct number of
-arguments, including optional and rest arguments, and then with a
-special bytecode to apply the gsubr.
-This allows primitive procedures to appear on the VM stack, allowing
-them to be accurately counted in profiles. Also they now have more
-debugging information attached to them -- their number of arguments, for
-example. In addition, the VM can completely inline the application
-mechanics, allowing for faster primitive calls.
-However there are some changes on the C level. There is no more
-`scm_tc7_gsubr' or `scm_tcs_subrs' typecode for primitive procedures, as
-they are just VM procedures. Likewise the macros `SCM_GSUBR_TYPE',
-Perhaps more significantly, `scm_c_make_subr',
-`scm_c_make_subr_with_generic', `scm_c_define_subr', and
-`scm_c_define_subr_with_generic'. They all operated on subr typecodes,
-and there are no more subr typecodes. Use the scm_c_make_gsubr family
-Normal users of gsubrs should not be affected, though, as the
-scm_c_make_gsubr family still is the correct way to create primitive
-** SRFI-4 vectors reimplemented in terms of R6RS bytevectors
-Guile now implements SRFI-4 vectors using bytevectors. Often when you
-have a numeric vector, you end up wanting to write its bytes somewhere,
-or have access to the underlying bytes, or read in bytes from somewhere
-else. Bytevectors are very good at this sort of thing. But the SRFI-4
-APIs are nicer to use when doing number-crunching, because they are
-addressed by element and not by byte.
-So as a compromise, Guile allows all bytevector functions to operate on
-numeric vectors. They address the underlying bytes in the native
-endianness, as one would expect.
-Following the same reasoning, that it's just bytes underneath, Guile
-also allows uniform vectors of a given type to be accessed as if they
-were of any type. One can fill a u32vector, and access its elements with
-u8vector-ref. One can use f64vector-ref on bytevectors. It's all the
-same to Guile.
-In this way, uniform numeric vectors may be written to and read from
-input/output ports using the procedures that operate on bytevectors.
-Calls to SRFI-4 accessors (ref and set functions) from Scheme are now
-inlined to the VM instructions for bytevector access.
-See "SRFI-4" in the manual, for more information.
-** Nonstandard SRFI-4 procedures now available from `(srfi srfi-4 gnu)'
-Guile's `(srfi srfi-4)' now only exports those srfi-4 procedures that
-are part of the standard. Complex uniform vectors and the
-`any->FOOvector' family are now available only from `(srfi srfi-4 gnu)'.
-Guile's default environment imports `(srfi srfi-4)', and probably should
-import `(srfi srfi-4 gnu)' as well.
-See "SRFI-4 Extensions" in the manual, for more information.
-** Unicode: String normalization, general categories, title case
-Guile now exports the Unicode string normalization functions
-`string-normalize-nfc', `string-normalize-nfd', `string-normalize-nfkc',
-and `string-normalize-nfkd'. See "String Comparison" in the manual for
-more information. See "Characters" for information on the new
-`char-general-category', and "Character Case Mapping" for
-`char-titlecase', `char-locale-titlecase', and
-** Faster access to the free variables of a closure
-Guile's old garbage collector limited the size of Scheme objects to be 2
-or 4 words. Now with the BDW collector, Guile can allocate
-variable-sized objects, allowing storage of the free variables of a
-closure inline to the closure itself.
-** New primitive `getsid'
-Scheme binding for the `getsid' C library call.
-** Changed invocation mechanics of applicable SMOBs
-Guile's old evaluator used to have special cases for applying SMOB
-objects. Now, with the VM, when Guile sees a SMOB, it looks up a VM
-trampoline procedure for it, and use the normal mechanics to apply the
-trampoline. This simplifies procedure application in the normal,
-non-SMOB case.
-The upshot is that the mechanics used to apply a SMOB are different from
-1.8. Descriptors no longer have `apply_0', `apply_1', `apply_2', and
-`apply_3' functions, and the macros SCM_SMOB_APPLY_0 and friends are now
-deprecated. Just use the scm_call_0 family of procedures.
-** Remove deprecated array C interfaces
-Removed the deprecated array functions `scm_i_arrayp',
-`scm_i_array_ndim', `scm_i_array_mem', `scm_i_array_v',
-`scm_i_array_base', `scm_i_array_dims', and the deprecated macros
-** String encoding errors throw to `encoding-error' instead of `misc-error'
-** Keyword argument errors uniformly throw to `keyword-argument-error'
-** Remove unused snarf macros
-are no more. Use SCM_DEFINE or SCM_PRIMITIVE_GENERIC instead.
-** Add foreign value wrapper
-Guile now has a datatype for aliasing "foreign" values, such as native
-long values. This should be useful for making a proper foreign function
-interface. Interested hackers should see libguile/foreign.h.
-** New functions: `scm_call_n', `scm_c_run_hookn'
-`scm_call_n' applies to apply a function to an array of arguments.
-`scm_c_run_hookn' runs a hook with an array of arguments.
-** Load path change: search in version-specific paths before site paths
-When looking for a module, Guile now searches first in Guile's
-version-specific path (the library path), *then* in the site dir. This
-allows Guile's copy of SSAX to override any Guile-Lib copy the user has
-installed. Also it should cut the number of `stat' system calls by half,
-in the common case.
-** Compile-time warning: -Wunused-toplevel
-Guile can warn about potentially unused top-level (global)
-variables. Pass the -Wunused-toplevel on the `guile-tools compile'
-command line, or add
-`#:warnings '(unused-toplevel)' to your `compile' or `compile-file'
-** New reader options: `square-brackets' and `r6rs-hex-escapes'
-The reader supports a new option (changeable via `read-options'),
-`square-brackets', which instructs it to interpret square brackets as
-parenthesis.  This option is on by default.
-If this causes problems with your code, make sure to report it to
address@hidden so we can change the default.
-When the new `r6rs-hex-escapes' reader option is enabled, the reader
-will recognize string escape sequences as defined in R6RS.
+Changes in 1.9.8 (since the 1.9.7 prerelease):
 ** And of course, the usual collection of bugfixes
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index 1c0aae5..8c280fd 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -322,7 +322,7 @@ VM_DEFINE_INSTRUCTION (26, variable_ref, "variable-ref", 0, 
1, 1)
-VM_DEFINE_INSTRUCTION (27, variable_bound, "variable-bound?", 0, 0, 1)
+VM_DEFINE_INSTRUCTION (27, variable_bound, "variable-bound?", 0, 1, 1)
   if (VARIABLE_BOUNDP (*sp))
     *sp = SCM_BOOL_T;
diff --git a/module/language/tree-il/compile-glil.scm 
index 8a72e93..3bf83a9 100644
--- a/module/language/tree-il/compile-glil.scm
+++ b/module/language/tree-il/compile-glil.scm
@@ -116,6 +116,7 @@
    ((variable-ref . 1) . variable-ref)
    ;; nb, *not* variable-set! -- the args are switched
    ((variable-set . 2) . variable-set)
+   ((variable-bound? . 1) . variable-bound?)
    ((struct? . 1) . struct?)
    ((struct-vtable . 1) . struct-vtable)
    ((struct-ref . 2) . struct-ref)
diff --git a/module/language/tree-il/primitives.scm 
index 83bfc0e..ae4d3b1 100644
--- a/module/language/tree-il/primitives.scm
+++ b/module/language/tree-il/primitives.scm
@@ -56,6 +56,7 @@
     vector-ref vector-set!
     variable-ref variable-set!
+    variable-bound?
     ;; args of variable-set are switched; it needs special help
     struct? struct-vtable make-struct struct-ref struct-set!
diff --git a/module/statprof.scm b/module/statprof.scm
index 5a1315b..2a6cf12 100644
--- a/module/statprof.scm
+++ b/module/statprof.scm
@@ -214,10 +214,14 @@
          (+ accumulated-time 0.0 (- ,stop-time last-start-time))))
 (define (get-call-data proc)
-  (or (hashq-ref procedure-data proc)
-      (let ((call-data (make-call-data proc 0 0 0)))
-        (hashq-set! procedure-data proc call-data)
-        call-data)))
+  (let ((k (if (or (not (program? proc))
+                   (zero? (program-num-free-variables proc)))
+               proc
+               (program-objcode proc))))
+    (or (hashq-ref procedure-data k)
+        (let ((call-data (make-call-data proc 0 0 0)))
+          (hashq-set! procedure-data k call-data)
+          call-data))))
 ;; SIGPROF handler
@@ -351,7 +355,8 @@ than @code{statprof-stop}, @code{#f} otherwise."
                        0 0
                        (car sampling-frequency)
                        (cdr sampling-frequency)))
-        (add-hook! (vm-apply-hook (the-vm)) count-call)
+        (if %count-calls?
+            (add-hook! (vm-apply-hook (the-vm)) count-call))
         (set-vm-trace-level! (the-vm) (1+ (vm-trace-level (the-vm))))
@@ -366,7 +371,8 @@ than @code{statprof-stop}, @code{#f} otherwise."
         (set! gc-time-taken
               (- (cdr (assq 'gc-time-taken (gc-stats))) gc-time-taken))
         (set-vm-trace-level! (the-vm) (1- (vm-trace-level (the-vm))))
-        (remove-hook! (vm-apply-hook (the-vm)) count-call)
+        (if %count-calls?
+            (remove-hook! (vm-apply-hook (the-vm)) count-call))
         ;; I believe that we need to do this before getting the time
         ;; (unless we want to make things even more complicated).
         (set! remaining-prof-time (setitimer ITIMER_PROF 0 0 0 0))
@@ -571,23 +577,13 @@ to @code{statprof-reset} is true."
 (define procedure=?
-  (if (false-if-exception (resolve-interface '(system base compile)))
-      (lambda (a b)
-        (cond
-         ((eq? a b))
-         ((and (program? a) (program? b))
-          (eq? (program-objcode a) (program-objcode b)))
-         (else
-          #f)))
-      (lambda (a b)
-        (cond
-         ((eq? a b))
-         ((and (closure? a) (closure? b)
-               (procedure-source a) (procedure-source b))
-          (and (eq? (procedure-name a) (procedure-name b))
-               (equal? (procedure-source a) (procedure-source b))))
-         (else
-          #f)))))
+  (lambda (a b)
+    (cond
+     ((eq? a b))
+     ((and (program? a) (program? b))
+      (eq? (program-objcode a) (program-objcode b)))
+     (else
+      #f))))
 ;; tree ::= (car n . tree*)

GNU Guile

reply via email to

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