From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Renumber IFLAGSs so the first 8 are reserved for lisp booleans. Date: Sat, 27 Mar 2010 17:50:54 -0400 Message-ID: <20100327215053.GA23363@fibril.netris.org> References: <20100327161417.GA9481@fibril.netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="UlVJffcvxoiEqYs2" X-Trace: dough.gmane.org 1269726674 18194 80.91.229.12 (27 Mar 2010 21:51:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 27 Mar 2010 21:51:14 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Mar 27 22:51:10 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NvduP-00023j-JR for guile-devel@m.gmane.org; Sat, 27 Mar 2010 22:51:10 +0100 Original-Received: from localhost ([127.0.0.1]:41830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvduO-0001hc-EU for guile-devel@m.gmane.org; Sat, 27 Mar 2010 17:51:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvduK-0001gZ-Hl for guile-devel@gnu.org; Sat, 27 Mar 2010 17:51:04 -0400 Original-Received: from [140.186.70.92] (port=37077 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvduJ-0001g2-17 for guile-devel@gnu.org; Sat, 27 Mar 2010 17:51:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvduH-00065J-7X for guile-devel@gnu.org; Sat, 27 Mar 2010 17:51:02 -0400 Original-Received: from world.peace.net ([216.204.32.208]:45663) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvduH-00065E-15 for guile-devel@gnu.org; Sat, 27 Mar 2010 17:51:01 -0400 Original-Received: from localhost ([127.0.0.1] helo=fibril.netris.org ident=hope4) by world.peace.net with esmtp (Exim 4.69) (envelope-from ) id 1NvduA-0003qU-KW; Sat, 27 Mar 2010 17:50:55 -0400 Content-Disposition: inline In-Reply-To: <20100327161417.GA9481@fibril.netris.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10096 Archived-At: --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --UlVJffcvxoiEqYs2 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: inline; filename="0001-Renumber-IFLAGSs-so-the-first-8-are-reserved-for-lis.patch" >From bf121c0dfe119731f2f9658d823ea700b064dcc9 Mon Sep 17 00:00:00 2001 From: Mark H Weaver 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[] = "#", "()", "#t", - "#", + "#", + "#", + "#", "#", "#", "#", 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 --UlVJffcvxoiEqYs2--