From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: MPS: Forwording symbols Date: Mon, 17 Jun 2024 20:10:05 +0200 Message-ID: <874j9rcuf6.fsf@gmail.com> References: <87jziod6yc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39199"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Emacs Devel , Eli Zaretskii To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 17 20:11:02 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sJGoo-000A0B-4y for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Jun 2024 20:11:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJGo4-0005qB-Bn; Mon, 17 Jun 2024 14:10:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJGo1-0005mm-4v for emacs-devel@gnu.org; Mon, 17 Jun 2024 14:10:13 -0400 Original-Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJGnz-0005YX-5C; Mon, 17 Jun 2024 14:10:12 -0400 Original-Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-57cad452f8bso5214755a12.2; Mon, 17 Jun 2024 11:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718647807; x=1719252607; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=bUxVEyUJL35pPzU2KiBBTK0SimHGCmiZvjUaUmZo3Rs=; b=m3BVjDE4a5e+F5FG4HzTiPtemCdkLxn7YmE9LdFwzmAqZ47sA3oOeoE6ZZ3qV3ZpdI QfC9b148dSWEMszpC4ukObyXfxYhYv7L80+3YjvlCYJ2n+Gm9pH8OxFDYoSbULWaFgC8 JUW+9GHwbLpJ8s1l0K5l1zy+taMyjuYYY/phS0GonCTsFUeC8+cOtXHfzi+qQX5OOH2f k9xOYrkubPGVjFKsR9wL9Pnk+7k4WHkxayuzPR/AtrRTadgv7/UWGL020AHkLA/GN/0l olw4TaEuusZKGSGsHdF/fKHLls2sHyTFu89PmI8BlcRRyKZyGGXiyjEyCo4vynNaBMDR h7FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718647807; x=1719252607; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bUxVEyUJL35pPzU2KiBBTK0SimHGCmiZvjUaUmZo3Rs=; b=Wt6UXmjTfvytgFqCk0bpe5tWoimm0bGZe9KQHEXK9uRZ1aG3T++YWHjcm1PqiC8eH4 j9FOgxm+DuShyxBqWf4zSvJkQxNMcGQw+CToWHD6tNmAe24M6ShljZcFkPQy7zd5U6NT 0yMumA41MXLnoBcVqksfomL69GZ0tA7z2RTObeT6hZ+Iw08ugfbdvDQeVDw2YbVSg2EG CS3sfL8zGzp9u6qLHtxnR8vx3WFYYiqq8vFD4Pkib+aSPOsWnFSAY1TYeoG5KOOc8vxq bpm2mebw3VTk7lJP8tij3JX91WumXhBTJxWWZzb1qYnhn7t3MgrzKphJ61V0PMXKusBf KvjA== X-Forwarded-Encrypted: i=1; AJvYcCVPjOmO2wq2yIm4Uc+vC5dNOrvOXO1dpWU3C1R+lPZURtVvp2tzf5uYo6WmV2QbmB4R02ILPnobMboLMvs= X-Gm-Message-State: AOJu0YwpoM/f7LH0s4AWiFFdS7GTRXIhuVbckDOKCll7quRuwhb0ST7q WFVsP7vP883+JprWiathsfFwULXsKoVN3WOjZ47g3IhqDDi3yLLHgp6Ueg== X-Google-Smtp-Source: AGHT+IFRHotGY/CuDy0TnIU+X8T9Uhu/kFC4oKO4Og0kBSjQneZ86bw6i2ft9caqthDZFFMHIQgAuQ== X-Received: by 2002:a50:8747:0:b0:57c:563b:f37f with SMTP id 4fb4d7f45d1cf-57cbd67dbedmr7236961a12.19.1718647807370; Mon, 17 Jun 2024 11:10:07 -0700 (PDT) Original-Received: from caladan (dial-189091.pool.broadband44.net. [212.46.189.91]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72cdf52sm6792390a12.8.2024.06.17.11.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 11:10:06 -0700 (PDT) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llman?= =?utf-8?Q?n=22's?= message of "Mon, 17 Jun 2024 05:43:11 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=eller.helmut@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320215 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Jun 17 2024, Gerd M=C3=B6llmann wrote: > The whole dumping of these structs looks highly dubious to me, > independent of MPS. They are constants, always have been, AFAICT, even > from what I remember from the 90s. The patch below creates the necessary relocs so that no forwarding structs end up in the dump. > Looking forward to the time when the mirror code is gone :-). I'm not so optimistic. The first collection is very slow: time ./emacs -batch -f igc--collect =20=20=20 real 0m12.555s user 0m11.708s sys 0m0.097s That's not good. Maybe there is some unfixed problem that is causing this slowness, but it could also be that MPS simply is so slow for this allocation pattern. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Don-t-dump-lispfwd-objects.patch >From a61d8752bfc390df45d8b66c30f81dc5ed5ac2ef Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Mon, 17 Jun 2024 19:47:04 +0200 Subject: [PATCH] Don't dump lispfwd objects The forwarding structs already exist in the data or bss section. They are all created with DEFVAR_INT and similar macros. Instead of creating new structs in the dump, create relocs to the data section. * src/pdumper.c (dump_field_fwd): New. (dump_blv, dump_symbol): Use it. (dump_pre_dump_symbol): Don't dump fwd objects. --- src/pdumper.c | 67 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/src/pdumper.c b/src/pdumper.c index c824da06b5e..f0996cea08c 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2474,6 +2474,51 @@ dump_fwd (struct dump_context *ctx, lispfwd fwd) return offset; } +static void +dump_field_fwd (struct dump_context *ctx, void *out, const void *in_start, + const lispfwd *in_field) +{ + dump_field_emacs_ptr (ctx, out, in_start, in_field); + switch (XFWDTYPE (*in_field)) + { + case Lisp_Fwd_Int: + { + const struct Lisp_Intfwd *fwd = in_field->fwdptr; + dump_emacs_reloc_immediate_intmax_t (ctx, fwd->intvar, *fwd->intvar); + } + break; + case Lisp_Fwd_Bool: + { + const struct Lisp_Boolfwd *fwd = in_field->fwdptr; + dump_emacs_reloc_immediate_bool (ctx, fwd->boolvar, *fwd->boolvar); + } + break; + case Lisp_Fwd_Obj: + { + const struct Lisp_Objfwd *fwd = in_field->fwdptr; + if (NILP (Fgethash (dump_off_to_lisp (emacs_offset (fwd->objvar)), + ctx->staticpro_table, Qnil))) + dump_emacs_reloc_to_lv (ctx, fwd->objvar, *fwd->objvar); + } + break; + case Lisp_Fwd_Kboard_Obj: + break; + case Lisp_Fwd_Buffer_Obj: + { + const struct Lisp_Buffer_Objfwd *fwd = in_field->fwdptr; + dump_emacs_reloc_immediate (ctx, &fwd->type, &fwd->type, + sizeof fwd->type); + dump_emacs_reloc_immediate (ctx, &fwd->offset, &fwd->offset, + sizeof fwd->offset); + eassert (SYMBOLP (fwd->predicate)); + /* FIXME: assumes symbols are represented as offsets from lispsym */ + dump_emacs_reloc_immediate (ctx, &fwd->predicate, &fwd->predicate, + sizeof fwd->predicate); + } + break; + } +} + static dump_off dump_blv (struct dump_context *ctx, const struct Lisp_Buffer_Local_Value *blv) @@ -2486,16 +2531,11 @@ dump_blv (struct dump_context *ctx, DUMP_FIELD_COPY (&out, blv, local_if_set); DUMP_FIELD_COPY (&out, blv, found); if (blv->fwd.fwdptr) - dump_field_fixup_later (ctx, &out, blv, &blv->fwd.fwdptr); + dump_field_fwd (ctx, &out, blv, &blv->fwd); dump_field_lv (ctx, &out, blv, &blv->where, WEIGHT_NORMAL); dump_field_lv (ctx, &out, blv, &blv->defcell, WEIGHT_STRONG); dump_field_lv (ctx, &out, blv, &blv->valcell, WEIGHT_STRONG); dump_off offset = dump_object_finish (ctx, &out, sizeof (out)); - if (blv->fwd.fwdptr) - dump_remember_fixup_ptr_raw - (ctx, - offset + dump_offsetof (struct Lisp_Buffer_Local_Value, fwd), - dump_fwd (ctx, blv->fwd)); return offset; } @@ -2529,10 +2569,6 @@ dump_pre_dump_symbol (struct dump_context *ctx, struct Lisp_Symbol *symbol) dump_remember_symbol_aux (ctx, symbol_lv, dump_blv (ctx, symbol->u.s.val.blv)); break; - case SYMBOL_FORWARDED: - dump_remember_symbol_aux (ctx, symbol_lv, - dump_fwd (ctx, symbol->u.s.val.fwd)); - break; default: break; } @@ -2600,7 +2636,7 @@ dump_symbol (struct dump_context *ctx, dump_field_fixup_later (ctx, &out, symbol, &symbol->u.s.val.blv); break; case SYMBOL_FORWARDED: - dump_field_fixup_later (ctx, &out, symbol, &symbol->u.s.val.fwd); + dump_field_fwd (ctx, &out, symbol, &symbol->u.s.val.fwd); break; default: emacs_abort (); @@ -2624,15 +2660,6 @@ dump_symbol (struct dump_context *ctx, ? aux_offset : dump_blv (ctx, symbol->u.s.val.blv))); break; - case SYMBOL_FORWARDED: - aux_offset = dump_recall_symbol_aux (ctx, make_lisp_symbol (symbol)); - dump_remember_fixup_ptr_raw - (ctx, - offset + dump_offsetof (struct Lisp_Symbol, u.s.val.fwd), - (aux_offset - ? aux_offset - : dump_fwd (ctx, symbol->u.s.val.fwd))); - break; default: break; } -- 2.39.2 --=-=-=--