diff 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
line wrap: on
line diff
--- a/src/emacs.c	Thu Nov 24 22:51:25 2005 +0000
+++ b/src/emacs.c	Fri Nov 25 01:42:08 2005 +0000
@@ -1312,6 +1312,9 @@
      the Lisp engine and need to be done both at dump time and at run time. */
 
   init_signals_very_early ();
+#ifdef NEW_GC
+  vdb_install_signal_handler ();
+#endif
   init_data_very_early (); /* Catch math errors. */
   init_floatfns_very_early (); /* Catch floating-point math errors. */
   init_process_times_very_early (); /* Initialize our process timers.
@@ -1397,6 +1400,8 @@
 
   init_alloc_early ();
 
+  init_gc_early ();
+
   if (!initialized)
     {
       /* Initialize things so that new Lisp objects
@@ -1406,6 +1411,8 @@
 	 routines below create new objects. */
       init_alloc_once_early ();
 
+      init_gc_once_early ();
+
       /* Initialize Qnil, Qt, Qunbound, and the
 	 obarray.  After this, symbols can be
 	 interned.  This depends on init_alloc_once_early(). */
@@ -1444,6 +1451,10 @@
 #ifdef MC_ALLOC
       syms_of_mc_alloc ();
 #endif /* MC_ALLOC */
+      syms_of_gc ();
+#ifdef NEW_GC
+      syms_of_vdb ();
+#endif /* NEW_GC */
       syms_of_buffer ();
       syms_of_bytecode ();
       syms_of_callint ();
@@ -1850,6 +1861,7 @@
 				 (note, we are inside ifdef PDUMP) */
     {
       reinit_alloc_early ();
+      reinit_gc_early ();
       reinit_symbols_early ();
 #ifndef MC_ALLOC
       reinit_opaque_early ();
@@ -2054,6 +2066,7 @@
       vars_of_font_lock ();
 #endif /* USE_C_FONT_LOCK */
       vars_of_frame ();
+      vars_of_gc ();
       vars_of_glyphs ();
       vars_of_glyphs_eimage ();
       vars_of_glyphs_widget ();
@@ -2394,9 +2407,6 @@
 #endif
 
       /* This calls Fmake_glyph_internal(). */
-      complex_vars_of_alloc ();
-
-      /* This calls Fmake_glyph_internal(). */
 #ifdef HAVE_MENUBARS
       complex_vars_of_menubar ();
 #endif
@@ -2439,6 +2449,8 @@
 	 might depend on all sorts of things; I'm not sure. */
       complex_vars_of_emacs ();
 
+      complex_vars_of_gc ();
+
       /* This creates a couple of basic keymaps and depends on Lisp
 	 hash tables and Ffset() (both of which depend on some variables
 	 initialized in the vars_of_*() section) and possibly other
@@ -2449,7 +2461,11 @@
       {
 	extern int always_gc;
 	if (always_gc)                /* purification debugging hack */
+#ifdef NEW_GC
+	  gc_full ();
+#else /* not NEW_GC */
 	  garbage_collect_1 ();
+#endif /* not NEW_GC */
       }
 #endif
     }
@@ -2928,7 +2944,11 @@
 {
   int i;
 
+#ifdef NEW_GC
+  if (gc_in_progress) gc_full ();
+#else /* not NEW_GC */
   assert (!gc_in_progress);
+#endif /* not NEW_GC */
 
   if (run_temacs_argc < 0)
     invalid_operation ("I've lost my temacs-hood", Qunbound);
@@ -3204,7 +3224,11 @@
   memory_warnings (my_edata, malloc_warning);
 #endif
 
+#ifdef NEW_GC
+  gc_full ();
+#else /* not NEW_GC */
   garbage_collect_1 ();
+#endif /* not NEW_GC */
 
 #ifdef PDUMP
   pdump ();
@@ -3728,12 +3752,28 @@
 
   guts_of_fatal_error_signal (sig);
 
+#ifdef NEW_GC
+  /* This time the signal will really be fatal. To be able to debug
+     SIGSEGV and SIGBUS also during write barrier, send SIGABRT. */
+#ifdef WIN32_NATIVE
+  if (sig == SIGSEGV)
+    raise (SIGABRT);
+  else
+    raise (sig);
+#else
+  if ((sig == SIGSEGV) || (sig == SIGBUS))
+    kill (qxe_getpid (), SIGABRT);
+  else
+    kill (qxe_getpid (),  sig);
+#endif
+#else /* not NEW_GC */
   /* Signal the same code; this time it will really be fatal. */
 #ifdef WIN32_NATIVE
   raise (sig);
 #else
   kill (qxe_getpid (), sig);
 #endif
+#endif /* not NEW_GC */
   SIGRETURN;
 }