unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* MPS gc_init_header
@ 2024-08-09  9:31 Helmut Eller
  2024-08-09 11:39 ` Pip Cet
  0 siblings, 1 reply; 2+ messages in thread
From: Helmut Eller @ 2024-08-09  9:31 UTC (permalink / raw)
  To: Pip Cet; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

Some calls to gc_init_header seem to be redundant: alloc_impl
initializes the header, so igc_make_cons etc. don't need to call
gc_init_header.  Would you mind removing those extra calls?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Remove-redundant-calls-to-gc_init_header.patch --]
[-- Type: text/x-diff, Size: 1608 bytes --]

From b8799978aceb826fd31c4096761745be8040d9e1 Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
Date: Fri, 9 Aug 2024 11:23:42 +0200
Subject: [PATCH] Remove redundant calls to gc_init_header

* igc.c (igc_make_cons, igc_alloc_symbol, igc_make_float)
(igc_make_string): The header is already initialized, not need to do it
again.
---
 src/igc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/igc.c b/src/igc.c
index 52d52ca7a91..f069a2becc9 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -3827,7 +3827,6 @@ igc_make_cons (Lisp_Object car, Lisp_Object cdr)
   struct Lisp_Cons *cons = alloc (sizeof *cons, IGC_OBJ_CONS);
   cons->u.s.car = car;
   cons->u.s.u.cdr = cdr;
-  gc_init_header (&cons->gc_header, IGC_OBJ_CONS);
   return make_lisp_ptr (cons, Lisp_Cons);
 }
 
@@ -3835,7 +3834,6 @@ igc_make_cons (Lisp_Object car, Lisp_Object cdr)
 igc_alloc_symbol (void)
 {
   struct Lisp_Symbol *sym = alloc (sizeof *sym, IGC_OBJ_SYMBOL);
-  gc_init_header (&sym->gc_header, IGC_OBJ_SYMBOL);
   return make_lisp_symbol (sym);
 }
 
@@ -3844,7 +3842,6 @@ igc_make_float (double val)
 {
   struct Lisp_Float *f = alloc (sizeof *f, IGC_OBJ_FLOAT);
   f->u.data = val;
-  gc_init_header (&f->gc_header, IGC_OBJ_FLOAT);
   return make_lisp_ptr (f, Lisp_Float);
 }
 
@@ -3916,7 +3913,6 @@ igc_make_string (size_t nchars, size_t nbytes, bool unibyte, bool clear)
   s->u.s.size = nchars;
   s->u.s.size_byte = unibyte ? -1 : nbytes;
   s->u.s.data = alloc_string_data (nbytes, clear);
-  gc_init_header (&s->gc_header, IGC_OBJ_STRING);
   return make_lisp_ptr (s, Lisp_String);
 }
 
-- 
2.39.2


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

* Re: MPS gc_init_header
  2024-08-09  9:31 MPS gc_init_header Helmut Eller
@ 2024-08-09 11:39 ` Pip Cet
  0 siblings, 0 replies; 2+ messages in thread
From: Pip Cet @ 2024-08-09 11:39 UTC (permalink / raw)
  To: Helmut Eller; +Cc: emacs-devel

"Helmut Eller" <eller.helmut@gmail.com> writes:

> Some calls to gc_init_header seem to be redundant: alloc_impl
> initializes the header, so igc_make_cons etc. don't need to call
> gc_init_header.  Would you mind removing those extra calls?

Thank you very much!  Pushed.

Pip




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

end of thread, other threads:[~2024-08-09 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09  9:31 MPS gc_init_header Helmut Eller
2024-08-09 11:39 ` Pip Cet

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