From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: npostavs@gmail.com, 31750@debbugs.gnu.org
Subject: bug#31750: simplify and tune Emacs stack-related allocation
Date: Sun, 10 Jun 2018 18:07:23 +0300 [thread overview]
Message-ID: <837en6sms4.fsf@gnu.org> (raw)
In-Reply-To: <14685fe0-39b9-deb6-6960-0e9572c4357c@cs.ucla.edu> (message from Paul Eggert on Sat, 9 Jun 2018 21:03:25 -0700)
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sat, 9 Jun 2018 21:03:25 -0700
> Cc: 31750@debbugs.gnu.org
>
> /* A mint_ptr object OBJ represents a C-language pointer P efficiently.
> Preferably (and typically), OBJ is a Lisp integer I such that
> XINTPTR (I) == P, as this represents P within a single Lisp value
> without requiring any auxiliary memory. However, if P would be
> damaged by being tagged as an integer and then untagged via
> XINTPTR, then OBJ is a Lisp_Save_Value with pointer component P.
>
> mint_ptr objects are efficiency hacks that are intended for use
> only within C code. C code should never blindly accept a mint_ptr
> object from Lisp code, as that would allow Lisp code to coin
> pointers from integers and could lead to crashes. A C pointer that
> needs to be packaged into a Lisp-visible object can be made part of
> a Lisp_Misc type instead; see Lisp_User_Ptr for an example. */
I'm not sure I agree with the last part, at least not in such
categorical terms. E.g., w32notify.c does exactly what the above says
not to do, and AFAICT is a very good candidate for using mint_ptr
objects.
OTOH, maybe I do agree, as long as "blindly" is an essential part of
that rule ;-)
next prev parent reply other threads:[~2018-06-10 15:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-08 2:27 bug#31750: simplify and tune Emacs stack-related allocation Paul Eggert
2018-06-08 3:20 ` Daniel Colascione
2018-06-08 15:42 ` Paul Eggert
2018-06-10 3:30 ` Noam Postavsky
2018-06-10 4:03 ` Paul Eggert
2018-06-10 15:07 ` Eli Zaretskii [this message]
2018-06-10 16:12 ` Paul Eggert
2018-06-15 7:46 ` Paul Eggert
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=837en6sms4.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=31750@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=npostavs@gmail.com \
/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.