From: Richard Stallman <rms@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: [patch] mem_node shrink
Date: Wed, 21 Nov 2007 21:26:35 -0500 [thread overview]
Message-ID: <E1Iv1lz-0003eG-V9@fencepost.gnu.org> (raw)
In-Reply-To: <474168CE.5020502@yandex.ru> (message from Dmitry Antipov on Mon, 19 Nov 2007 13:43:26 +0300)
The idea looks like an improvement. I think there needs to be a comment
explaining that the widths of these fields are supposed to add up to
the same as an EMACS_INT.
And is EMACS_INT the right thing? EMACS_INT is `long' in some cases.
Should it be plain `int' instead? Should it be a type that's as wide
as a pointer or as size_t?
Should the size value be measured in units of Lisp_Object instead
of bytes?
+ if (size > MOST_POSITIVE_FIXNUM)
+ abort ();
+#endif
That's not reliably the correct test. It happens to be right, at
present, because the width of the field is BITS_PER_EMACS_INT - 4, and
it is unsigned, so it has the same number of bits as a positive Lisp
integer. But that is just coincidence.
So I think MOST_POSITIVE_FIXNUM should be replaced with something
guaranteed to be right. Define a constant to serve as the width of
that field, and use the same constant here in something like -((-1) <<
MEM_NODE_SIZE_WIDTH).
/* Can't handle zero size regions in the red-black tree. */
- mem_insert (value, (char *) value + max (size, 1), MEM_TYPE_NON_LISP);
+ mem_insert (value, max (size, 1), MEM_TYPE_NON_LISP);
Wouldn't it be cleaner for mem_insert to do max (..., 1) ?
next prev parent reply other threads:[~2007-11-22 2:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-19 10:43 [patch] mem_node shrink Dmitry Antipov
2007-11-22 2:26 ` Richard Stallman [this message]
2007-11-22 13:57 ` Dmitry Antipov
2007-11-23 4:35 ` Richard Stallman
2007-11-23 14:55 ` Stefan Monnier
2007-11-22 3:42 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1Iv1lz-0003eG-V9@fencepost.gnu.org \
--to=rms@gnu.org \
--cc=dmantipov@yandex.ru \
--cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.