[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MPS: Forwording symbols
From: |
Gerd Möllmann |
Subject: |
MPS: Forwording symbols |
Date: |
Sun, 16 Jun 2024 11:43:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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?
- MPS: Forwording symbols,
Gerd Möllmann <=
Re: MPS: Forwording symbols, Gerd Möllmann, 2024/06/16