unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] %nil-handling optimization and fixes v1
Date: Thu, 23 Jul 2009 23:38:08 +0200	[thread overview]
Message-ID: <m3ws5zf5bz.fsf@pobox.com> (raw)
In-Reply-To: <20090709161043.GA2538@fibril.netris.org> (Mark H. Weaver's message of "Thu, 9 Jul 2009 12:11:07 -0400")

Hi Mark,

This is also not a patch review yet :)

On Thu 09 Jul 2009 18:11, Mark H Weaver <mhw@netris.org> writes:

> I added the following macros, whose names explicitly state how %nil
> should be handled.  See the comments in the patch for more information
> about these.
>
>   scm_is_false_assume_not_lisp_nil  scm_is_true_assume_not_lisp_nil
>   scm_is_false_and_not_lisp_nil     scm_is_true_or_lisp_nil
>   scm_is_false_or_lisp_nil          scm_is_true_and_not_lisp_nil
>
>   scm_is_lisp_false                 scm_is_lisp_true
>
>   scm_is_null_assume_not_lisp_nil
>   scm_is_null_and_not_lisp_nil
>   scm_is_null_or_lisp_nil
>
>   scm_is_bool_and_not_lisp_nil
>   scm_is_bool_or_lisp_nil

These are terrible names. But they seem to be the best names for the
concepts we're trying to express. I don't understand all of them yet,
will wait for a review -- unless Neil takes care of that before I do ;-)

> The following already-existing macros are defined as aliases, such
> that their semantics is unchanged (although scm_is_bool used to be a
> function and is now a macro).
>
>   scm_is_null   -->  scm_is_null_and_not_lisp_nil
>   scm_is_false  -->  scm_is_false_and_not_lisp_nil
>   scm_is_true   -->  scm_is_true_or_lisp_nil
>   scm_is_bool   -->  scm_is_bool_and_not_lisp_nil

This part sounds right to me, based on the current semantics.

> (I still believe that these should be changed to versions that handle
>  %nil properly, but await approval on that point, so these patches do
>  not make those changes)

Yes, this also sounds right to me.

> Also, if the preprocessor macro SCM_ENABLE_ELISP is not true (this
> macro already existed and was used in lang.h), all overheads
> associated with %nil handling are eliminated from the above macros.

Excellent. Hacks like this are excellent :-)

> vm-fixes.patch changes semantics, by fixing %nil handling in the
> following instructions: br-if, br-if-not, br-if-null, br-if-not-null,
> not, not-not, null?, and not-null?

Sounds great in principle, though i have not looked at it

> srfi-1-fixes.patch changes semantics, by fixing %nil handling in
> several functions.  Note that this patch (and several other large
> forthcoming patches) will be unnecessary if the scm_is_false,
> scm_is_true, and scm_is_null macros are changed to handle %nil as I
> proposed.

Hm. Perhaps we should decide first.

> non-essential.patch is the last and least important.  It doesn't
> change any functionality or implementation.  It changes two
> occurrences of scm_is_bool and scm_is_null, in which %nil must *not*
> be treated as a boolean or null, to use newly-added equivalent macros
> which are explicit about how nil should be handled.  These changes
> will be needed if scm_is_null is changed as I proposed.  It also adds
> a few comments related to %nil handling.
>
> I've run "make check" on recent git master (c4b681fd) with these
> patches applied, and everything seems to work.

Sounds good too.

> I haven't yet run any benchmarks, because I'm not sure how to best do
> that.  I doubt the changes will make any noticeable difference except
> possibly in C code which does a lot of tests which include %nil.

Yeah I don't expect too many differences either. Still, nice to clean
up.

Regards,

Andy
-- 
http://wingolog.org/




  reply	other threads:[~2009-07-23 21:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 16:11 [PATCH] %nil-handling optimization and fixes v1 Mark H Weaver
2009-07-23 21:38 ` Andy Wingo [this message]
2009-07-30 22:05   ` Neil Jerram
2009-08-30  9:18   ` Neil Jerram
2009-08-30 18:01   ` Mark H Weaver
2009-09-01 22:09     ` Neil Jerram
2009-09-02 16:00       ` Mark H Weaver
2009-08-28  7:08 ` Neil Jerram
2009-08-28  7:11   ` Neil Jerram
2009-08-28  7:08 ` Neil Jerram
2009-08-30 13:58   ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3ws5zf5bz.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).