comparison src/emacs.c @ 3092:141c2920ea48

[xemacs-hg @ 2005-11-25 01:41:31 by crestani] Incremental Garbage Collector
author crestani
date Fri, 25 Nov 2005 01:42:08 +0000
parents b7f26b2f78bd
children ad2f4ae9895b
comparison
equal deleted inserted replaced
3091:c22d8984148c 3092:141c2920ea48
1310 /* First, do really basic environment initialization -- catching signals 1310 /* First, do really basic environment initialization -- catching signals
1311 and the like. These functions have no dependence on any part of 1311 and the like. These functions have no dependence on any part of
1312 the Lisp engine and need to be done both at dump time and at run time. */ 1312 the Lisp engine and need to be done both at dump time and at run time. */
1313 1313
1314 init_signals_very_early (); 1314 init_signals_very_early ();
1315 #ifdef NEW_GC
1316 vdb_install_signal_handler ();
1317 #endif
1315 init_data_very_early (); /* Catch math errors. */ 1318 init_data_very_early (); /* Catch math errors. */
1316 init_floatfns_very_early (); /* Catch floating-point math errors. */ 1319 init_floatfns_very_early (); /* Catch floating-point math errors. */
1317 init_process_times_very_early (); /* Initialize our process timers. 1320 init_process_times_very_early (); /* Initialize our process timers.
1318 As early as possible, of course, 1321 As early as possible, of course,
1319 so we can be fairly accurate. */ 1322 so we can be fairly accurate. */
1395 purify_flag = 1; 1398 purify_flag = 1;
1396 #endif 1399 #endif
1397 1400
1398 init_alloc_early (); 1401 init_alloc_early ();
1399 1402
1403 init_gc_early ();
1404
1400 if (!initialized) 1405 if (!initialized)
1401 { 1406 {
1402 /* Initialize things so that new Lisp objects 1407 /* Initialize things so that new Lisp objects
1403 can be created and objects can be staticpro'd. 1408 can be created and objects can be staticpro'd.
1404 Must be basically the very first thing done 1409 Must be basically the very first thing done
1405 because pretty much all of the initialization 1410 because pretty much all of the initialization
1406 routines below create new objects. */ 1411 routines below create new objects. */
1407 init_alloc_once_early (); 1412 init_alloc_once_early ();
1408 1413
1414 init_gc_once_early ();
1415
1409 /* Initialize Qnil, Qt, Qunbound, and the 1416 /* Initialize Qnil, Qt, Qunbound, and the
1410 obarray. After this, symbols can be 1417 obarray. After this, symbols can be
1411 interned. This depends on init_alloc_once_early(). */ 1418 interned. This depends on init_alloc_once_early(). */
1412 init_symbols_once_early (); 1419 init_symbols_once_early ();
1413 1420
1442 syms_of_abbrev (); 1449 syms_of_abbrev ();
1443 syms_of_alloc (); 1450 syms_of_alloc ();
1444 #ifdef MC_ALLOC 1451 #ifdef MC_ALLOC
1445 syms_of_mc_alloc (); 1452 syms_of_mc_alloc ();
1446 #endif /* MC_ALLOC */ 1453 #endif /* MC_ALLOC */
1454 syms_of_gc ();
1455 #ifdef NEW_GC
1456 syms_of_vdb ();
1457 #endif /* NEW_GC */
1447 syms_of_buffer (); 1458 syms_of_buffer ();
1448 syms_of_bytecode (); 1459 syms_of_bytecode ();
1449 syms_of_callint (); 1460 syms_of_callint ();
1450 syms_of_casefiddle (); 1461 syms_of_casefiddle ();
1451 syms_of_casetab (); 1462 syms_of_casetab ();
1848 #ifdef PDUMP 1859 #ifdef PDUMP
1849 else if (!restart) /* after successful pdump_load() 1860 else if (!restart) /* after successful pdump_load()
1850 (note, we are inside ifdef PDUMP) */ 1861 (note, we are inside ifdef PDUMP) */
1851 { 1862 {
1852 reinit_alloc_early (); 1863 reinit_alloc_early ();
1864 reinit_gc_early ();
1853 reinit_symbols_early (); 1865 reinit_symbols_early ();
1854 #ifndef MC_ALLOC 1866 #ifndef MC_ALLOC
1855 reinit_opaque_early (); 1867 reinit_opaque_early ();
1856 #endif /* not MC_ALLOC */ 1868 #endif /* not MC_ALLOC */
1857 reinit_eistring_early (); 1869 reinit_eistring_early ();
2052 vars_of_fns (); 2064 vars_of_fns ();
2053 #ifdef USE_C_FONT_LOCK 2065 #ifdef USE_C_FONT_LOCK
2054 vars_of_font_lock (); 2066 vars_of_font_lock ();
2055 #endif /* USE_C_FONT_LOCK */ 2067 #endif /* USE_C_FONT_LOCK */
2056 vars_of_frame (); 2068 vars_of_frame ();
2069 vars_of_gc ();
2057 vars_of_glyphs (); 2070 vars_of_glyphs ();
2058 vars_of_glyphs_eimage (); 2071 vars_of_glyphs_eimage ();
2059 vars_of_glyphs_widget (); 2072 vars_of_glyphs_widget ();
2060 vars_of_gui (); 2073 vars_of_gui ();
2061 vars_of_gutter (); 2074 vars_of_gutter ();
2392 #ifdef HAVE_MS_WINDOWS 2405 #ifdef HAVE_MS_WINDOWS
2393 complex_vars_of_glyphs_mswindows (); 2406 complex_vars_of_glyphs_mswindows ();
2394 #endif 2407 #endif
2395 2408
2396 /* This calls Fmake_glyph_internal(). */ 2409 /* This calls Fmake_glyph_internal(). */
2397 complex_vars_of_alloc ();
2398
2399 /* This calls Fmake_glyph_internal(). */
2400 #ifdef HAVE_MENUBARS 2410 #ifdef HAVE_MENUBARS
2401 complex_vars_of_menubar (); 2411 complex_vars_of_menubar ();
2402 #endif 2412 #endif
2403 2413
2404 #ifdef HAVE_SCROLLBARS 2414 #ifdef HAVE_SCROLLBARS
2437 2447
2438 /* These two might call Ffile_name_as_directory(), which 2448 /* These two might call Ffile_name_as_directory(), which
2439 might depend on all sorts of things; I'm not sure. */ 2449 might depend on all sorts of things; I'm not sure. */
2440 complex_vars_of_emacs (); 2450 complex_vars_of_emacs ();
2441 2451
2452 complex_vars_of_gc ();
2453
2442 /* This creates a couple of basic keymaps and depends on Lisp 2454 /* This creates a couple of basic keymaps and depends on Lisp
2443 hash tables and Ffset() (both of which depend on some variables 2455 hash tables and Ffset() (both of which depend on some variables
2444 initialized in the vars_of_*() section) and possibly other 2456 initialized in the vars_of_*() section) and possibly other
2445 stuff. */ 2457 stuff. */
2446 complex_vars_of_keymap (); 2458 complex_vars_of_keymap ();
2447 2459
2448 #ifdef ERROR_CHECK_GC 2460 #ifdef ERROR_CHECK_GC
2449 { 2461 {
2450 extern int always_gc; 2462 extern int always_gc;
2451 if (always_gc) /* purification debugging hack */ 2463 if (always_gc) /* purification debugging hack */
2464 #ifdef NEW_GC
2465 gc_full ();
2466 #else /* not NEW_GC */
2452 garbage_collect_1 (); 2467 garbage_collect_1 ();
2468 #endif /* not NEW_GC */
2453 } 2469 }
2454 #endif 2470 #endif
2455 } 2471 }
2456 else 2472 else
2457 { 2473 {
2926 tools like Purify or tcov that get confused by XEmacs' dumping. */ 2942 tools like Purify or tcov that get confused by XEmacs' dumping. */
2927 (int nargs, Lisp_Object *args)) 2943 (int nargs, Lisp_Object *args))
2928 { 2944 {
2929 int i; 2945 int i;
2930 2946
2947 #ifdef NEW_GC
2948 if (gc_in_progress) gc_full ();
2949 #else /* not NEW_GC */
2931 assert (!gc_in_progress); 2950 assert (!gc_in_progress);
2951 #endif /* not NEW_GC */
2932 2952
2933 if (run_temacs_argc < 0) 2953 if (run_temacs_argc < 0)
2934 invalid_operation ("I've lost my temacs-hood", Qunbound); 2954 invalid_operation ("I've lost my temacs-hood", Qunbound);
2935 2955
2936 run_temacs_argc = nargs + 1; 2956 run_temacs_argc = nargs + 1;
3202 /* Also arrange for warnings when nearly out of space. */ 3222 /* Also arrange for warnings when nearly out of space. */
3203 #ifndef SYSTEM_MALLOC 3223 #ifndef SYSTEM_MALLOC
3204 memory_warnings (my_edata, malloc_warning); 3224 memory_warnings (my_edata, malloc_warning);
3205 #endif 3225 #endif
3206 3226
3227 #ifdef NEW_GC
3228 gc_full ();
3229 #else /* not NEW_GC */
3207 garbage_collect_1 (); 3230 garbage_collect_1 ();
3231 #endif /* not NEW_GC */
3208 3232
3209 #ifdef PDUMP 3233 #ifdef PDUMP
3210 pdump (); 3234 pdump ();
3211 #elif defined (WIN32_NATIVE) 3235 #elif defined (WIN32_NATIVE)
3212 unexec (XSTRING_DATA (filename), 3236 unexec (XSTRING_DATA (filename),
3726 code below, we avoid a deadlock. */ 3750 code below, we avoid a deadlock. */
3727 EMACS_UNBLOCK_SIGNAL (sig); 3751 EMACS_UNBLOCK_SIGNAL (sig);
3728 3752
3729 guts_of_fatal_error_signal (sig); 3753 guts_of_fatal_error_signal (sig);
3730 3754
3755 #ifdef NEW_GC
3756 /* This time the signal will really be fatal. To be able to debug
3757 SIGSEGV and SIGBUS also during write barrier, send SIGABRT. */
3758 #ifdef WIN32_NATIVE
3759 if (sig == SIGSEGV)
3760 raise (SIGABRT);
3761 else
3762 raise (sig);
3763 #else
3764 if ((sig == SIGSEGV) || (sig == SIGBUS))
3765 kill (qxe_getpid (), SIGABRT);
3766 else
3767 kill (qxe_getpid (), sig);
3768 #endif
3769 #else /* not NEW_GC */
3731 /* Signal the same code; this time it will really be fatal. */ 3770 /* Signal the same code; this time it will really be fatal. */
3732 #ifdef WIN32_NATIVE 3771 #ifdef WIN32_NATIVE
3733 raise (sig); 3772 raise (sig);
3734 #else 3773 #else
3735 kill (qxe_getpid (), sig); 3774 kill (qxe_getpid (), sig);
3736 #endif 3775 #endif
3776 #endif /* not NEW_GC */
3737 SIGRETURN; 3777 SIGRETURN;
3738 } 3778 }
3739 3779
3740 #ifdef _MSC_VER 3780 #ifdef _MSC_VER
3741 3781