unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* adress of lisp object is multiple of 8
@ 2007-05-08 16:04 A Soare
  2007-05-08 18:57 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: A Soare @ 2007-05-08 16:04 UTC (permalink / raw)
  To: Emacs   Help  [help-gnu-emacs]


Here is the definition of a lisp object.

typedef
union Lisp_Object
  {
    /* Used for comparing two Lisp_Objects;
       also, positive integers can be accessed fast this way.  */
    EMACS_INT i;

    struct
      {
	EMACS_INT val  : VALBITS;
	enum Lisp_Type type : GCTYPEBITS;
      } s;
    struct
      {
	EMACS_UINT val : VALBITS;
	enum Lisp_Type type : GCTYPEBITS;
      } u;
  }
Lisp_Object;

It is memorised on 32 bits. First 3 bits represents the type of object. The others 29 represent a pointer to a structure of that type of object. For example, if adress & 7 is 5, that means that the integer formed of the 29 bits points to a Lisp_Cons.

I do not understand how can I be sure that when the lisp allocs a new space of memory for a given object from enum Lisp_Type, it is allocated to an adress that is multiple of 8 ?

Thanks in advance.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: adress of lisp object is multiple of 8
  2007-05-08 16:04 adress of lisp object is multiple of 8 A Soare
@ 2007-05-08 18:57 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2007-05-08 18:57 UTC (permalink / raw)
  To: help-gnu-emacs

> From: A Soare <alinsoar@voila.fr>
> Date: Tue,  8 May 2007 18:04:10 +0200 (CEST)
> 
> I do not understand how can I be sure that when the lisp allocs a new space of memory for a given object from enum Lisp_Type, it is allocated to an adress that is multiple of 8 ?

Not really a good place to ask such questions, but anyway...

See the definition of DECL_ALIGN on lisp.h, its usage, and the usage
of USE_LSB_TAG that depends on it.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-08 18:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-08 16:04 adress of lisp object is multiple of 8 A Soare
2007-05-08 18:57 ` Eli Zaretskii

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).