From xemacs-m  Mon Jul  7 21:55:01 1997
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id VAA14115
	for <xemacs-beta@xemacs.org>; Mon, 7 Jul 1997 21:55:00 -0500 (CDT)
Received: (from steve@localhost)
	by altair.xemacs.org (8.8.6/8.8.6) id TAA00238;
	Mon, 7 Jul 1997 19:57:45 -0700
Mail-Copies-To: never
To: xemacs-beta@xemacs.org
Subject: [PATCH] optimizing rebuild for puresize adjustment
X-Url: http://www.miranova.com/%7Esteve/
X-Face: #!T9!#9s-3o8)*uHlX{Ug[xW7E7Wr!*L46-OxqMu\xz23v|R9q}lH?cRS{rCNe^'[`^sr5"
 f8*@r4ipO6Jl!:Ccq<xoV[Qz2u8<8-+Vwf2gzJ44lf_/y9OaQ`@#Q65{U4/TC)i2`~/M&QI$X>p:9I
 OSS'2{-)-4wBnVeg0S\O4Al@)uC[pD|+
X-Attribution: sb
From: Steven L Baur <steve@xemacs.org>
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: text/plain; charset=US-ASCII
Date: 07 Jul 1997 19:57:44 -0700
Message-ID: <m290zixnbr.fsf@altair.xemacs.org>
Lines: 189
X-Mailer: Gnus v5.4.62/XEmacs 20.3(beta12) - "Helsinki"

[This patch is dedicated to sister Kyle and reduces recompilation
after puresize adjustment to only the tiny file pure.c]

Tested and seems to work.

1997-07-07  Steven L Baur  <steve@altair.xemacs.org>

	* Makefile.in.in (alloc.o): Remove dependency on puresize_adjust.h 
	so alloc.c need not be recompiled when puresize changes.

	* alloc.c (PURIFIED): Use get_PURESIZE() instead of constant.
	(check_purespace): Ditto.
	(alloc_pure_lrecord): Ditto.
	(report_pure_usage): Ditto.
	(disksave_object_finalization): Ditto.
	(report_pure_usage): Modify message reported when Build is
	restarted due to change in PURESIZE_ADJUSTMENT.

	* puresize.h: Remove dependency on puresize_adjust.h.
	(get_PURESIZE): New function -- declare it.

	* pure.c: Move final PURESIZE computation and include of
	puresize_adjust.h into here so alloc.c need not be recompiled each 
	time the puresize is adjusted.
	(get_PURESIZE): New function.


Index: src/Makefile.in.in
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/src/Makefile.in.in,v
retrieving revision 1.32
diff -u -r1.32 Makefile.in.in
--- Makefile.in.in	1997/07/07 00:53:52	1.32
+++ Makefile.in.in	1997/07/08 02:44:37
@@ -946,7 +946,7 @@
 alloc.o: frame.h
 alloc.o: frameslots.h
 alloc.o: glyphs.h
-alloc.o: puresize.h puresize_adjust.h
+alloc.o: puresize.h
 alloc.o: redisplay.h
 alloc.o: scrollbar.h
 alloc.o: specifier.h


Index: src/puresize.h
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/src/puresize.h,v
retrieving revision 1.12
diff -u -r1.12 puresize.h
--- puresize.h	1997/04/05 18:08:40	1.12
+++ puresize.h	1997/07/08 02:38:29
@@ -171,15 +171,7 @@
 		      (SUNPRO_PURESIZE_EXTRA))
   
 #endif /* !RAW_PURESIZE */
-  
-/* Current build process on NT does not generate a puresize_adjust.h */
-/* file. --marcpa */  
-#ifdef WINDOWSNT
-# define PURESIZE_ADJUSTMENT 1000000
-#else
-# include <puresize_adjust.h>
-#endif
-#define PURESIZE ((RAW_PURESIZE) + (PURESIZE_ADJUSTMENT))
 
+extern long int get_PURESIZE(void);
 
 #endif /* PURESIZE_H */

Index: src/pure.c
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/src/pure.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 pure.c
--- pure.c	1996/12/18 22:44:06	1.1.1.1
+++ pure.c	1997/07/08 02:39:33
@@ -21,6 +21,23 @@
 #include "puresize.h"
 #include "lisp.h"
 
+/* Moved from puresize.h to here so alloc.c does not get recompiled */
+
+/* Current build process on NT does not generate a puresize_adjust.h */
+/* file. --marcpa */  
+#ifdef WINDOWSNT
+# define PURESIZE_ADJUSTMENT 1000000
+#else
+# include <puresize_adjust.h>
+#endif
+#define PURESIZE ((RAW_PURESIZE) + (PURESIZE_ADJUSTMENT))
+
+long int
+get_PURESIZE(void)
+{
+  return PURESIZE;
+}
+
 Lisp_Object pure[PURESIZE / sizeof (Lisp_Object)]
      /* Force linker to put it into data space! */
 #ifdef NO_UNION_TYPE

Index: src/alloc.c
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/src/alloc.c,v
retrieving revision 1.13
diff -u -r1.13 alloc.c
--- alloc.c	1997/07/07 00:53:53	1.13
+++ alloc.c	1997/07/08 02:43:12
@@ -181,11 +181,11 @@
 
 #define PURIFIED(ptr)							\
    ((uintptr_t) (ptr) <					\
-    (uintptr_t) (PUREBEG + PURESIZE) &&			\
+    (uintptr_t) (PUREBEG + get_PURESIZE()) &&			\
     (uintptr_t) (ptr) >=					\
     (uintptr_t) PUREBEG)
 
-/* Non-zero if pureptr > PURESIZE; accounts for excess purespace needs. */
+/* Non-zero if pureptr > get_PURESIZE(); accounts for excess purespace needs. */
 static long pure_lossage;
 
 #ifdef ERROR_CHECK_TYPECHECK
@@ -216,7 +216,7 @@
       pure_lossage += size;
       return (0);
     }
-  else if (pureptr + size > PURESIZE)
+  else if (pureptr + size > get_PURESIZE())
     {
       /* This can cause recursive bad behavior, we'll yell at the end */
       /* when we're done. */
@@ -2520,7 +2520,7 @@
 {
   struct lrecord_header *header = (void *) (PUREBEG + pureptr);
 
-  if (pureptr + size > PURESIZE)
+  if (pureptr + size > get_PURESIZE())
     pure_storage_exhausted ();
 
   set_lheader_implementation (header, implementation);
@@ -2629,20 +2629,20 @@
       message ("\n****\tPure Lisp storage exhausted!\n"
 "\tPurespace usage: %ld of %ld\n"
  "****",
-               PURESIZE+pure_lossage, (long) PURESIZE);
+               get_PURESIZE()+pure_lossage, (long) get_PURESIZE());
       if (die_if_pure_storage_exceeded) {
-	PURESIZE_h(PURESIZE + pure_lossage);
+	PURESIZE_h(get_PURESIZE() + pure_lossage);
 	rc = -1;
       }
     }
   else
     {
-      int lost = (PURESIZE - pureptr) / 1024;
+      int lost = (get_PURESIZE() - pureptr) / 1024;
       char buf[200];
 
       sprintf (buf, "Purespace usage: %ld of %ld (%d%%",
-               pureptr, (long) PURESIZE,
-               (int) (pureptr / (PURESIZE / 100.0) + 0.5));
+               pureptr, (long) get_PURESIZE(),
+               (int) (pureptr / (get_PURESIZE() / 100.0) + 0.5));
       if (lost > 2) {
         sprintf (buf + strlen (buf), " -- %dk wasted", lost);
 	if (die_if_pure_storage_exceeded) {
@@ -2739,7 +2739,7 @@
 				/* not know how to restart itself. */
 				/* --marcpa */ 
 #ifndef WINDOWSNT
-    fatal ("Pure size adjusted, will restart `make'");
+    fatal ("Pure size adjusted, Don't Panic!  I will restart the `make'");
 #endif
   } else if (pure_lossage && die_if_pure_storage_exceeded) {
     fatal ("Pure storage exhausted");
@@ -3917,7 +3917,7 @@
   /* Zero out the unused portion of purespace */
   if (!pure_lossage)
     memset (  (char *) (PUREBEG + pureptr), 0,
-	    (((char *) (PUREBEG + PURESIZE)) -
+	    (((char *) (PUREBEG + get_PURESIZE())) -
 	     ((char *) (PUREBEG + pureptr))));
 
   /* Zero out the uninitialized (really, unused) part of the containers

-- 
steve@calag.com baur
Unsolicited commercial e-mail will be billed at $250/message.

