unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans.
@ 2010-03-27 16:14 Mark H Weaver
  2010-03-27 16:56 ` Mark H Weaver
  2010-03-27 21:50 ` Mark H Weaver
  0 siblings, 2 replies; 4+ messages in thread
From: Mark H Weaver @ 2010-03-27 16:14 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

This patch makes the guile representation of lisp booleans match what
I outlined in my post of Aug 2009, "The cube of lisp booleans" [1].
The only difference from my earlier patch is the addition of two more
do-not-use IFLAGS (6 and 7), which enable more efficient
implementations of several operations.

I confess that I haven't yet tested this patch, but it's so trivial
that it must work *grin*.  Sorry, my development machine is an XO-1,
so compiling guile takes a very long time :(

     Mark

[1] http://lists.gnu.org/archive/html/guile-devel/2009-08/msg00206.html

[-- Attachment #2: 0001-Renumber-IFLAGSs-so-the-first-8-are-reserved-for-lis.patch --]
[-- Type: text/x-diff, Size: 2469 bytes --]

From 013392e6a069912adca367598e9bdc6e44fc0118 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Sat, 27 Mar 2010 11:46:30 -0400
Subject: [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans.

This enables more efficient implementations of several operations,
e.g. scm_is_lisp_bool, canonicalize_boolean, fast_boolean_not,
converting SCM booleans to C booleans, etc.

* libguile/tags.h: Renumber IFLAGs.
* libguile/print.c: Renumber iflagnames to match.
---
 libguile/print.c |    4 +++-
 libguile/tags.h  |   12 +++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/libguile/print.c b/libguile/print.c
index 8867e6b..ca38d42 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -68,7 +68,9 @@ static const char *iflagnames[] =
   "#<XXX UNUSED LISP FALSE -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
   "()",
   "#t",
-  "#<XXX UNUSED BOOLEAN -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
+  "#<XXX UNUSED BOOLEAN 0 -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
+  "#<XXX UNUSED BOOLEAN 1 -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
+  "#<XXX UNUSED BOOLEAN 2 -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
   "#<unspecified>",
   "#<undefined>",
   "#<eof>",
diff --git a/libguile/tags.h b/libguile/tags.h
index 2e6dea2..dd9875e 100644
--- a/libguile/tags.h
+++ b/libguile/tags.h
@@ -519,12 +519,14 @@ enum scm_tc8_tags
 #define SCM_BOOL_T 		SCM_MAKIFLAG (4)
 
 #ifdef BUILDING_LIBGUILE
-#define SCM_XXX_ANOTHER_BOOLEAN_DONT_USE	SCM_MAKIFLAG (5)
+#define SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0	SCM_MAKIFLAG (5)
+#define SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_1	SCM_MAKIFLAG (6)
+#define SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_2	SCM_MAKIFLAG (7)
 #endif
 
-#define SCM_UNSPECIFIED		SCM_MAKIFLAG (6)
-#define SCM_UNDEFINED	 	SCM_MAKIFLAG (7)
-#define SCM_EOF_VAL 		SCM_MAKIFLAG (8)
+#define SCM_UNSPECIFIED		SCM_MAKIFLAG (8)
+#define SCM_UNDEFINED	 	SCM_MAKIFLAG (9)
+#define SCM_EOF_VAL 		SCM_MAKIFLAG (10)
 
 /* When a variable is unbound this is marked by the SCM_UNDEFINED
  * value.  The following is an unbound value which can be handled on
@@ -534,7 +536,7 @@ enum scm_tc8_tags
  * the code which handles this value in C so that SCM_UNDEFINED can be
  * used instead.  It is not ideal to let this kind of unique and
  * strange values loose on the Scheme level.  */
-#define SCM_UNBOUND		SCM_MAKIFLAG (9)
+#define SCM_UNBOUND		SCM_MAKIFLAG (11)
 
 #define SCM_UNBNDP(x)		(scm_is_eq ((x), SCM_UNDEFINED))
 
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans.
  2010-03-27 16:14 [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans Mark H Weaver
@ 2010-03-27 16:56 ` Mark H Weaver
  2010-03-27 21:50 ` Mark H Weaver
  1 sibling, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2010-03-27 16:56 UTC (permalink / raw)
  To: guile-devel

I wrote:
> I confess that I haven't yet tested this patch, but it's so trivial
> that it must work *grin*.

Ugh, sorry folks.  I should've known better than to post an untested
patch, and in fact it doesn't compile.  A better patch will come soon,
but only *after* I compile and test it :)

Apologies...

    Mark




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans.
  2010-03-27 16:14 [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans Mark H Weaver
  2010-03-27 16:56 ` Mark H Weaver
@ 2010-03-27 21:50 ` Mark H Weaver
  2010-03-28 12:36   ` Andy Wingo
  1 sibling, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2010-03-27 21:50 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

Okay, this version of the patch actually works: compiled and tested.

    Mark


On Sat, Mar 27, 2010 at 12:14:18PM -0400, Mark H Weaver wrote:
> This patch makes the guile representation of lisp booleans match what
> I outlined in my post of Aug 2009, "The cube of lisp booleans" [1].
> The only difference from my earlier patch is the addition of two more
> do-not-use IFLAGS (6 and 7), which enable more efficient
> implementations of several operations.
> 
> I confess that I haven't yet tested this patch, but it's so trivial
> that it must work *grin*.  Sorry, my development machine is an XO-1,
> so compiling guile takes a very long time :(
> 
>      Mark
> 
> [1] http://lists.gnu.org/archive/html/guile-devel/2009-08/msg00206.html

[-- Attachment #2: 0001-Renumber-IFLAGSs-so-the-first-8-are-reserved-for-lis.patch --]
[-- Type: text/x-diff, Size: 4103 bytes --]

From bf121c0dfe119731f2f9658d823ea700b064dcc9 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Sat, 27 Mar 2010 17:35:46 -0400
Subject: [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans.

This enables more efficient implementations of several operations,
e.g. scm_is_lisp_bool, canonicalize_boolean, fast_boolean_not,
converting SCM booleans to C booleans, etc.

* libguile/tags.h: Renumber IFLAGs.

* libguile/print.c: Renumber iflagnames to match.

* libguile/boolean.c:
* libguile/boolean.h:
  SCM_XXX_ANOTHER_BOOLEAN_DONT_USE --> SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0
---
 libguile/boolean.c |    2 +-
 libguile/boolean.h |    2 +-
 libguile/print.c   |    4 +++-
 libguile/tags.h    |   14 ++++++++------
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/libguile/boolean.c b/libguile/boolean.c
index 1ca0d78..3391d6c 100644
--- a/libguile/boolean.c
+++ b/libguile/boolean.c
@@ -49,7 +49,7 @@ verify (SCM_VALUES_DIFFER_IN_EXACTLY_ONE_BIT_POSITION		\
 		(SCM_ELISP_NIL, SCM_EOL));
 verify (SCM_VALUES_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS		\
 		(SCM_ELISP_NIL, SCM_BOOL_F, SCM_BOOL_T,		\
-		 SCM_XXX_ANOTHER_BOOLEAN_DONT_USE));
+		 SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0));
 verify (SCM_VALUES_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS		\
 		(SCM_ELISP_NIL, SCM_BOOL_F, SCM_EOL,		\
 		 SCM_XXX_ANOTHER_LISP_FALSE_DONT_USE));
diff --git a/libguile/boolean.h b/libguile/boolean.h
index ba5313c..bc108f5 100644
--- a/libguile/boolean.h
+++ b/libguile/boolean.h
@@ -75,7 +75,7 @@
  *
  * If SCM_ENABLE_ELISP is true, then scm_is_bool_or_nil(x)
  * returns 1 if and only if x is one of the following: SCM_BOOL_F,
- * SCM_BOOL_T, SCM_ELISP_NIL, or SCM_XXX_ANOTHER_BOOLEAN_DONT_USE.
+ * SCM_BOOL_T, SCM_ELISP_NIL, or SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0.
  * Otherwise, it returns 0.
  */
 #if SCM_ENABLE_ELISP
diff --git a/libguile/print.c b/libguile/print.c
index 8867e6b..ca38d42 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -68,7 +68,9 @@ static const char *iflagnames[] =
   "#<XXX UNUSED LISP FALSE -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
   "()",
   "#t",
-  "#<XXX UNUSED BOOLEAN -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
+  "#<XXX UNUSED BOOLEAN 0 -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
+  "#<XXX UNUSED BOOLEAN 1 -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
+  "#<XXX UNUSED BOOLEAN 2 -- DO NOT USE -- SHOULD NEVER BE SEEN XXX>",
   "#<unspecified>",
   "#<undefined>",
   "#<eof>",
diff --git a/libguile/tags.h b/libguile/tags.h
index 2e6dea2..d11bf68 100644
--- a/libguile/tags.h
+++ b/libguile/tags.h
@@ -498,7 +498,7 @@ enum scm_tc8_tags
  *   must all be equal except for two bit positions.
  *   (used to implement scm_is_lisp_false)
  *
- * - SCM_ELISP_NIL, SCM_BOOL_F, SCM_BOOL_T, SCM_XXX_ANOTHER_BOOLEAN_DONT_USE
+ * - SCM_ELISP_NIL, SCM_BOOL_F, SCM_BOOL_T, SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0
  *   must all be equal except for two bit positions.
  *   (used to implement scm_is_bool_or_nil)
  *
@@ -519,12 +519,14 @@ enum scm_tc8_tags
 #define SCM_BOOL_T 		SCM_MAKIFLAG (4)
 
 #ifdef BUILDING_LIBGUILE
-#define SCM_XXX_ANOTHER_BOOLEAN_DONT_USE	SCM_MAKIFLAG (5)
+#define SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0	SCM_MAKIFLAG (5)
+#define SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_1	SCM_MAKIFLAG (6)
+#define SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_2	SCM_MAKIFLAG (7)
 #endif
 
-#define SCM_UNSPECIFIED		SCM_MAKIFLAG (6)
-#define SCM_UNDEFINED	 	SCM_MAKIFLAG (7)
-#define SCM_EOF_VAL 		SCM_MAKIFLAG (8)
+#define SCM_UNSPECIFIED		SCM_MAKIFLAG (8)
+#define SCM_UNDEFINED	 	SCM_MAKIFLAG (9)
+#define SCM_EOF_VAL 		SCM_MAKIFLAG (10)
 
 /* When a variable is unbound this is marked by the SCM_UNDEFINED
  * value.  The following is an unbound value which can be handled on
@@ -534,7 +536,7 @@ enum scm_tc8_tags
  * the code which handles this value in C so that SCM_UNDEFINED can be
  * used instead.  It is not ideal to let this kind of unique and
  * strange values loose on the Scheme level.  */
-#define SCM_UNBOUND		SCM_MAKIFLAG (9)
+#define SCM_UNBOUND		SCM_MAKIFLAG (11)
 
 #define SCM_UNBNDP(x)		(scm_is_eq ((x), SCM_UNDEFINED))
 
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans.
  2010-03-27 21:50 ` Mark H Weaver
@ 2010-03-28 12:36   ` Andy Wingo
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2010-03-28 12:36 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guile-devel

On Sat 27 Mar 2010 22:50, Mark H Weaver <mhw@netris.org> writes:

> Okay, this version of the patch actually works: compiled and tested.

Applied :)

A
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-28 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-27 16:14 [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans Mark H Weaver
2010-03-27 16:56 ` Mark H Weaver
2010-03-27 21:50 ` Mark H Weaver
2010-03-28 12:36   ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).