annotate src/vm-limit.c @ 20892:18f3cb26243f before-miles-orphaned-changes gcc-2_8_1-980401 gcc-2_8_1-980407 gcc-2_8_1-980412 gcc-2_8_1-980413 gcc-2_8_1-RELEASE gcc_2_8_1-980315 libc-980214 libc-980215 libc-980216 libc-980217 libc-980218 libc-980219 libc-980220 libc-980221 libc-980222 libc-980223 libc-980224 libc-980225 libc-980226 libc-980227 libc-980228 libc-980301 libc-980302 libc-980303 libc-980304 libc-980306 libc-980307 libc-980308 libc-980309 libc-980310 libc-980311 libc-980312 libc-980313 libc-980314 libc-980315 libc-980316 libc-980317 libc-980318 libc-980319 libc-980320 libc-980321 libc-980322 libc-980323 libc-980324 libc-980325 libc-980326 libc-980327 libc-980328 libc-980329 libc-980330 libc-980331 libc-980401 libc-980402 libc-980403 libc-980404 libc-980405 libc-980406 libc-980407 libc-980408 libc-980409 libc-980410 libc-980411 libc-980412 libc-980413 libc-980414 libc-980428 libc-980429 libc-980430 libc-980501 libc-980502 libc-980503 libc-980504 libc-980505 libc-980506 libc-980507 libc-980508 libc-980509 libc-980510 libc-980512 libc-980513 libc-980514 libc-980515 libc-980516 libc-980517 libc-980518 libc-980519 libc-980520 libc-980521 libc-980522 libc-980523 libc-980524 libc-980525 libc-980526 libc-980527 libc-980528 libc-980529 libc-980530 libc-980531 libc-980601 libc-980602 libc-980603 libc-980604 libc-980605 libc-980606 libc-980607 libc-980608 libc-980609 libc-980610 libc-980611 libc-980612 libc-980613

Add PentiumII (i786). Add '7' to all i[3456] entries. Add AMD and Cyrix names for P5 and P6.
author Richard Kenner <kenner@gnu.org>
date Fri, 13 Feb 1998 12:16:46 +0000
parents ee40177f6c68
children 274b79aeb3b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1 /* Functions for memory limit warnings.
1398
70d0cd4c5bff mem_limits.h is now called mem-limits.h.
Roland McGrath <roland@gnu.org>
parents: 1392
diff changeset
2 Copyright (C) 1990, 1992 Free Software Foundation, Inc.
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
3
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
4 This file is part of GNU Emacs.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
5
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
1398
70d0cd4c5bff mem_limits.h is now called mem-limits.h.
Roland McGrath <roland@gnu.org>
parents: 1392
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
9 any later version.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14 GNU General Public License for more details.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 4696
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 4696
diff changeset
19 Boston, MA 02111-1307, USA. */
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
21 #ifdef emacs
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 3935
diff changeset
22 #include <config.h>
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
23 #include "lisp.h"
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
24 #endif
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
25
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
26 #ifndef emacs
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
27 #include <stddef.h>
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
28 typedef size_t SIZE;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
29 typedef void *POINTER;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
30 #define EXCEEDS_LISP_PTR(x) 0
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
31 #endif
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
32
1398
70d0cd4c5bff mem_limits.h is now called mem-limits.h.
Roland McGrath <roland@gnu.org>
parents: 1392
diff changeset
33 #include "mem-limits.h"
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
34
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
35 /*
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
36 Level number of warnings already issued.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
37 0 -- no warnings issued.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
38 1 -- 75% warning already issued.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
39 2 -- 85% warning already issued.
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
40 3 -- 95% warning issued; keep warning frequently.
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
41 */
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42 static int warnlevel;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
43
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
44 /* Function to call to issue a warning;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
45 0 means don't issue them. */
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
46 static void (*warn_function) ();
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
47
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
48 /* Get more memory space, complaining if we're near the end. */
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49
1416
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
50 static void
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
51 check_memory_limits ()
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
52 {
1417
3a1576d52874 (check_memory_limits): Declare __morecore.
Roland McGrath <roland@gnu.org>
parents: 1416
diff changeset
53 extern POINTER (*__morecore) ();
3a1576d52874 (check_memory_limits): Declare __morecore.
Roland McGrath <roland@gnu.org>
parents: 1416
diff changeset
54
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
55 register POINTER cp;
3935
cecc2b59e875 (check_memory_limits): Use unsigned long to hold memory size values.
Richard M. Stallman <rms@gnu.org>
parents: 1417
diff changeset
56 unsigned long five_percent;
cecc2b59e875 (check_memory_limits): Use unsigned long to hold memory size values.
Richard M. Stallman <rms@gnu.org>
parents: 1417
diff changeset
57 unsigned long data_size;
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
58
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
59 if (lim_data == 0)
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
60 get_lim_data ();
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
61 five_percent = lim_data / 20;
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
62
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
63 /* Find current end of memory and issue warning if getting near max */
1416
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
64 cp = (char *) (*__morecore) (0);
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
65 data_size = (char *) cp - (char *) data_space_start;
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
66
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
67 if (warn_function)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
68 switch (warnlevel)
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
69 {
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
70 case 0:
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
71 if (data_size > five_percent * 15)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
72 {
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
73 warnlevel++;
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
74 (*warn_function) ("Warning: past 75% of memory limit");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
75 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
76 break;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
77
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
78 case 1:
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
79 if (data_size > five_percent * 17)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
80 {
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
81 warnlevel++;
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
82 (*warn_function) ("Warning: past 85% of memory limit");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
83 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
84 break;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
85
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
86 case 2:
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
87 if (data_size > five_percent * 19)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
88 {
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
89 warnlevel++;
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
90 (*warn_function) ("Warning: past 95% of memory limit");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
91 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
92 break;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
93
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
94 default:
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
95 (*warn_function) ("Warning: past acceptable memory limits");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
96 break;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
97 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
98
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
99 /* If we go down below 70% full, issue another 75% warning
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
100 when we go up again. */
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
101 if (data_size < five_percent * 14)
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
102 warnlevel = 0;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
103 /* If we go down below 80% full, issue another 85% warning
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
104 when we go up again. */
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
105 else if (warnlevel > 1 && data_size < five_percent * 16)
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
106 warnlevel = 1;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
107 /* If we go down below 90% full, issue another 95% warning
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
108 when we go up again. */
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
109 else if (warnlevel > 2 && data_size < five_percent * 18)
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
110 warnlevel = 2;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
111
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
112 if (EXCEEDS_LISP_PTR (cp))
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
113 (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
114 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
115
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
116 /* Cause reinitialization based on job parameters;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
117 also declare where the end of pure storage is. */
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
118
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
119 void
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
120 memory_warnings (start, warnfun)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
121 POINTER start;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
122 void (*warnfun) ();
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
123 {
1416
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
124 extern void (* __after_morecore_hook) (); /* From gmalloc.c */
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
125
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
126 if (start)
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
127 data_space_start = start;
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
128 else
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
129 data_space_start = start_of_data ();
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
130
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
131 warn_function = warnfun;
1416
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
132 __after_morecore_hook = check_memory_limits;
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
133 }