From: Po Lu <luangruo@yahoo.com>
To: Troy Hinckley <troyhinckley@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: question about Qnil representation
Date: Thu, 27 Oct 2022 08:45:32 +0800 [thread overview]
Message-ID: <87eduu8577.fsf@yahoo.com> (raw)
In-Reply-To: <5d85a71f-500e-43c7-a1fb-47ffe8518d94@Spark> (Troy Hinckley's message of "Wed, 26 Oct 2022 10:04:47 -0600")
Troy Hinckley <troyhinckley@gmail.com> writes:
> Sure, but it reinterprets the integer as a *Lisp_Symbol to get at the
> actual struct correct?
No, Emacs never reinterprets Lisp_Objects, as they have a tag.
> Or am I misunderstanding how this works?
Yes. There are several tagging schemes used to associate Lisp_Objects
with their types. Usually, if a platform can provide the proper
alignment requirements, the least significant 3 bits of the word type
(configured at build-time) are used to a tag containing type
information. After the tag bit is removed, Lisp_Objects are either
pointers to the corresponding Lisp_Foo struct, integers, or symbols,
which are actually offsets from the start of the auto-generated
`lispsym' array in global.h. The first element of that array is nil,
and the tag bit for the symbol type is 0, so XSYMBOL naturally returns
the correct `nil' Lisp_Symbol for the integer 0.
next prev parent reply other threads:[~2022-10-27 0:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5a560265-fa81-42d2-945b-ab85d72df9e6@Spark>
2022-10-26 15:40 ` question about Qnil representation Troy Hinckley
2022-10-26 16:00 ` Eli Zaretskii
2022-10-26 16:04 ` Troy Hinckley
2022-10-26 16:09 ` Eli Zaretskii
2022-10-27 0:45 ` Po Lu [this message]
2022-10-26 16:16 ` Matt Armstrong
2022-10-26 16:22 ` Troy Hinckley
2022-10-26 16:45 ` Eli Zaretskii
2022-10-26 18:46 ` Troy Hinckley
2022-10-26 19:01 ` Stefan Monnier
2022-10-26 19:03 ` Eli Zaretskii
2022-10-27 0:47 ` Po Lu
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/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eduu8577.fsf@yahoo.com \
--to=luangruo@yahoo.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=troyhinckley@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).