all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Pip Cet <pipcet@gmail.com>
Cc: 32405@debbugs.gnu.org
Subject: bug#32405: [PATCH] Turn misc objects into pseudovectors
Date: Thu, 9 Aug 2018 00:44:03 -0700	[thread overview]
Message-ID: <8a7b2eba-578c-ad62-6b8a-262397d06902@cs.ucla.edu> (raw)
In-Reply-To: <CAOqdjBeKW42wi2U8LUeaTs+6FXbp5mMnX7qVOKKAc6oZjOu6tg@mail.gmail.com>

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

Pip Cet wrote:
> +      case PVEC_FINALIZER:
> +        VECTOR_MARK (ptr);
> +        mark_object (XFINALIZER (obj)->function);
> +        break;
> +
> 
> Isn't that precisely what the default code does?
> 
> Similarly for bool vectors, misc ptrs, and user ptrs.

Thanks for mentioning that opportunity for further simplification. Followup 
patch attached.

> I'm curious what ideas you have for the newly freed Lisp_Type tag.

I had been thinking of using it for immediate floats, if we want to insist on 
full IEEE double semantics for Emacs Lisp. But if there's something more 
important, we can use it for that instead.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Simplify-mark_object-for-pseudovectors.patch --]
[-- Type: text/x-patch; name="0001-Simplify-mark_object-for-pseudovectors.patch", Size: 2401 bytes --]

From d7370693eb76477be79888f759d28a1affbd7e81 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
Date: Thu, 9 Aug 2018 00:35:47 -0700
Subject: [PATCH] Simplify mark_object for pseudovectors

Suggested by Pip Cet (Bug#32405#14).
* src/alloc.c (mark_object): Remove unnecessary special cases for
PVEC_MARKER, PVEC_BOOL_VECTOR, PVEC_MISC_PTR, PVEC_USER_PTR, and
PVEC_FINALIZER.

change is to free up an enum Lisp_Type tag value, a scarce
---
 src/alloc.c | 20 ++------------------
 src/lisp.h  |  4 +++-
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index dcf11825bc..be00c30521 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6375,28 +6375,10 @@ mark_object (Lisp_Object arg)
 	    mark_char_table (ptr, (enum pvec_type) pvectype);
 	    break;
 
-	  case PVEC_MARKER:
-	    /* DO NOT mark thru the marker's chain.
-	       The buffer's markers chain does not preserve markers from gc;
-	       instead, markers are removed from the chain when freed by gc.  */
-	  case PVEC_BOOL_VECTOR:
-	  case PVEC_MISC_PTR:
-#ifdef HAVE_MODULES
-	  case PVEC_USER_PTR:
-#endif
-	    /* No Lisp_Objects to mark in these.  */
-	    VECTOR_MARK (ptr);
-	    break;
-
 	  case PVEC_OVERLAY:
 	    mark_overlay (XOVERLAY (obj));
 	    break;
 
-	  case PVEC_FINALIZER:
-	    VECTOR_MARK (ptr);
-	    mark_object (XFINALIZER (obj)->function);
-	    break;
-
 	  case PVEC_SUBR:
 	    break;
 
@@ -6404,6 +6386,8 @@ mark_object (Lisp_Object arg)
 	    emacs_abort ();
 
 	  default:
+	    /* A regular vector, or a pseudovector needing no special
+	       treatment.  */
 	    mark_vectorlike (ptr);
 	  }
       }
diff --git a/src/lisp.h b/src/lisp.h
index c559377288..cfed2cf2d6 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2256,7 +2256,9 @@ struct Lisp_Marker
      does not point anywhere.  */
 
   /* For markers that point somewhere,
-     this is used to chain of all the markers in a given buffer.  */
+     this is used to chain of all the markers in a given buffer.
+     The chain does not preserve markers from garbage collection;
+     instead, markers are removed from the chain when freed by GC.  */
   /* We could remove it and use an array in buffer_text instead.
      That would also allow us to preserve it ordered.  */
   struct Lisp_Marker *next;
-- 
2.17.1


  reply	other threads:[~2018-08-09  7:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09  2:58 bug#32405: [PATCH] Turn misc objects into pseudovectors Paul Eggert
2018-08-09  5:01 ` bug#32405: Turning " Paul Eggert
2018-08-09  7:16   ` Paul Eggert
2018-08-09 16:24   ` Stefan Monnier
2018-08-09  6:11 ` bug#32405: [PATCH] Turn " Pip Cet
2018-08-09  7:44   ` Paul Eggert [this message]
2018-08-10  2:01     ` Richard Stallman
2018-08-09 17:23 ` Andy Moreton
2018-08-09 17:53 ` Pip Cet
2018-08-09 18:10   ` Paul Eggert
2018-08-09 18:24 ` Paul Eggert

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=8a7b2eba-578c-ad62-6b8a-262397d06902@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=32405@debbugs.gnu.org \
    --cc=pipcet@gmail.com \
    /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.