all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Emacs Devel <emacs-devel@gnu.org>
Cc: Helmut Eller <eller.helmut@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Subject: MPS: Forwording symbols
Date: Sun, 16 Jun 2024 11:43:11 +0200	[thread overview]
Message-ID: <m28qz5rzo0.fsf@pro2.fritz.box> (raw)

Ok, I've looked a bit closer, and I think we can avoid dumping the
the forwarding structs altogether.

There are 5 types of forwarding structs

 enum Lisp_Fwd_Type
   {
     Lisp_Fwd_Int,		/* Fwd to a C `int' variable.  */
     Lisp_Fwd_Bool,		/* Fwd to a C boolean var.  */
     Lisp_Fwd_Obj,		/* Fwd to a C Lisp_Object variable.  */
     Lisp_Fwd_Buffer_Obj,	/* Fwd to a Lisp_Object field of buffers.  */
     Lisp_Fwd_Kboard_Obj		/* Fwd to a Lisp_Object field of kboards.  */
   };

Four of them contain only the type and either integer offsets or
pointers to variables in Emacs' data segment. The only interesting one
is Lisp_Fwd_Buffer_Obj which looks like

  struct Lisp_Buffer_Objfwd
    {
      enum Lisp_Fwd_Type type;	/* = Lisp_Fwd_Buffer_Obj */
      int offset;
      /* One of Qnil, Qintegerp, Qsymbolp, Qstringp, Qfloatp or Qnumberp.  */
      Lisp_Object predicate;
    };

which has an additional member for the predicate. AFAICT, the comment is
true, and thus predicate is also a constant because it is always from a
DEFSYM, i.e. it is a symbol from lispsym.

Means that dumping the fwd structs is not strictly needed. (And maybe
one should replace the Lisp_Object predicate member with an enum, to
make that sure for the future.)

If we don't dump_fwd, we would have to make sure though not to overwrite
the existing values for symbols in lispsym, which happens in
dump_do_dump_relocation

    case RELOC_DUMP_TO_EMACS_PTR_RAW:
      {
        uintptr_t value = dump_read_word_from_dump (dump_base, reloc_offset);
        eassert (dump_reloc_size (reloc) == sizeof (value));
        value += emacs_basis ();
        dump_write_word_to_dump (dump_base, reloc_offset, value);
        break;
      }

The name dump_write_word_to_dump is misleading. It does a memcpy to
Emacs' data segment.

Maybe one could introduce a new RELOC_xyz type to signify that a
forwarding symbol is patched and save the fwd value around the memcpy if
needed.

Or something like that?




             reply	other threads:[~2024-06-16  9:43 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-16  9:43 Gerd Möllmann [this message]
2024-06-16 10:15 ` MPS: Forwording symbols Gerd Möllmann
2024-06-16 19:27 ` Helmut Eller
2024-06-16 19:39   ` Gerd Möllmann
2024-06-17 10:57     ` Eli Zaretskii
2024-06-17 12:15       ` Gerd Möllmann
2024-06-17 12:24         ` Eli Zaretskii
2024-06-17 12:58           ` Gerd Möllmann
2024-06-17  3:43   ` Gerd Möllmann
2024-06-17 11:47     ` Eli Zaretskii
2024-06-17 18:10     ` Helmut Eller
2024-06-17 18:39       ` Gerd Möllmann
2024-06-17 18:50         ` Gerd Möllmann
2024-06-17 19:05           ` Helmut Eller
2024-06-17 19:19             ` Gerd Möllmann
2024-06-17 19:25               ` Helmut Eller
2024-06-17 20:07                 ` Gerd Möllmann
2024-06-18  6:32                   ` Gerd Möllmann
2024-06-18  9:05                     ` Helmut Eller
2024-06-18  9:24                       ` Gerd Möllmann
2024-06-18 10:44                         ` Gerd Möllmann
2024-06-18 11:55                           ` Helmut Eller
2024-06-18 12:21                             ` Gerd Möllmann
2024-06-18 19:36                               ` Helmut Eller
2024-06-18 19:55                                 ` Gerd Möllmann
2024-06-20 14:18                                   ` Helmut Eller
2024-06-20 15:16                                     ` Gerd Möllmann
2024-06-20 16:17                                       ` Helmut Eller
2024-06-20 16:27                                         ` Gerd Möllmann
2024-06-18 12:05                         ` Helmut Eller
2024-06-18 12:29                           ` Gerd Möllmann
2024-06-18 13:08                           ` Eli Zaretskii
2024-06-18 12:36                   ` Eli Zaretskii
2024-06-18 16:20                     ` Helmut Eller
2024-06-18 16:29                       ` Eli Zaretskii
2024-06-18 16:43                       ` Gerd Möllmann
2024-06-18 16:37                     ` Helmut Eller
2024-06-18 17:33                       ` Eli Zaretskii
2024-06-18 17:51                         ` Helmut Eller
2024-06-18 18:18                           ` Eli Zaretskii
2024-06-18 17:54                         ` Eli Zaretskii
2024-06-18 18:11                           ` Gerd Möllmann
2024-06-18 18:20                             ` Eli Zaretskii
2024-06-18 18:23                               ` Gerd Möllmann
2024-06-18 18:12                           ` Helmut Eller
2024-06-18 18:22                             ` Eli Zaretskii
2024-06-18 19:27                               ` Helmut Eller
2024-06-18 19:33                                 ` Gerd Möllmann
2024-06-19 11:22                                   ` Eli Zaretskii
2024-06-17 19:06           ` Gerd Möllmann
2024-06-21 15:36 ` Helmut Eller
2024-06-21 15:41   ` Gerd Möllmann
2024-06-21 16:20     ` Gerd Möllmann
2024-06-22 18:02       ` Helmut Eller
2024-06-22 18:27         ` Gerd Möllmann
2024-06-22 18:53           ` Helmut Eller
2024-06-22 19:26             ` Gerd Möllmann
2024-06-23  3:28               ` Gerd Möllmann
2024-06-23  4:10                 ` Gerd Möllmann
2024-06-23 19:59               ` Helmut Eller
2024-06-24  3:45                 ` Gerd Möllmann
2024-06-24 15:13                   ` Helmut Eller
2024-06-24 16:14                     ` Gerd Möllmann
2024-06-24 16:32                       ` Eli Zaretskii
2024-06-24 17:00                         ` Gerd Möllmann
2024-06-23 15:59           ` Helmut Eller
2024-06-23 16:26             ` Gerd Möllmann
2024-06-21 16:15   ` Ihor Radchenko
2024-06-21 16:25     ` Gerd Möllmann

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=m28qz5rzo0.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --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.