[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, elisp, updated. release_1-9-1-28-g5d22
From: |
Daniel Kraft |
Subject: |
[Guile-commits] GNU Guile branch, elisp, updated. release_1-9-1-28-g5d221ca |
Date: |
Tue, 21 Jul 2009 14:47:12 +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=5d221ca375e5bd762b0b8fb16b22118d2a077de9
The branch, elisp has been updated
via 5d221ca375e5bd762b0b8fb16b22118d2a077de9 (commit)
via 0c0b09e0e1960232370ac5d33017905aa7486d3e (commit)
via 3b0b6bc1dd2eb24405ad8e75889df0874f879892 (commit)
via 10331eac7e3c7b802718af515d17e50dca525b3f (commit)
via ec99fe8ecb412e49e8e981246eb62ca46b32754b (commit)
via 5bd047cefa9ffcf17751dbeda1fa56ae56f45199 (commit)
via b67cb2864e0de124bd7c4f9b0fda442329e09f3f (commit)
via e1203ea00f033954e385a0f2f6aa8b886778dab1 (commit)
via a823e7272e7e2800491704a342c6853bc5d95d4e (commit)
via 07f99e1c6a74017f41bdc1355cf8645392f433c6 (commit)
via 99c7d3caf622b8ed355562359b445396dee1532c (commit)
via 9e1a18db9fd34a6156007c7db563f46095989b62 (commit)
via ba4c43dc3b6c4bb3b65883283e00228df6029371 (commit)
via 19fef497f09c7ddd9e91e3da2e86bcdfb7f303d0 (commit)
via ef283979cf2fe9aca3854da0aae2cf7db4d86418 (commit)
via ad47e35939ef86a031af68d5875de4180f2517cb (commit)
via cec1d4e33f1485985df9877330729c964f38cc2f (commit)
from fb66a47a8ed080dc52f043dbbc3587e7101358cb (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 5d221ca375e5bd762b0b8fb16b22118d2a077de9
Author: Daniel Kraft <address@hidden>
Date: Tue Jul 21 16:45:10 2009 +0200
Don't ensure fluids all over the place but scan for variables needed and
ensure just before the compiled code all those.
* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement it here, pass
bindings all around the compilation.
* module/language/elisp/bindings.scm: New module with symbol-tracking
abilities needed for this.
commit 0c0b09e0e1960232370ac5d33017905aa7486d3e
Merge: fb66a47a8ed080dc52f043dbbc3587e7101358cb
3b0b6bc1dd2eb24405ad8e75889df0874f879892
Author: Daniel Kraft <address@hidden>
Date: Tue Jul 21 11:59:14 2009 +0200
Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp
-----------------------------------------------------------------------
Summary of changes:
GUILE-VERSION | 2 +-
NEWS | 89 +++++++++-
lib/Makefile.am | 2 +-
libguile/gen-scmconfig.c | 15 --
libguile/instructions.c | 17 +-
libguile/instructions.h | 1 -
libguile/objcodes.c | 34 ++++-
libguile/objcodes.h | 4 +-
libguile/vm-i-scheme.c | 14 +-
libguile/vm.c | 34 +++-
m4/gnulib-cache.m4 | 3 +-
module/language/assembly/compile-bytecode.scm | 3 +
module/language/elisp/README | 5 +-
module/language/elisp/bindings.scm | 74 ++++++++
module/language/elisp/compile-tree-il.scm | 232 +++++++++++++------------
module/system/base/compile.scm | 27 ++--
module/system/base/syntax.scm | 27 ++--
module/system/repl/common.scm | 27 ++--
module/system/repl/describe.scm | 27 ++--
module/system/vm/instruction.scm | 27 ++--
module/system/vm/objcode.scm | 27 ++--
module/system/vm/profile.scm | 27 ++--
module/system/vm/program.scm | 21 +--
module/system/vm/trace.scm | 27 ++--
testsuite/run-vm-tests.scm | 7 +-
25 files changed, 479 insertions(+), 294 deletions(-)
create mode 100644 module/language/elisp/bindings.scm
diff --git a/GUILE-VERSION b/GUILE-VERSION
index c23f8f6..fa96ed9 100644
--- a/GUILE-VERSION
+++ b/GUILE-VERSION
@@ -2,7 +2,7 @@
GUILE_MAJOR_VERSION=1
GUILE_MINOR_VERSION=9
-GUILE_MICRO_VERSION=0
+GUILE_MICRO_VERSION=1
GUILE_EFFECTIVE_VERSION=${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}
GUILE_VERSION=${GUILE_EFFECTIVE_VERSION}.${GUILE_MICRO_VERSION}
diff --git a/NEWS b/NEWS
index 36d36cb..445bb1c 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,78 @@ See the end for copying conditions.
Please send Guile bug reports to address@hidden
-Changes in 1.9.0 (changes since the 1.8.x series):
+(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.1 (since the 1.9.0 prerelease):
+
+** `scm_set_port_seek' and `scm_set_port_truncate' use the `scm_t_off' type
+
+Previously they would use the `off_t' type, which is fragile since its
+definition depends on the application's value for `_FILE_OFFSET_BITS'.
+
+** Automatically compiled files will be placed in ~/.cache, not
~/.guile-ccache.
+
+Actually, they will be placed in $XDG_CACHE_HOME/guile/ccache/1.9,
+defaulting to XDG_CACHE_HOME=~/.cache. Users may remove their
+~/.guile-ccache directories.
+
+** New language: Brainfuck.
+
+Brainfuck is a toy language that closely models Turing machines. Guile's
+brainfuck compiler is meant to be an example of implementing other
+languages. See the manual for details, or
+http://en.wikipedia.org/wiki/Brainfuck for more information about the
+Brainfuck language itself.
+
+** A number of Scheme files were corrected to be LGPLv3+.
+
+Some Scheme files imported for the compiler were erroneously labeled as
+being LGPLv2+ or GPLv2+. This oversight has been fixed.
+
+** Bytevectors may now be accessed with a C-friendly API.
+
+New functions: `scm_is_bytevector ()', `scm_c_bytevector_length ()',
+`scm_c_bytevector_length ()', and `scm_c_bytevector_set_x ()'. See the
+manual for details.
+
+** Bytevectors are now accessible using the generalized-vector API.
+
+As a side effect, this change allows compilation of literal bytevectors
+(`#vu8(...)').
+
+** Meta-commands to the REPL work better with strange languages.
+
+Specifically, meta-commands that take expressions as arguments will use
+the current language's reader to read those expressions, which may span
+multiple lines, with readline integration if the user has that enabled.
+
+** The object code file format has changed.
+
+The objcode loader will complain about a "bad header cookie" if it
+happens to find an old file. The workaround for that is currently to
+find all stale .go files and remove them. This is likely to affect users
+who have checked out Guile's git repository, not those that build from
+tarballs.
+
+** Vector access has been sped up considerably.
+
+Guile's virtual machine now has vector and bytevector operations. Using
+Guile to process large amounts of data is now easier. This is because
+`vector-ref' and `vector-set!' now have fast opcodes. In addition, there
+are opcodes for `ref' and `set' operations on bytevectors for everything
+from 8-bit integers to 64-bit floating-point values.
+
+In the next release, we hope to extend this speedup to other kinds of
+uniform vectors.
+
+** The `long_long' C type, deprecated in 1.8, has been removed.
+
+** And of course, the usual collection of bugfixes.
+
+Interested users should see the ChangeLog for more information.
+
+Changes in 1.9.x (since the 1.8.x series):
* New modules (see the manual for details)
@@ -66,9 +137,9 @@ modification times; if the .scm or .go files are moved after
installation, care should be taken to preserve their original
timestamps.
-Autocompiled files will be stored in the user's ~/.guile-ccache
-directory, which will be created if needed. This is analogous to
-ccache's behavior for C files.
+Autocompiled files will be stored in the $XDG_CACHE_HOME/guile/ccache
+directory, where $XDG_CACHE_HOME defaults to ~/.cache. This directory
+will be created if needed.
To inhibit autocompilation, set the GUILE_AUTO_COMPILE environment
variable to 0, or pass --no-autocompile on the Guile command line.
@@ -123,6 +194,14 @@ ECMAScript. The goal is to support all of version 3.1 of
the standard,
but not all of the libraries are there yet. This support is not yet
documented; ask on the mailing list if you are interested.
+** New language: Brainfuck
+
+Brainfuck is a toy language that closely models Turing machines. Guile's
+brainfuck compiler is meant to be an example of implementing other
+languages. See the manual for details, or
+http://en.wikipedia.org/wiki/Brainfuck for more information about the
+Brainfuck language itself.
+
** Defmacros may now have docstrings.
Indeed, any macro may have a docstring. `object-documentation' from
@@ -516,6 +595,8 @@ This procedure corresponds to Scheme's
`module-public-interface'.
Previously they would use the `off_t' type, which is fragile since its
definition depends on the application's value for `_FILE_OFFSET_BITS'.
+** The `long_long' C type, deprecated in 1.8, has been removed
+
* Changes to the distribution
** Guile's license is now LGPLv3+
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 197320e..424e590 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl
--libtool --macro-prefix=gl --no-vc-files alloca-opt autobuild byteswap
canonicalize-lgpl count-one-bits environ extensions flock fpieee full-read
full-write havelib iconv_open-utf lib-symbol-visibility libunistring putenv
stdlib strcase strftime striconveh string vsnprintf
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl
--libtool --macro-prefix=gl --no-vc-files alloca-opt autobuild byteswap
canonicalize-lgpl count-one-bits environ extensions flock fpieee full-read
full-write havelib iconv_open-utf lib-symbol-visibility libunistring putenv
stdlib strcase strftime striconveh string verify vsnprintf
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index 98fcc88..d569638 100644
--- a/libguile/gen-scmconfig.c
+++ b/libguile/gen-scmconfig.c
@@ -279,21 +279,6 @@ main (int argc, char *argv[])
pf ("#define SCM_SIZEOF_LONG_LONG %d\n", SIZEOF_LONG_LONG);
pf ("#define SCM_SIZEOF_UNSIGNED_LONG_LONG %d\n", SIZEOF_UNSIGNED_LONG_LONG);
- pf("\n");
- pf("/* handling for the deprecated long_long and ulong_long types */\n");
- pf("/* If anything suitable is available, it'll be defined here. */\n");
- pf("#if (SCM_ENABLE_DEPRECATED == 1)\n");
- if (SIZEOF_LONG_LONG != 0)
- pf ("typedef long long long_long;\n");
- else if (SIZEOF___INT64 != 0)
- pf ("typedef __int64 long_long;\n");
-
- if (SIZEOF_UNSIGNED_LONG_LONG != 0)
- pf ("typedef unsigned long long ulong_long;\n");
- else if (SIZEOF_UNSIGNED___INT64 != 0)
- pf ("typedef unsigned __int64 ulong_long;\n");
- pf("#endif /* SCM_ENABLE_DEPRECATED == 1 */\n");
-
pf ("\n");
pf ("/* These are always defined. */\n");
pf ("typedef %s scm_t_int8;\n", SCM_I_GSC_T_INT8);
diff --git a/libguile/instructions.c b/libguile/instructions.c
index 8e6d169..04180e5 100644
--- a/libguile/instructions.c
+++ b/libguile/instructions.c
@@ -53,7 +53,7 @@ fetch_instruction_table ()
if (SCM_UNLIKELY (!table))
{
- size_t bytes = scm_op_last * sizeof(struct scm_instruction);
+ size_t bytes = SCM_VM_NUM_INSTRUCTIONS * sizeof(struct scm_instruction);
int i;
table = malloc (bytes);
memset (table, 0, bytes);
@@ -63,11 +63,12 @@ fetch_instruction_table ()
#include <libguile/vm-i-scheme.i>
#include <libguile/vm-i-loader.i>
#undef VM_INSTRUCTION_TO_TABLE
- for (i = 0; i < scm_op_last; i++)
+ for (i = 0; i < SCM_VM_NUM_INSTRUCTIONS; i++)
{
table[i].opcode = i;
if (table[i].name)
- table[i].symname = scm_from_locale_symbol (table[i].name);
+ table[i].symname =
+ scm_permanent_object (scm_from_locale_symbol (table[i].name));
else
table[i].symname = SCM_BOOL_F;
}
@@ -85,12 +86,12 @@ scm_lookup_instruction_by_name (SCM name)
if (SCM_UNLIKELY (SCM_FALSEP (instructions_by_name)))
{
int i;
- instructions_by_name = scm_make_hash_table (SCM_I_MAKINUM (scm_op_last));
- for (i = 0; i < scm_op_last; i++)
+ instructions_by_name = scm_permanent_object
+ (scm_make_hash_table (SCM_I_MAKINUM (SCM_VM_NUM_INSTRUCTIONS)));
+ for (i = 0; i < SCM_VM_NUM_INSTRUCTIONS; i++)
if (scm_is_true (table[i].symname))
scm_hashq_set_x (instructions_by_name, table[i].symname,
SCM_I_MAKINUM (i));
- instructions_by_name = scm_permanent_object (instructions_by_name);
}
op = scm_hashq_ref (instructions_by_name, name, SCM_UNDEFINED);
@@ -111,7 +112,7 @@ SCM_DEFINE (scm_instruction_list, "instruction-list", 0, 0,
0,
SCM list = SCM_EOL;
int i;
struct scm_instruction *ip = fetch_instruction_table ();
- for (i = 0; i < scm_op_last; i++)
+ for (i = 0; i < SCM_VM_NUM_INSTRUCTIONS; i++)
if (ip[i].name)
list = scm_cons (ip[i].symname, list);
return scm_reverse_x (list, SCM_EOL);
@@ -182,7 +183,7 @@ SCM_DEFINE (scm_opcode_to_instruction,
"opcode->instruction", 1, 0, 0,
SCM_MAKE_VALIDATE (1, op, I_INUMP);
opcode = SCM_I_INUM (op);
- if (opcode < scm_op_last)
+ if (opcode >= 0 && opcode < SCM_VM_NUM_INSTRUCTIONS)
ret = fetch_instruction_table ()[opcode].symname;
if (scm_is_false (ret))
diff --git a/libguile/instructions.h b/libguile/instructions.h
index d081b3e..a226322 100644
--- a/libguile/instructions.h
+++ b/libguile/instructions.h
@@ -31,7 +31,6 @@ enum scm_opcode {
#include <libguile/vm-i-scheme.i>
#include <libguile/vm-i-loader.i>
#undef VM_INSTRUCTION_TO_OPCODE
- scm_op_last = SCM_VM_NUM_INSTRUCTIONS
};
SCM_API SCM scm_instruction_list (void);
diff --git a/libguile/objcodes.c b/libguile/objcodes.c
index 4f21971..a210553 100644
--- a/libguile/objcodes.c
+++ b/libguile/objcodes.c
@@ -28,13 +28,33 @@
#include <sys/types.h>
#include <assert.h>
+#include <verify.h>
+
#include "_scm.h"
#include "vm-bootstrap.h"
#include "programs.h"
#include "objcodes.h"
-/* nb, the length of the header should be a multiple of 8 bytes */
-#define OBJCODE_COOKIE "GOOF-0.6"
+/* The endianness marker in objcode. */
+#ifdef WORDS_BIGENDIAN
+# define OBJCODE_ENDIANNESS "BE"
+#else
+# define OBJCODE_ENDIANNESS "LE"
+#endif
+
+#define _OBJCODE_STRINGIFY(x) # x
+#define OBJCODE_STRINGIFY(x) _OBJCODE_STRINGIFY (x)
+
+/* The word size marker in objcode. */
+#define OBJCODE_WORD_SIZE OBJCODE_STRINGIFY (SIZEOF_VOID_P)
+
+/* The objcode magic header. */
+#define OBJCODE_COOKIE \
+ "GOOF-0.6-" OBJCODE_ENDIANNESS "-" OBJCODE_WORD_SIZE "---"
+
+/* The length of the header must be a multiple of 8 bytes. */
+verify (((sizeof (OBJCODE_COOKIE) - 1) & 7) == 0);
+
/*
@@ -100,10 +120,10 @@ make_objcode_by_mmap (int fd)
#undef FUNC_NAME
SCM
-scm_c_make_objcode_slice (SCM parent, scm_t_uint8 *ptr)
+scm_c_make_objcode_slice (SCM parent, const scm_t_uint8 *ptr)
#define FUNC_NAME "make-objcode-slice"
{
- struct scm_objcode *data, *parent_data;
+ const struct scm_objcode *data, *parent_data;
SCM ret;
SCM_VALIDATE_OBJCODE (1, parent);
@@ -118,6 +138,12 @@ scm_c_make_objcode_slice (SCM parent, scm_t_uint8 *ptr)
scm_from_uint32 (parent_data->len),
scm_from_uint32 (parent_data->metalen)));
+#if 0
+ /* FIXME: We currently generate bytecode where the objcode-meta isn't
+ suitable aligned, which is an issue on some arches (e.g., SPARC). */
+ assert ((((uintptr_t) ptr) & (__alignof__ (struct scm_objcode) - 1UL)) == 0);
+#endif
+
data = (struct scm_objcode*)ptr;
if (data->base + data->len + data->metalen > parent_data->base +
parent_data->len + parent_data->metalen)
abort ();
diff --git a/libguile/objcodes.h b/libguile/objcodes.h
index 21e4add..e9b1cdb 100644
--- a/libguile/objcodes.h
+++ b/libguile/objcodes.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009 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
@@ -56,7 +56,7 @@ SCM_API scm_t_bits scm_tc16_objcode;
#define SCM_OBJCODE_IS_U8VECTOR(x) (SCM_SMOB_FLAGS (x) &
SCM_F_OBJCODE_IS_U8VECTOR)
#define SCM_OBJCODE_IS_SLICE(x) (SCM_SMOB_FLAGS (x) & SCM_F_OBJCODE_IS_SLICE)
-SCM scm_c_make_objcode_slice (SCM parent, scm_t_uint8 *ptr);
+SCM scm_c_make_objcode_slice (SCM parent, const scm_t_uint8 *ptr);
SCM_API SCM scm_load_objcode (SCM file);
SCM_API SCM scm_objcode_p (SCM obj);
SCM_API SCM scm_objcode_meta (SCM objcode);
diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c
index 7fd35e7..42f8bac 100644
--- a/libguile/vm-i-scheme.c
+++ b/libguile/vm-i-scheme.c
@@ -351,7 +351,7 @@ BV_REF_WITH_ENDIANNESS (f64, ieee_double)
VM_VALIDATE_BYTEVECTOR (bv); \
if (SCM_LIKELY (SCM_I_INUMP (idx) \
&& ((i = SCM_I_INUM (idx)) >= 0) \
- && (i < SCM_BYTEVECTOR_LENGTH (bv)) \
+ && (i + size <= SCM_BYTEVECTOR_LENGTH (bv)) \
&& (i % size == 0))) \
RETURN (SCM_I_MAKINUM (*(scm_t_##type*) \
(SCM_BYTEVECTOR_CONTENTS (bv) + i))); \
@@ -365,8 +365,8 @@ BV_REF_WITH_ENDIANNESS (f64, ieee_double)
ARGS2 (bv, idx); \
VM_VALIDATE_BYTEVECTOR (bv); \
if (SCM_LIKELY (SCM_I_INUMP (idx) \
- && ((i = SCM_I_INUM (idx)) >= 0) \
- && (i < SCM_BYTEVECTOR_LENGTH (bv)) \
+ && ((i = SCM_I_INUM (idx)) >= 0) \
+ && (i + size <= SCM_BYTEVECTOR_LENGTH (bv)) \
&& (i % size == 0))) \
{ scm_t_##type x = (*(scm_t_##type*)(SCM_BYTEVECTOR_CONTENTS (bv) + i)); \
if (SCM_FIXABLE (x)) \
@@ -385,7 +385,7 @@ BV_REF_WITH_ENDIANNESS (f64, ieee_double)
VM_VALIDATE_BYTEVECTOR (bv); \
if (SCM_LIKELY (SCM_I_INUMP (idx) \
&& ((i = SCM_I_INUM (idx)) >= 0) \
- && (i < SCM_BYTEVECTOR_LENGTH (bv)) \
+ && (i + size <= SCM_BYTEVECTOR_LENGTH (bv)) \
&& (i % size == 0))) \
RETURN (scm_from_double ((*(type*)(SCM_BYTEVECTOR_CONTENTS (bv) + i)))); \
else \
@@ -459,7 +459,7 @@ BV_SET_WITH_ENDIANNESS (f64, ieee_double)
VM_VALIDATE_BYTEVECTOR (bv); \
if (SCM_LIKELY (SCM_I_INUMP (idx) \
&& ((i = SCM_I_INUM (idx)) >= 0) \
- && (i < SCM_BYTEVECTOR_LENGTH (bv)) \
+ && (i + size <= SCM_BYTEVECTOR_LENGTH (bv)) \
&& (i % size == 0) \
&& (SCM_I_INUMP (val)) \
&& ((j = SCM_I_INUM (val)) >= min) \
@@ -477,7 +477,7 @@ BV_SET_WITH_ENDIANNESS (f64, ieee_double)
VM_VALIDATE_BYTEVECTOR (bv); \
if (SCM_LIKELY (SCM_I_INUMP (idx) \
&& ((i = SCM_I_INUM (idx)) >= 0) \
- && (i < SCM_BYTEVECTOR_LENGTH (bv)) \
+ && (i + size <= SCM_BYTEVECTOR_LENGTH (bv)) \
&& (i % size == 0))) \
*(scm_t_##type*) (SCM_BYTEVECTOR_CONTENTS (bv) + i) = scm_to_##type (val);
\
else \
@@ -492,7 +492,7 @@ BV_SET_WITH_ENDIANNESS (f64, ieee_double)
VM_VALIDATE_BYTEVECTOR (bv); \
if (SCM_LIKELY (SCM_I_INUMP (idx) \
&& ((i = SCM_I_INUM (idx)) >= 0) \
- && (i < SCM_BYTEVECTOR_LENGTH (bv)) \
+ && (i + size <= SCM_BYTEVECTOR_LENGTH (bv)) \
&& (i % size == 0))) \
*(type*) (SCM_BYTEVECTOR_CONTENTS (bv) + i) = scm_to_double (val); \
else \
diff --git a/libguile/vm.c b/libguile/vm.c
index 514ff8d..f753ea2 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -227,21 +227,41 @@ static SCM make_u8vector (const scm_t_uint8 *bytes,
size_t len)
return scm_take_u8vector (new_bytes, len);
}
+/* Dummy structure to guarantee 32-bit alignment. */
+struct t_32bit_aligned
+{
+ scm_t_int32 dummy;
+ scm_t_uint8 bytes[18];
+};
+
static SCM
really_make_boot_program (long nargs)
{
- scm_byte_t bytes[] = {0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- scm_op_mv_call, 0, 0, 1, scm_op_make_int8_1,
scm_op_halt};
+ SCM u8vec;
+ struct t_32bit_aligned bytes =
+ {
+ .dummy = 0,
+ .bytes = { 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ scm_op_mv_call, 0, 0, 1,
+ scm_op_make_int8_1, scm_op_halt }
+ };
+
SCM ret;
- ((scm_t_uint32*)bytes)[1] = 6; /* set len in current endianness, no meta */
+
+ /* Set length in current endianness, no meta. */
+ ((scm_t_uint32 *) bytes.bytes)[1] = 6;
+
if (SCM_UNLIKELY (nargs > 255 || nargs < 0))
abort ();
- bytes[13] = (scm_byte_t)nargs;
- ret = scm_make_program (scm_bytecode_to_objcode (make_u8vector (bytes,
sizeof(bytes))),
+ bytes.bytes[13] = (scm_byte_t) nargs;
+
+ u8vec = make_u8vector (bytes.bytes, sizeof (bytes.bytes));
+ ret = scm_make_program (scm_bytecode_to_objcode (u8vec),
SCM_BOOL_F, SCM_EOL);
SCM_SET_SMOB_FLAGS (ret, SCM_F_PROGRAM_IS_BOOT);
+
return ret;
}
#define NUM_BOOT_PROGS 8
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index aad4999..7f64af2 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4
--doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool
--macro-prefix=gl --no-vc-files alloca-opt autobuild byteswap canonicalize-lgpl
count-one-bits environ extensions flock fpieee full-read full-write havelib
iconv_open-utf lib-symbol-visibility libunistring putenv stdlib strcase
strftime striconveh string vsnprintf
+# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4
--doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool
--macro-prefix=gl --no-vc-files alloca-opt autobuild byteswap canonicalize-lgpl
count-one-bits environ extensions flock fpieee full-read full-write havelib
iconv_open-utf lib-symbol-visibility libunistring putenv stdlib strcase
strftime striconveh string verify vsnprintf
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
@@ -41,6 +41,7 @@ gl_MODULES([
strftime
striconveh
string
+ verify
vsnprintf
])
gl_AVOID([])
diff --git a/module/language/assembly/compile-bytecode.scm
b/module/language/assembly/compile-bytecode.scm
index 73ed620..4b9f7b7 100644
--- a/module/language/assembly/compile-bytecode.scm
+++ b/module/language/assembly/compile-bytecode.scm
@@ -110,6 +110,9 @@
(set! i (1+ i))
(if (> i 0) (write-byte x))))
(get-addr (lambda () i)))
+ ;; FIXME: We should add padding here so that META's bytecode
+ ;; meets the alignment requirements of `scm_objcode'. See
+ ;; `scm_c_make_objcode_slice ()'.
(write-bytecode meta write get-addr '()))))
((load-unsigned-integer ,str) (write-loader str))
((load-integer ,str) (write-loader str))
diff --git a/module/language/elisp/README b/module/language/elisp/README
index 340e52d..42a9bc6 100644
--- a/module/language/elisp/README
+++ b/module/language/elisp/README
@@ -31,8 +31,5 @@ Especially still missing:
* anonymous macros
Other ideas and things to think about:
- * %nil vs. #f/'() handling in Guile, possibly get rid of setting empty rest
- arguments to %nil
+ * %nil vs. #f/'() handling in Guile
* don't ensure-fluids for variables known to be let- or argument-bound
- * or, perhaps, get rid of ensure-fluids over all but rather scan all code for
- variables and create all needed fluids beforehand
diff --git a/module/language/elisp/bindings.scm
b/module/language/elisp/bindings.scm
new file mode 100644
index 0000000..e38ad95
--- /dev/null
+++ b/module/language/elisp/bindings.scm
@@ -0,0 +1,74 @@
+;;; Guile Emac Lisp
+
+;; Copyright (C) 2001 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(define-module (language elisp bindings)
+ #:export (make-bindings mark-fluid-needed! map-fluids-needed))
+
+; This module defines routines to handle analysis of symbol bindings used
+; during elisp compilation. This data allows to collect the symbols, for
+; which fluids need to be created, or mark certain symbols as lexically bound.
+
+
+; Record type used to hold the data necessary.
+
+(define bindings-type (make-record-type 'bindings '(needed-fluids)))
+
+
+; Construct an 'empty' instance of the bindings data structure to be used
+; at the start of a fresh compilation.
+
+(define (make-bindings)
+ ((record-constructor bindings-type) '()))
+
+
+; Mark that a given symbol is needed as fluid in the specified slot-module.
+
+(define (mark-fluid-needed! bindings sym module)
+ (let* ((old-needed ((record-accessor bindings-type 'needed-fluids) bindings))
+ (old-in-module (or (assoc-ref old-needed module) '()))
+ (new-in-module (if (memq sym old-in-module)
+ old-in-module
+ (cons sym old-in-module)))
+ (new-needed (assoc-set! old-needed module new-in-module)))
+ ((record-modifier bindings-type 'needed-fluids) bindings new-needed)))
+
+
+; Cycle through all fluids needed in order to generate the code for their
+; creation or some other analysis.
+
+(define (map-fluids-needed bindings proc)
+ (let* ((needed ((record-accessor bindings-type 'needed-fluids) bindings)))
+ (let iterate-modules ((mod-tail needed)
+ (mod-result '()))
+ (if (null? mod-tail)
+ mod-result
+ (iterate-modules
+ (cdr mod-tail)
+ (let* ((aentry (car mod-tail))
+ (module (car aentry))
+ (symbols (cdr aentry)))
+ (let iterate-symbols ((sym-tail symbols)
+ (sym-result mod-result))
+ (if (null? sym-tail)
+ sym-result
+ (iterate-symbols (cdr sym-tail)
+ (cons (proc module (car sym-tail))
+ sym-result))))))))))
diff --git a/module/language/elisp/compile-tree-il.scm
b/module/language/elisp/compile-tree-il.scm
index 79e0bc5..7a80730 100644
--- a/module/language/elisp/compile-tree-il.scm
+++ b/module/language/elisp/compile-tree-il.scm
@@ -20,6 +20,7 @@
;;; Code:
(define-module (language elisp compile-tree-il)
+ #:use-module (language elisp bindings)
#:use-module (language tree-il)
#:use-module (system base pmatch)
#:use-module (system base compile)
@@ -88,11 +89,11 @@
; Generate code to ensure a fluid is there for further use of a given symbol.
-; ensure-fluids-for does the same for a list of symbols and builds a sequence
-; that executes the fluid-insurances first, followed by all body commands; this
-; is a routine for convenience (needed with let, let*, lambda).
+; In general during the compilation, fluids needed are only tracked with the
+; bindings data structure. Afterwards, however, for all those needed symbols
+; the fluids are really generated with this routine.
-(define (ensure-fluid! loc sym module)
+(define (generate-ensure-fluid loc sym module)
(let ((resolved-module (call-primitive loc 'resolve-module
(make-const loc module)))
(resolved-intf (call-primitive loc 'resolve-interface
@@ -112,26 +113,19 @@
(make-module-ref loc runtime 'void #t)))))))
-(define (ensure-fluids-for loc syms module . body)
- (make-sequence loc
- `(,@(map (lambda (sym) (ensure-fluid! loc sym module)) syms)
- ,@body)))
-
-
; Generate code to reference a fluid saved variable.
-(define (reference-variable loc sym module)
- (make-sequence loc
- (list (ensure-fluid! loc sym module)
- (call-primitive loc 'fluid-ref
- (make-module-ref loc module sym #t)))))
+(define (reference-variable loc bind sym module)
+ (mark-fluid-needed! bind sym module)
+ (call-primitive loc 'fluid-ref
+ (make-module-ref loc module sym #t)))
; Reference a variable and error if the value is void.
-(define (reference-with-check loc sym module)
+(define (reference-with-check loc bind sym module)
(let ((var (gensym)))
- (make-let loc '(value) `(,var) `(,(reference-variable loc sym module))
+ (make-let loc '(value) `(,var) `(,(reference-variable loc bind sym module))
(make-conditional loc
(call-primitive loc 'eq?
(make-module-ref loc runtime 'void #t)
@@ -142,12 +136,10 @@
; Generate code to set a fluid saved variable.
-(define (set-variable! loc sym module value)
- (make-sequence loc
- (list (ensure-fluid! loc sym module)
- (call-primitive loc 'fluid-set!
- (make-module-ref loc module sym #t)
- value))))
+(define (set-variable! loc bind sym module value)
+ (mark-fluid-needed! bind sym module)
+ (call-primitive loc 'fluid-set!
+ (make-module-ref loc module sym #t) value))
; Process the bindings part of a let or let* expression; that is, check for
@@ -221,7 +213,7 @@
; This is formulated quite imperatively, but I think in this case that is quite
; clear and better than creating a lot of nested let's.
-(define (compile-lambda loc args body)
+(define (compile-lambda loc bind args body)
(if (not (list? args))
(error "expected list for argument-list" args))
(if (null? body)
@@ -236,7 +228,10 @@
(locals `(,@required ,@optional ,@(if rest (list rest) '()))))
(make-lambda loc
real-args real-args '()
- (ensure-fluids-for loc locals value-slot
+ (begin
+ (for-each (lambda (sym)
+ (mark-fluid-needed! bind sym value-slot))
+ locals)
(call-primitive loc 'with-fluids*
(make-application loc (make-primitive-ref loc 'list)
(map (lambda (sym) (make-module-ref loc value-slot sym #t))
@@ -250,13 +245,13 @@
optional))))
(make-lambda loc '() '() '()
(make-sequence loc
- `(,(process-optionals loc optional rest-sym)
- ,(process-rest loc rest rest-sym)
- ,@(map compile-expr body))))))))))))
+ `(,(process-optionals loc bind optional rest-sym)
+ ,(process-rest loc bind rest rest-sym)
+ ,@(map (compiler bind) body))))))))))))
; Build the code to handle setting of optional arguments that are present
; and updating the rest list.
-(define (process-optionals loc optional rest-sym)
+(define (process-optionals loc bind optional rest-sym)
(let iterate ((tail optional))
(if (null? tail)
(make-void loc)
@@ -264,7 +259,7 @@
(call-primitive loc 'null? (make-lexical-ref loc rest-sym rest-sym))
(make-void loc)
(make-sequence loc
- (list (set-variable! loc (car tail) value-slot
+ (list (set-variable! loc bind (car tail) value-slot
(call-primitive loc 'car
(make-lexical-ref loc rest-sym rest-sym)))
(make-lexical-set loc rest-sym rest-sym
@@ -273,14 +268,14 @@
(iterate (cdr tail))))))))
; This builds the code to set the rest variable to nil if it is empty.
-(define (process-rest loc rest rest-sym)
+(define (process-rest loc bind rest rest-sym)
(let ((rest-empty (call-primitive loc 'null?
(make-lexical-ref loc rest-sym rest-sym))))
(cond
(rest
(make-conditional loc rest-empty
(make-void loc)
- (set-variable! loc rest value-slot
+ (set-variable! loc bind rest value-slot
(make-lexical-ref loc rest-sym rest-sym))))
((not (null? rest-sym))
(make-conditional loc rest-empty
@@ -343,24 +338,24 @@
(define (unquote-splicing-cell? expr)
(and (list? expr) (= (length expr) 2) (unquote-splicing? (car expr))))
-(define (process-backquote loc expr)
+(define (process-backquote loc bind expr)
(if (contains-unquotes? expr)
(if (pair? expr)
(if (or (unquote-cell? expr) (unquote-splicing-cell? expr))
- (compile-expr (cadr expr))
+ (compile-expr bind (cadr expr))
(let* ((head (car expr))
- (processed-tail (process-backquote loc (cdr expr)))
+ (processed-tail (process-backquote loc bind (cdr expr)))
(head-is-list-2 (and (list? head) (= (length head) 2)))
(head-unquote (and head-is-list-2 (unquote? (car head))))
(head-unquote-splicing (and head-is-list-2
(unquote-splicing? (car head)))))
(if head-unquote-splicing
(call-primitive loc 'append
- (compile-expr (cadr head)) processed-tail)
+ (compile-expr bind (cadr head)) processed-tail)
(call-primitive loc 'cons
(if head-unquote
- (compile-expr (cadr head))
- (process-backquote loc head))
+ (compile-expr bind (cadr head))
+ (process-backquote loc bind head))
processed-tail))))
(error "non-pair expression contains unquotes" expr))
(make-const loc expr)))
@@ -377,76 +372,74 @@
; body
; (iterate (cdr tail)))))))
-(define (compile-dolist loc var iter-list result body)
+(define (compile-dolist loc bind var iter-list result body)
(let* ((tailvar (gensym))
(iterate (gensym))
(tailref (make-lexical-ref loc tailvar tailvar))
(iterate-func (make-lambda loc `(,tailvar) `(,tailvar) '()
(make-conditional loc
(call-primitive loc 'null? tailref)
- (compile-expr result)
+ (compile-expr bind result)
(make-sequence loc
- `(,(set-variable! loc var value-slot
+ `(,(set-variable! loc bind var value-slot
(call-primitive loc 'car tailref))
- ,@(map compile-expr body)
+ ,@(map (compiler bind) body)
,(make-application loc
(make-lexical-ref loc iterate iterate)
(list (call-primitive loc 'cdr
tailref)))))))))
-
- (make-sequence loc
- (list (ensure-fluid! loc var value-slot)
- (call-primitive loc 'with-fluid*
- (make-module-ref loc value-slot var #t)
- (nil-value loc)
- (make-lambda loc '() '() '()
- (make-letrec loc `(,iterate) `(,iterate) `(,iterate-func)
- (make-application loc
- (make-lexical-ref loc iterate iterate)
- (list (compile-expr iter-list))))))))))
+ (mark-fluid-needed! bind var value-slot)
+ (call-primitive loc 'with-fluid*
+ (make-module-ref loc value-slot var #t)
+ (nil-value loc)
+ (make-lambda loc '() '() '()
+ (make-letrec loc `(,iterate) `(,iterate) `(,iterate-func)
+ (make-application loc
+ (make-lexical-ref loc iterate iterate)
+ (list (compile-expr bind iter-list))))))))
; Compile a symbol expression. This is a variable reference or maybe some
; special value like nil.
-(define (compile-symbol loc sym)
+(define (compile-symbol loc bind sym)
(case sym
((nil) (nil-value loc))
((t) (t-value loc))
- (else (reference-with-check loc sym value-slot))))
+ (else (reference-with-check loc bind sym value-slot))))
; Compile a pair-expression (that is, any structure-like construct).
-(define (compile-pair loc expr)
+(define (compile-pair loc bind expr)
(pmatch expr
((progn . ,forms)
- (make-sequence loc (map compile-expr forms)))
+ (make-sequence loc (map (compiler bind) forms)))
; I chose to implement prog1 directly (not with macros) so that the
; temporary variable used can be a lexical one that is not backed by a
fluid
; for better performance.
((prog1 ,form1 . ,forms)
(let ((temp (gensym)))
- (make-let loc `(,temp) `(,temp) `(,(compile-expr form1))
+ (make-let loc `(,temp) `(,temp) `(,(compile-expr bind form1))
(make-sequence loc
- (append (map compile-expr forms)
+ (append (map (compiler bind) forms)
(list (make-lexical-ref loc temp temp)))))))
((if ,condition ,ifclause)
- (make-conditional loc (compile-expr condition)
- (compile-expr ifclause)
+ (make-conditional loc (compile-expr bind condition)
+ (compile-expr bind ifclause)
(nil-value loc)))
((if ,condition ,ifclause ,elseclause)
- (make-conditional loc (compile-expr condition)
- (compile-expr ifclause)
- (compile-expr elseclause)))
+ (make-conditional loc (compile-expr bind condition)
+ (compile-expr bind ifclause)
+ (compile-expr bind elseclause)))
((if ,condition ,ifclause . ,elses)
- (make-conditional loc (compile-expr condition)
- (compile-expr ifclause)
- (make-sequence loc (map compile-expr elses))))
+ (make-conditional loc (compile-expr bind condition)
+ (compile-expr bind ifclause)
+ (make-sequence loc (map (compiler bind) elses))))
; For (cond ...) forms, a special case is a (condition) clause without
; body. In this case, the value of condition itself should be returned,
@@ -462,23 +455,23 @@
(if (null? (cdr cur))
(let ((var (gensym)))
(make-let loc
- '(condition) `(,var) `(,(compile-expr (car cur)))
+ '(condition) `(,var) `(,(compile-expr bind (car cur)))
(make-conditional loc
(make-lexical-ref loc 'condition var)
(make-lexical-ref loc 'condition var)
(iterate (cdr tail)))))
(make-conditional loc
- (compile-expr (car cur))
- (make-sequence loc (map compile-expr (cdr cur)))
+ (compile-expr bind (car cur))
+ (make-sequence loc (map (compiler bind) (cdr cur)))
(iterate (cdr tail))))))))
((and) (t-value loc))
((and . ,expressions)
(let iterate ((tail expressions))
(if (null? (cdr tail))
- (compile-expr (car tail))
+ (compile-expr bind (car tail))
(make-conditional loc
- (compile-expr (car tail))
+ (compile-expr bind (car tail))
(iterate (cdr tail))
(nil-value loc)))))
@@ -488,7 +481,7 @@
(nil-value loc)
(let ((var (gensym)))
(make-let loc
- '(condition) `(,var) `(,(compile-expr (car tail)))
+ '(condition) `(,var) `(,(compile-expr bind (car tail)))
(make-conditional loc
(make-lexical-ref loc 'condition var)
(make-lexical-ref loc 'condition var)
@@ -497,7 +490,7 @@
((defconst ,sym ,value . ,doc)
(if (handle-var-def loc sym doc)
(make-sequence loc
- (list (set-variable! loc sym value-slot (compile-expr value))
+ (list (set-variable! loc bind sym value-slot (compile-expr bind
value))
(make-const loc sym)))))
((defvar ,sym) (make-const loc sym))
@@ -507,8 +500,9 @@
(list (make-conditional loc
(call-primitive loc 'eq?
(make-module-ref loc runtime 'void #t)
- (reference-variable loc sym value-slot))
- (set-variable! loc sym value-slot (compile-expr value))
+ (reference-variable loc bind sym value-slot))
+ (set-variable! loc bind sym value-slot
+ (compile-expr bind value))
(make-void loc))
(make-const loc sym)))))
@@ -524,37 +518,40 @@
(report-error loc "expected symbol in setq")
(if (null? tailtail)
(report-error loc "missing value for symbol in setq" sym)
- (let* ((val (compile-expr (car tailtail)))
- (op (set-variable! loc sym value-slot val)))
+ (let* ((val (compile-expr bind (car tailtail)))
+ (op (set-variable! loc bind sym value-slot val)))
(if (null? (cdr tailtail))
(let* ((temp (gensym))
(ref (make-lexical-ref loc temp temp)))
(list (make-let loc `(,temp) `(,temp) `(,val)
(make-sequence loc
- (list (set-variable! loc sym value-slot ref)
+ (list (set-variable! loc bind sym value-slot
ref)
ref)))))
- (cons (set-variable! loc sym value-slot val)
+ (cons (set-variable! loc bind sym value-slot val)
(iterate (cdr tailtail)))))))))))
; Let is done with a single call to with-fluids* binding them locally to
new
- ; values.
+ ; values all "at once".
((let ,bindings . ,body) (guard (and (list? bindings)
(list? body)
(not (null? bindings))
(not (null? body))))
- (let ((bind (process-let-bindings loc bindings)))
- (ensure-fluids-for loc (map car bind) value-slot
+ (let ((let-bind (process-let-bindings loc bindings)))
+ (begin
+ (for-each (lambda (sym)
+ (mark-fluid-needed! bind sym value-slot))
+ (map car let-bind))
(call-primitive loc 'with-fluids*
(make-application loc (make-primitive-ref loc 'list)
(map (lambda (el)
- (make-module-ref loc value-slot (car el) #t))
- bind))
+ (make-module-ref loc value-slot (car el) #t))
+ let-bind))
(make-application loc (make-primitive-ref loc 'list)
(map (lambda (el)
- (compile-expr (cdr el)))
- bind))
+ (compile-expr bind (cdr el)))
+ let-bind))
(make-lambda loc '() '() '()
- (make-sequence loc (map compile-expr body)))))))
+ (make-sequence loc (map (compiler bind) body)))))))
; Let* is compiled to a cascaded set of with-fluid* for each binding in
turn
; so that each one already sees the preceding bindings.
@@ -562,14 +559,17 @@
(list? body)
(not (null? bindings))
(not (null? body))))
- (let ((bind (process-let-bindings loc bindings)))
- (ensure-fluids-for loc (map car bind) value-slot
- (let iterate ((tail bind))
+ (let ((let-bind (process-let-bindings loc bindings)))
+ (begin
+ (for-each (lambda (sym)
+ (mark-fluid-needed! bind sym value-slot))
+ (map car let-bind))
+ (let iterate ((tail let-bind))
(if (null? tail)
- (make-sequence loc (map compile-expr body))
+ (make-sequence loc (map (compiler bind) body))
(call-primitive loc 'with-fluid*
(make-module-ref loc value-slot (caar tail) #t)
- (compile-expr (cdar tail))
+ (compile-expr bind (cdar tail))
(make-lambda loc '() '() '() (iterate (cdr tail)))))))))
; A while construct is transformed into a tail-recursive loop like this:
@@ -581,14 +581,14 @@
; (iterate))
((while ,condition . ,body)
(let* ((itersym (gensym))
- (compiled-body (map compile-expr body))
+ (compiled-body (map (compiler bind) body))
(iter-call (make-application loc
(make-lexical-ref loc 'iterate itersym)
(list)))
(full-body (make-sequence loc
`(,@compiled-body ,iter-call)))
(lambda-body (make-conditional loc
- (compile-expr condition)
+ (compile-expr bind condition)
full-body
(nil-value loc)))
(iter-thunk (make-lambda loc '() '() '() lambda-body)))
@@ -598,24 +598,24 @@
; dolist is treated here rather than as macro because it can take advantage
; of a non-fluid-based variable.
((dolist (,var ,iter-list) . ,body) (guard (symbol? var))
- (compile-dolist loc var iter-list 'nil body))
+ (compile-dolist loc bind var iter-list 'nil body))
((dolist (,var ,iter-list ,result) . ,body) (guard (symbol? var))
- (compile-dolist loc var iter-list result body))
+ (compile-dolist loc bind var iter-list result body))
; Either (lambda ...) or (function (lambda ...)) denotes a
lambda-expression
; that should be compiled.
((lambda ,args . ,body)
- (compile-lambda loc args body))
+ (compile-lambda loc bind args body))
((function (lambda ,args . ,body))
- (compile-lambda loc args body))
+ (compile-lambda loc bind args body))
; Build a lambda and also assign it to the function cell of some symbol.
((defun ,name ,args . ,body)
(if (not (symbol? name))
(error "expected symbol as function name" name)
(make-sequence loc
- (list (set-variable! loc name function-slot
- (compile-lambda loc args body))
+ (list (set-variable! loc bind name function-slot
+ (compile-lambda loc bind args body))
(make-const loc name)))))
; Define a macro (this is done directly at compile-time!).
@@ -623,13 +623,13 @@
((defmacro ,name ,args . ,body)
(if (not (symbol? name))
(error "expected symbol as macro name" name)
- (let* ((tree-il (compile-lambda loc args body))
+ (let* ((tree-il (compile-lambda loc (make-bindings) args body))
(object (compile tree-il #:from 'tree-il #:to 'value)))
(define-macro! loc name object)
(make-const loc name))))
((,backq ,val) (guard (backquote? backq))
- (process-backquote loc val))
+ (process-backquote loc bind val))
; XXX: Why do we need 'quote here instead of quote?
(('quote ,val)
@@ -638,7 +638,7 @@
; Macro calls are simply expanded and recursively compiled.
((,macro . ,args) (guard (and (symbol? macro) (is-macro? macro)))
(let ((expander (get-macro macro)))
- (compile-expr (apply expander args))))
+ (compile-expr bind (apply expander args))))
; Function calls using (function args) standard notation; here, we have to
; take the function value of a symbol if it is one. It seems that
functions
@@ -647,9 +647,9 @@
((,func . ,args)
(make-application loc
(if (symbol? func)
- (reference-with-check loc func function-slot)
- (compile-expr func))
- (map compile-expr args)))
+ (reference-with-check loc bind func function-slot)
+ (compile-expr bind func))
+ (map (compiler bind) args)))
(else
(report-error loc "unrecognized elisp" expr))))
@@ -657,20 +657,30 @@
; Compile a single expression to TreeIL.
-(define (compile-expr expr)
+(define (compile-expr bind expr)
(let ((loc (location expr)))
(cond
((symbol? expr)
- (compile-symbol loc expr))
+ (compile-symbol loc bind expr))
((pair? expr)
- (compile-pair loc expr))
+ (compile-pair loc bind expr))
(else (make-const loc expr)))))
+(define (compiler bind)
+ (lambda (expr)
+ (compile-expr bind expr)))
+
; Entry point for compilation to TreeIL.
(define (compile-tree-il expr env opts)
(values
- (compile-expr expr)
+ (let* ((bind (make-bindings))
+ (loc (location expr))
+ (compiled (compile-expr bind expr)))
+ (make-sequence loc
+ `(,@(map-fluids-needed bind (lambda (mod sym)
+ (generate-ensure-fluid loc sym mod)))
+ ,compiled)))
env
env))
diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index 22f8e04..7e26609 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -2,20 +2,19 @@
;; Copyright (C) 2001, 2009 Free Software Foundation, Inc.
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/module/system/base/syntax.scm b/module/system/base/syntax.scm
index d968bdf..cc73f38 100644
--- a/module/system/base/syntax.scm
+++ b/module/system/base/syntax.scm
@@ -2,20 +2,19 @@
;; Copyright (C) 2001 Free Software Foundation, Inc
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/module/system/repl/common.scm b/module/system/repl/common.scm
index 1978255..2db4518 100644
--- a/module/system/repl/common.scm
+++ b/module/system/repl/common.scm
@@ -2,20 +2,19 @@
;; Copyright (C) 2001 Free Software Foundation, Inc.
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/module/system/repl/describe.scm b/module/system/repl/describe.scm
index 0563def..590d223 100644
--- a/module/system/repl/describe.scm
+++ b/module/system/repl/describe.scm
@@ -2,20 +2,19 @@
;; Copyright (C) 2001 Free Software Foundation, Inc.
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/module/system/vm/instruction.scm b/module/system/vm/instruction.scm
index 3ad718e..403e9cd 100644
--- a/module/system/vm/instruction.scm
+++ b/module/system/vm/instruction.scm
@@ -2,20 +2,19 @@
;; Copyright (C) 2001 Free Software Foundation, Inc.
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/module/system/vm/objcode.scm b/module/system/vm/objcode.scm
index ab6bb4b..7c0490d 100644
--- a/module/system/vm/objcode.scm
+++ b/module/system/vm/objcode.scm
@@ -2,20 +2,19 @@
;; Copyright (C) 2001 Free Software Foundation, Inc.
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/module/system/vm/profile.scm b/module/system/vm/profile.scm
index 2c17fc7..6ab418a 100644
--- a/module/system/vm/profile.scm
+++ b/module/system/vm/profile.scm
@@ -2,20 +2,19 @@
;; Copyright (C) 2001 Free Software Foundation, Inc.
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/module/system/vm/program.scm b/module/system/vm/program.scm
index 5a490b9..9db4a75 100644
--- a/module/system/vm/program.scm
+++ b/module/system/vm/program.scm
@@ -1,21 +1,20 @@
;;; Guile VM program functions
;;; Copyright (C) 2001 Free Software Foundation, Inc.
-;;; Copyright (C) 2005 Ludovic Courtès <address@hidden>
;;;
-;;; This program is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2 of the License, or
-;;; (at your option) any later version.
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
;;;
-;;; This program is distributed in the hope that it will be useful,
+;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/module/system/vm/trace.scm b/module/system/vm/trace.scm
index 2ba5280..6ff09a7 100644
--- a/module/system/vm/trace.scm
+++ b/module/system/vm/trace.scm
@@ -2,20 +2,19 @@
;; Copyright (C) 2001 Free Software Foundation, Inc.
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this library; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
;;; Code:
diff --git a/testsuite/run-vm-tests.scm b/testsuite/run-vm-tests.scm
index c6c7a5d..f7eba40 100644
--- a/testsuite/run-vm-tests.scm
+++ b/testsuite/run-vm-tests.scm
@@ -1,7 +1,6 @@
;;; run-vm-tests.scm -- Run Guile-VM's test suite.
;;;
-;;; Copyright 2005 Ludovic Courtès <address@hidden>
-;;;
+;;; Copyright 2005, 2009 Free Software Foundation, Inc.
;;;
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
@@ -85,9 +84,7 @@ equal in the sense of @var{equal?}."
(failed (length (filter not res))))
(if (= 0 failed)
- (begin
- (format #t "~%All ~a tests passed~%" total)
- (exit 0))
+ (exit 0)
(begin
(format #t "~%~a tests failed out of ~a~%"
failed total)
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, elisp, updated. release_1-9-1-28-g5d221ca,
Daniel Kraft <=