From xemacs-m  Tue Feb 25 15:08:33 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 PAA08067
	for <xemacs-beta@xemacs.org>; Tue, 25 Feb 1997 15:08:30 -0600 (CST)
Received: (from steve@localhost)
	by altair.xemacs.org (8.8.5/8.8.5) id NAA19680;
	Tue, 25 Feb 1997 13:20:07 -0800
Mail-Copies-To: never
To: xemacs-beta@xemacs.org
Subject: Dynamic adjustment of PURESIZE (was Re: [19.15-b95] Success under Solaris-2.5/X11R6.3)
References: <vklo8e5aq3.fsf@cdc.noaa.gov> 	<m2ybcdncec.fsf@altair.xemacs.org> 	<QQceih18308.199702242148@crystal.WonderWorks.COM> 	<m2afotn832.fsf@altair.xemacs.org> <QQceik19037.199702242244@crystal.WonderWorks.COM>
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@miranova.com>
In-Reply-To: Kyle Jones's message of Mon, 24 Feb 1997 17:44:26 -0500 (EST)
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: multipart/mixed;
 boundary="Multipart_Tue_Feb_25_13:20:01_1997-1"
Content-Transfer-Encoding: 7bit
Date: 25 Feb 1997 13:20:01 -0800
Message-ID: <m2sp2k7fcu.fsf_-_@altair.xemacs.org>
Lines: 198
X-Mailer: Gnus v5.4.15/XEmacs 20.1

--Multipart_Tue_Feb_25_13:20:01_1997-1
Content-Type: text/plain; charset=US-ASCII

Kyle Jones writes:

I wrote:
>> The purespace area is a static fixed size array.  Time the sequence of
>> loading the .elcs for dumping, plus the amount of time necessary to
>> recompile after touching puresize.h.  It's no biggy if you're on a
>> fast machine, but I want to give those on slower machines a chance to
>> protest first.

> Given the time it takes XEmacs to compile now, a few more minutes
> hardly matters.  It already takes at least five times longer ot
> build XEmacs than to build the BSDI system kernel from scratch.

> The puresize.h rejigger only has to happen if the pure arrary is
> overflowed or if too much space is wasted.  temacs already knows
> this information; it just needs to pass it back to the build
> proceudre in some way.

O.K.  This is exactly what I've done.  Here is what it looks like:

Build 1:
 ...
Finding pointers to doc strings...
Finding pointers to doc strings...done
Dumping under the name xemacs
Purespace usage: 715628 of 750000 (95% -- 33k wasted).
 ...

XEmacs: Pure size changed, please restart the build.
make[1]: *** [xemacs] Error 1
make[1]: Leaving directory `/usr/src/xemacs-20.0/src'
make: *** [src] Error 2

Build 2:
 ...
Finding pointers to doc strings...
Finding pointers to doc strings...done
Dumping under the name xemacs
Purespace usage: 715628 of 715644 (100%).
 ...

:-)

This is a major hack, but appears to work for me.  Could people please
try this out?

You will need a new file called src/PURESIZE.h, it should look something
like:

--Multipart_Tue_Feb_25_13:20:01_1997-1
Content-Type: text/plain; charset=US-ASCII

/* This file is generated by XEmacs, DO NOT MODIFY!!! */
# define PURESIZE 715644

--Multipart_Tue_Feb_25_13:20:01_1997-1
Content-Type: text/plain; charset=US-ASCII


Index: Makefile.in.in
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/src/Makefile.in.in,v
retrieving revision 1.7
diff -u -r1.7 Makefile.in.in
--- Makefile.in.in	1997/02/24 01:14:44	1.7
+++ Makefile.in.in	1997/02/25 20:17:51
@@ -2070,7 +2070,7 @@
 alloc.o: frame.h
 alloc.o: frameslots.h
 alloc.o: glyphs.h
-alloc.o: puresize.h
+alloc.o: puresize.h PURESIZE.h
 alloc.o: redisplay.h
 alloc.o: scrollbar.h
 alloc.o: specifier.h
@@ -3249,7 +3249,7 @@
 pure.o: blocktype.h
 pure.o: config.h
 pure.o: dynarr.h
-pure.o: puresize.h
+pure.o: puresize.h PURESIZE.h
 ralloc.o: blocktype.h
 ralloc.o: config.h
 ralloc.o: dynarr.h

Index: puresize.h
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/src/puresize.h,v
retrieving revision 1.7
diff -u -r1.7 puresize.h
--- puresize.h	1997/02/24 01:15:06	1.7
+++ puresize.h	1997/02/25 20:19:32
@@ -28,6 +28,7 @@
    configure time. */
 #ifndef PURESIZE
 
+#if 0
 /* Basic amount of purespace to use, in the absence of extra
    things configured in. */
 
@@ -130,6 +131,10 @@
 		  (SYSTEM_PURESIZE_EXTRA) + (MULE_PURESIZE_EXTRA) +	  \
 		  (TOOLTALK_PURESIZE_EXTRA) + (ENERGIZE_PURESIZE_EXTRA) + \
 		  (SUNPRO_PURESIZE_EXTRA))
+#endif
+
+/* Computed by XEmacs */
+# include "PURESIZE.h"
 
 #endif /* !PURESIZE */
 
Index: alloc.c
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/src/alloc.c,v
retrieving revision 1.3
diff -u -r1.3 alloc.c
--- alloc.c	1997/02/24 01:14:45	1.3
+++ alloc.c	1997/02/25 20:54:44
@@ -2595,10 +2595,32 @@
 
 
 
+static void
+PURESIZE_h(long int puresize)
+{
+  int fd;
+  char *PURESIZE_h_file = "PURESIZE.h";
+  char *WARNING = "/* This file is generated by XEmacs, DO NOT MODIFY!!! */\n";
+  char define_PURESIZE[256];
+
+  if ((fd = open(PURESIZE_h_file, O_WRONLY)) < 0) {
+    report_file_error("Can't write PURESIZE",
+		      Fcons(build_ext_string(PURESIZE_h_file, FORMAT_FILENAME),
+			    Qnil));
+  }
+
+  write(fd, WARNING, strlen(WARNING));
+  sprintf(define_PURESIZE, "# define PURESIZE %ld\n", puresize);
+  write(fd, define_PURESIZE, strlen(define_PURESIZE));
+  close(fd);
+}
+
 void
 report_pure_usage (int report_impurities,
                    int die_if_pure_storage_exceeded)
 {
+  int rc;
+
   if (pure_lossage)
     {
       CONST long report_round = 5000;
@@ -2613,6 +2635,9 @@
 	       (long) PURESIZE,
                (((pure_lossage + report_round - 1)
                  / report_round) * report_round));
+      PURESIZE_h(PURESIZE + (((pure_lossage + report_round - 1)
+			      / report_round) * report_round));
+      rc = -1;
     }
   else
     {
@@ -2622,8 +2647,13 @@
       sprintf (buf, "Purespace usage: %ld of %ld (%d%%",
                pureptr, (long) PURESIZE,
                (int) (pureptr / (PURESIZE / 100.0) + 0.5));
-      if (lost > 2)
+      if (lost > 2) {
         sprintf (buf + strlen (buf), " -- %dk wasted", lost);
+	PURESIZE_h(pureptr + 16);
+	rc = -1;
+      } else {
+	rc = 0;
+      }
       strcat (buf, ").");
       message ("%s", buf);
     }
@@ -2706,8 +2736,11 @@
     }
   clear_message ();
 
-  if (pure_lossage && die_if_pure_storage_exceeded)
+  if (pure_lossage && die_if_pure_storage_exceeded) {
     fatal ("Pure storage exhausted");
+  } else if (rc < 0) {
+    fatal ("Pure size changed, please restart the build.");
+  }
 }
 
 

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

--Multipart_Tue_Feb_25_13:20:01_1997-1--

