changeset 2963:288869ac83b5

[xemacs-hg @ 2005-09-29 11:41:21 by crestani] Fix new allocator's module support.
author crestani
date Thu, 29 Sep 2005 11:41:22 +0000
parents 62d146e2f3ec
children bcbe7794aa6f
files src/ChangeLog src/symbols.c
diffstat 2 files changed, 45 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Sep 28 21:51:16 2005 +0000
+++ b/src/ChangeLog	Thu Sep 29 11:41:22 2005 +0000
@@ -1,3 +1,8 @@
+2005-09-26  Marcus Crestani  <crestani@xemacs.org>
+
+	* symbols.c (check_module_subr): Fix new allocator's module
+	support: remove duplicating the subr.
+
 2005-09-27  Ben Wing  <ben@xemacs.org>
 
 	* glyphs.c:
--- a/src/symbols.c	Wed Sep 28 21:51:16 2005 +0000
+++ b/src/symbols.c	Thu Sep 29 11:41:22 2005 +0000
@@ -3474,6 +3474,7 @@
 #endif
 
 #ifdef HAVE_SHLIB
+#ifndef MC_ALLOC
 /*
  * If we are not in a pure undumped Emacs, we need to make a duplicate of
  * the subr. This is because the only time this function will be called
@@ -3533,6 +3534,45 @@
     subr = newsubr;							      \
   }									      \
 } while (0)
+#else /* MC_ALLOC */
+/* 
+ * If we have the new allocator enabled, we do not need to make a
+ * duplicate of the subr.  The new allocator already does allocate all
+ * subrs in Lisp-accessible memory rather than have it in the static
+ * subr struct.
+ *
+ * NOTE: The DOC pointer is not set here as described above.
+ */   
+#define check_module_subr(subr)						      \
+do {									      \
+  if (initialized) {							      \
+    Lisp_Object f;							      \
+									      \
+    if (subr->min_args < 0)						      \
+      signal_ferror (Qdll_error, "%s min_args (%hd) too small",		      \
+		     subr_name (subr), subr->min_args);			      \
+    if (subr->min_args > SUBR_MAX_ARGS)					      \
+      signal_ferror (Qdll_error, "%s min_args (%hd) too big (max = %d)",      \
+		     subr_name (subr), subr->min_args, SUBR_MAX_ARGS);	      \
+									      \
+    if (subr->max_args != MANY &&					      \
+	subr->max_args != UNEVALLED)					      \
+      {									      \
+	/* Need to fix lisp.h and eval.c if SUBR_MAX_ARGS too small */	      \
+	if (subr->max_args > SUBR_MAX_ARGS)				      \
+	  signal_ferror (Qdll_error, "%s max_args (%hd) too big (max = %d)",  \
+			 subr_name (subr), subr->max_args, SUBR_MAX_ARGS);    \
+	if (subr->min_args > subr->max_args)				      \
+	  signal_ferror (Qdll_error, "%s min_args (%hd) > max_args (%hd)",    \
+			 subr_name (subr), subr->min_args, subr->max_args);   \
+      }									      \
+									      \
+    f = XSYMBOL (sym)->function;					      \
+    if (!UNBOUNDP (f) && (!CONSP (f) || !EQ (XCAR (f), Qautoload)))	      \
+      signal_ferror (Qdll_error, "Attempt to redefine %s", subr_name (subr)); \
+  }									      \
+} while (0)
+#endif /* MC_ALLOC */
 #else /* ! HAVE_SHLIB */
 #define check_module_subr(subr)
 #endif