emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/igc 1913bc6461c: fix_other for struct module_global_reference


From: Gerd Moellmann
Subject: scratch/igc 1913bc6461c: fix_other for struct module_global_reference
Date: Fri, 26 Apr 2024 06:47:31 -0400 (EDT)

branch: scratch/igc
commit 1913bc6461c4ba706dc785666ce3d17e5b5648e9
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>

    fix_other for struct module_global_reference
---
 src/emacs-module.c    | 22 +---------------------
 src/emacs-module.h.in | 20 ++++++++++++++++++++
 src/igc.c             |  8 ++++++--
 3 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/src/emacs-module.c b/src/emacs-module.c
index bb6df93d18a..db0018ee84a 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -75,6 +75,7 @@ To add a new module function, proceed as follows:
 
 #include <config.h>
 
+#include "lisp.h"
 #include "emacs-module.h"
 
 #include <stdarg.h>
@@ -83,7 +84,6 @@ To add a new module function, proceed as follows:
 #include <stdlib.h>
 #include <time.h>
 
-#include "lisp.h"
 #include "bignum.h"
 #include "dynlib.h"
 #include "coding.h"
@@ -126,10 +126,6 @@ typedef int (*emacs_init_function) (struct emacs_runtime 
*);
 
 /* Memory management.  */
 
-/* An `emacs_value' is just a pointer to a structure holding an
-   internal Lisp object.  */
-struct emacs_value_tag { Lisp_Object v; };
-
 /* Local value objects use a simple fixed-sized block allocation
    scheme without explicit deallocation.  All local values are
    deallocated when the lifetime of their environment ends.  Keep
@@ -377,22 +373,6 @@ module_get_environment (struct emacs_runtime *runtime)
 
 static Lisp_Object Vmodule_refs_hash;
 
-/* Pseudovector type for global references.  The pseudovector tag is
-   PVEC_OTHER since these values are never printed and don't need to
-   be special-cased for garbage collection.  */
-
-struct module_global_reference {
-  /* Pseudovector header, must come first. */
-  union vectorlike_header header;
-
-  /* Holds the emacs_value for the object.  The Lisp_Object stored
-     therein must be the same as the hash key.  */
-  struct emacs_value_tag value;
-
-  /* Reference count, always positive.  */
-  ptrdiff_t refcount;
-};
-
 static struct module_global_reference *
 XMODULE_GLOBAL_REFERENCE (Lisp_Object o)
 {
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index 690254bd28c..8645f9894d2 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -203,6 +203,26 @@ extern int emacs_module_init (struct emacs_runtime 
*runtime)
   EMACS_NOEXCEPT
   EMACS_ATTRIBUTE_NONNULL (1);
 
+/* An `emacs_value' is just a pointer to a structure holding an
+   internal Lisp object.  */
+struct emacs_value_tag { Lisp_Object v; };
+
+/* Pseudovector type for global references.  The pseudovector tag is
+   PVEC_OTHER since these values are never printed and don't need to
+   be special-cased for garbage collection.  */
+
+struct module_global_reference {
+  /* Pseudovector header, must come first. */
+  union vectorlike_header header;
+
+  /* Holds the emacs_value for the object.  The Lisp_Object stored
+     therein must be the same as the hash key.  */
+  struct emacs_value_tag value;
+
+  /* Reference count, always positive.  */
+  ptrdiff_t refcount;
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/igc.c b/src/igc.c
index 38fdb401c32..2f4e90d5e87 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -1594,8 +1594,12 @@ fix_other (mps_ss_t ss, void *o)
   MPS_SCAN_BEGIN (ss)
   {
     IGC_FIX_CALL_FN (ss, struct Lisp_Vector, o, fix_vectorlike);
-    // Not used on macOS. Some scroll bar stuff in w32?
-    igc_assert (!"other");
+    /* FIXME: PVEC_OTHER is also used on w32 for struct scroll_bar,
+       and there seems to be no way to discern both uses. */
+#ifdef HAVE_MODULES
+    struct module_global_reference *r = o;
+    IGC_FIX12_OBJ (ss, &r->value.v);
+#endif
   }
   MPS_SCAN_END (ss);
   return MPS_RES_OK;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]