comparison src/emacs.c @ 255:084402c475ba r20-5b26

Import from CVS: tag r20-5b26
author cvs
date Mon, 13 Aug 2007 10:21:18 +0200
parents 677f6a0ee643
children 65c19d2020f7
comparison
equal deleted inserted replaced
254:e92abcaa252b 255:084402c475ba
78 78
79 /* Set nonzero after XEmacs has started up the first time. 79 /* Set nonzero after XEmacs has started up the first time.
80 Prevents reinitialization of the Lisp world and keymaps 80 Prevents reinitialization of the Lisp world and keymaps
81 on subsequent starts. */ 81 on subsequent starts. */
82 int initialized; 82 int initialized;
83
84 #ifdef DOUG_LEA_MALLOC
85 # include <malloc.h>
86 /* Preserves a pointer to the memory allocated that copies that
87 static data inside glibc's malloc. */
88 void *malloc_state_ptr;
89 #endif
83 90
84 /* Variable whose value is symbol giving operating system type. */ 91 /* Variable whose value is symbol giving operating system type. */
85 Lisp_Object Vsystem_type; 92 Lisp_Object Vsystem_type;
86 93
87 /* Variable whose value is string giving configuration built for. */ 94 /* Variable whose value is string giving configuration built for. */
869 syms_of_print (); 876 syms_of_print ();
870 #if !defined (NO_SUBPROCESSES) 877 #if !defined (NO_SUBPROCESSES)
871 syms_of_process (); 878 syms_of_process ();
872 #endif 879 #endif
873 syms_of_profile (); 880 syms_of_profile ();
874 #if defined (HAVE_MMAP) && defined (REL_ALLOC) 881 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
875 syms_of_ralloc (); 882 syms_of_ralloc ();
876 #endif /* HAVE_MMAP && REL_ALLOC */ 883 #endif /* HAVE_MMAP && REL_ALLOC */
877 syms_of_rangetab (); 884 syms_of_rangetab ();
878 syms_of_redisplay (); 885 syms_of_redisplay ();
879 syms_of_search (); 886 syms_of_search ();
1203 vars_of_print (); 1210 vars_of_print ();
1204 #ifndef NO_SUBPROCESSES 1211 #ifndef NO_SUBPROCESSES
1205 vars_of_process (); 1212 vars_of_process ();
1206 #endif 1213 #endif
1207 vars_of_profile (); 1214 vars_of_profile ();
1208 #if defined (HAVE_MMAP) && defined (REL_ALLOC) 1215 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
1209 vars_of_ralloc (); 1216 vars_of_ralloc ();
1210 #endif /* HAVE_MMAP && REL_ALLOC */ 1217 #endif /* HAVE_MMAP && REL_ALLOC */
1211 vars_of_redisplay (); 1218 vars_of_redisplay ();
1212 #ifdef HAVE_SCROLLBARS 1219 #ifdef HAVE_SCROLLBARS
1213 vars_of_scrollbar (); 1220 vars_of_scrollbar ();
1873 lim_data = 0; /* force reinitialization of this variable */ 1880 lim_data = 0; /* force reinitialization of this variable */
1874 1881
1875 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */ 1882 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */
1876 assert (sizeof (Lisp_Object) == sizeof (void *)); 1883 assert (sizeof (Lisp_Object) == sizeof (void *));
1877 1884
1885 #ifdef LINUX_SBRK_BUG
1886 sbrk (1);
1887 #endif
1888
1878 if (!initialized) 1889 if (!initialized)
1879 { 1890 {
1891 #ifdef DOUG_LEA_MALLOC
1892 mallopt (M_MMAP_MAX, 0);
1893 #endif
1880 run_temacs_argc = 0; 1894 run_temacs_argc = 0;
1881 if (! SETJMP (run_temacs_catch)) 1895 if (! SETJMP (run_temacs_catch))
1882 { 1896 {
1883 main_1 (vol_argc, vol_argv, vol_envp, 0); 1897 main_1 (vol_argc, vol_argv, vol_envp, 0);
1884 } 1898 }
1911 #ifdef RUN_TIME_REMAP 1925 #ifdef RUN_TIME_REMAP
1912 else 1926 else
1913 /* obviously no-one uses this because where it was before initalized was 1927 /* obviously no-one uses this because where it was before initalized was
1914 *always* true */ 1928 *always* true */
1915 run_time_remap (argv[0]); 1929 run_time_remap (argv[0]);
1930 #endif
1931
1932 #ifdef DOUG_LEA_MALLOC
1933 if (initialized && (malloc_state_ptr != NULL))
1934 {
1935 malloc_set_state (malloc_state_ptr);
1936 #if 0
1937 free (malloc_state_ptr);
1938 #endif
1939 #if !defined(MULE) && !defined(DEBUG_DOUG_LEA_MALLOC)
1940 mallopt (M_MMAP_MAX, 64);
1941 #endif
1942 #ifdef REL_ALLOC
1943 r_alloc_reinit ();
1944 #endif
1945 }
1916 #endif 1946 #endif
1917 1947
1918 run_temacs_argc = -1; 1948 run_temacs_argc = -1;
1919 1949
1920 main_1 (vol_argc, vol_argv, vol_envp, restarted); 1950 main_1 (vol_argc, vol_argv, vol_envp, restarted);
2203 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext); 2233 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext);
2204 if (STRINGP (symname)) 2234 if (STRINGP (symname))
2205 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext); 2235 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext);
2206 else 2236 else
2207 symname_ext = 0; 2237 symname_ext = 0;
2238 #ifdef DOUG_LEA_MALLOC
2239 malloc_state_ptr = malloc_get_state ();
2240 #endif
2208 /* here we break our rule that the filename conversion should 2241 /* here we break our rule that the filename conversion should
2209 be performed at the actual time that the system call is made. 2242 be performed at the actual time that the system call is made.
2210 It's a whole lot easier to do the conversion here than to 2243 It's a whole lot easier to do the conversion here than to
2211 modify all the unexec routines to ensure that filename 2244 modify all the unexec routines to ensure that filename
2212 conversion is applied everywhere. Don't worry about memory 2245 conversion is applied everywhere. Don't worry about memory
2213 leakage because this call only happens once. */ 2246 leakage because this call only happens once. */
2214 unexec ((char *) intoname_ext, (char *) symname_ext, 2247 unexec ((char *) intoname_ext, (char *) symname_ext,
2215 (uintptr_t) my_edata, 2248 (uintptr_t) my_edata,
2216 0, 0); 2249 0, 0);
2250 #ifdef DOUG_LEA_MALLOC
2251 free (malloc_state_ptr);
2252 #endif
2217 } 2253 }
2218 #endif /* not MSDOS and EMX */ 2254 #endif /* not MSDOS and EMX */
2219 2255
2220 purify_flag = opurify; 2256 purify_flag = opurify;
2221 2257