Mercurial > hg > xemacs-beta
comparison src/sysdep.c @ 801:2b676dc88c66
[xemacs-hg @ 2002-04-01 03:58:02 by ben]
bug fixes (e.g. ballooning on X windows)
Makefile.in.in: Try to make the Makefile notice if its source Makefile.in.in is
changed, and regenerate and run itself.
Use a bigger default SHEAP_ADJUSTMENT on Cygwin; otherwise you
can't compile under Mule if a Lisp file has changed. (can't run
temacs)
TODO.ben-mule-21-5: update.
mule/mule-cmds.el: Hash the result of mswindows-get-language-environment-from-locale,
since it's very expensive (and causes huge ballooning of memory
under X Windows, since it's called from x-get-resource).
cl-extra.el, code-files.el, files.el, simple.el, subr.el, x-faces.el: Create new string-equal-ignore-case, based on built-in
compare-strings -- compare strings ignoring case without the need
to generate garbage by calling downcase. Use it in equalp and
elsewhere.
alloc.c, bytecode.c, chartab.c, data.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-unixoid.c, extents.c, file-coding.c, fileio.c, fns.c, glyphs.c, gutter.c, lisp-union.h, lisp.h, mule-charset.c, nt.c, process-unix.c, process.c, specifier.c, symbols.c, sysdep.c, sysdep.h, text.c, toolbar.c: Try to implement GC triggering based on percentage of total memory
usage. Not currently activated (percentage set to 0) because not
quite working. Add `memory-usage' primitive to return XEmacs'
idea of its memory usage.
Add primitive compare-strings, compatible with FSF 21.1 -- can
compare any part of two strings, optionally ignoring case.
Improve qxe() functions in text.c for text comparison.
Use RETURN_NOT_REACHED to try to avoid warnings about unreachable
code.
Add volatile_make_int() to fix warning in unix_send_process().
author | ben |
---|---|
date | Mon, 01 Apr 2002 03:59:04 +0000 |
parents | a5954632b187 |
children | 19dfb459d51a |
comparison
equal
deleted
inserted
replaced
800:a5954632b187 | 801:2b676dc88c66 |
---|---|
2132 | 2132 |
2133 /************************************************************************/ | 2133 /************************************************************************/ |
2134 /* limits of text/data segments */ | 2134 /* limits of text/data segments */ |
2135 /************************************************************************/ | 2135 /************************************************************************/ |
2136 | 2136 |
2137 #if !defined(CANNOT_DUMP) && !defined(PDUMP) | 2137 /* Need start_of_data() as much as possible now, for total_data_usage(); |
2138 but with PDUMP and WIN32_NATIVE, can't currently do it. */ | |
2139 #if !defined (CANNOT_DUMP) && (!defined (PDUMP) || !defined (WIN32_NATIVE)) | |
2138 #define NEED_STARTS | 2140 #define NEED_STARTS |
2139 #endif | 2141 #endif |
2140 | 2142 |
2141 #ifndef SYSTEM_MALLOC | 2143 #if !defined (SYSTEM_MALLOC) && !defined (NEED_STARTS) |
2142 #ifndef NEED_STARTS | |
2143 #define NEED_STARTS | 2144 #define NEED_STARTS |
2144 #endif | |
2145 #endif | 2145 #endif |
2146 | 2146 |
2147 #ifdef NEED_STARTS | 2147 #ifdef NEED_STARTS |
2148 /* Some systems that cannot dump also cannot implement these. */ | 2148 /* Some systems that cannot dump also cannot implement these. */ |
2149 | 2149 |
2152 * doing an unexec. After unexec the return value is undefined. | 2152 * doing an unexec. After unexec the return value is undefined. |
2153 * See crt0.c for further explanation and _start. | 2153 * See crt0.c for further explanation and _start. |
2154 * | 2154 * |
2155 */ | 2155 */ |
2156 | 2156 |
2157 #if !defined(HAVE_TEXT_START) && !defined(PDUMP) | 2157 #if !defined (HAVE_TEXT_START) && !defined (PDUMP) |
2158 | 2158 |
2159 EXTERN_C int _start (void); | 2159 EXTERN_C int _start (void); |
2160 | 2160 |
2161 char * | 2161 char * |
2162 start_of_text (void) | 2162 start_of_text (void) |
2193 * at the normal shared text boundary and the startofdata variable | 2193 * at the normal shared text boundary and the startofdata variable |
2194 * will be patched by unexec to the correct value. | 2194 * will be patched by unexec to the correct value. |
2195 * | 2195 * |
2196 */ | 2196 */ |
2197 | 2197 |
2198 #if defined(ORDINARY_LINK) && !defined(MINGW) | 2198 #if defined (ORDINARY_LINK) && !defined (MINGW) |
2199 extern char **environ; | 2199 extern char **environ; |
2200 #endif | 2200 #endif |
2201 | 2201 |
2202 void * | 2202 void * |
2203 start_of_data (void) | 2203 start_of_data (void) |
2215 #if defined (HEAP_IN_DATA) && !defined(PDUMP) | 2215 #if defined (HEAP_IN_DATA) && !defined(PDUMP) |
2216 extern char* static_heap_base; | 2216 extern char* static_heap_base; |
2217 if (!initialized) | 2217 if (!initialized) |
2218 return static_heap_base; | 2218 return static_heap_base; |
2219 #endif | 2219 #endif |
2220 return((char *) &environ); | 2220 return ((char *) &environ); |
2221 #else | 2221 #else |
2222 extern int data_start; | 2222 extern int data_start; |
2223 return ((char *) &data_start); | 2223 return ((char *) &data_start); |
2224 #endif /* ORDINARY_LINK */ | 2224 #endif /* ORDINARY_LINK */ |
2225 #endif /* DATA_START */ | 2225 #endif /* DATA_START */ |
2226 } | 2226 } |
2227 #endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */ | 2227 #endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */ |
2228 | |
2229 extern void *minimum_address_seen; /* from xmalloc() */ | |
2230 extern void *maximum_address_seen; /* from xmalloc() */ | |
2231 | |
2232 extern EMACS_INT consing_since_gc; | |
2233 | |
2234 Bytecount | |
2235 total_data_usage (void) | |
2236 { | |
2237 static EMACS_INT last_consing_since_gc; | |
2238 static void *last_sbrk; | |
2239 | |
2240 #ifdef NEED_STARTS | |
2241 void *data_start = start_of_data (); | |
2242 #else | |
2243 void *data_start = minimum_address_seen; | |
2244 #endif | |
2245 | |
2246 #if !defined (WIN32_NATIVE) && !defined (CYGWIN) | |
2247 void *data_end; | |
2248 | |
2249 /* Random hack to avoid calling sbrk constantly (every funcall). #### Is | |
2250 it worth it? */ | |
2251 if (!last_sbrk || !(consing_since_gc >= last_consing_since_gc && | |
2252 (consing_since_gc - last_consing_since_gc) < 1000)) | |
2253 { | |
2254 last_sbrk = sbrk (0); | |
2255 last_consing_since_gc = consing_since_gc; | |
2256 } | |
2257 data_end = last_sbrk; | |
2258 #else | |
2259 void *data_end = maximum_address_seen; | |
2260 #endif | |
2261 | |
2262 /* Sanity checking -- the min determined by malloc() should always be | |
2263 greater than data start determined by other means. We could do the | |
2264 same check on the max, except that things like rel-alloc might | |
2265 invalidate it. */ | |
2266 if (minimum_address_seen && | |
2267 (char *) minimum_address_seen < (char *) data_start) | |
2268 data_start = minimum_address_seen; | |
2269 | |
2270 if (data_end < data_start) /* Huh?????????? */ | |
2271 data_end = maximum_address_seen; | |
2272 | |
2273 /* #### Doesn't seem to give good results on Windows; values are much | |
2274 higher than actual memory usage. How to fix??? */ | |
2275 return (char *) data_end - (char *) data_start; | |
2276 } | |
2228 | 2277 |
2229 | 2278 |
2230 /************************************************************************/ | 2279 /************************************************************************/ |
2231 /* get the system name */ | 2280 /* get the system name */ |
2232 /************************************************************************/ | 2281 /************************************************************************/ |