diff src/eval.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 facf3239ba30
children d674024a8674
line wrap: on
line diff
--- a/src/eval.c	Thu Nov 24 22:51:25 2005 +0000
+++ b/src/eval.c	Fri Nov 25 01:42:08 2005 +0000
@@ -2238,7 +2238,9 @@
       ABORT ();
     }
 
+#ifndef NEW_GC
   assert (!gc_in_progress);
+#endif /* not NEW_GC */
 
   /* We abort if in_display and we are not protected, as garbage
      collections and non-local exits will invariably be fatal, but in
@@ -3371,14 +3373,32 @@
   int bindargs = min (nargs, max_non_rest_args);
 
   for (i = 0; i < bindargs; i++)
+#ifdef NEW_GC
+    SPECBIND_FAST_UNSAFE (XCOMPILED_FUNCTION_ARGS_DATA (f->arguments)[i],
+			  args[i]);
+#else /* not NEW_GC */
     SPECBIND_FAST_UNSAFE (f->args[i], args[i]);
+#endif /* not NEW_GC */
   for (i = bindargs; i < max_non_rest_args; i++)
+#ifdef NEW_GC
+    SPECBIND_FAST_UNSAFE (XCOMPILED_FUNCTION_ARGS_DATA (f->arguments)[i],
+			  Qnil);
+#else /* not NEW_GC */
     SPECBIND_FAST_UNSAFE (f->args[i], Qnil);
+#endif /* not NEW_GC */
+#ifdef NEW_GC
+  SPECBIND_FAST_UNSAFE
+    (XCOMPILED_FUNCTION_ARGS_DATA (f->arguments)[max_non_rest_args],
+     nargs > max_non_rest_args ?
+     Flist (nargs - max_non_rest_args, &args[max_non_rest_args]) :
+     Qnil);
+#else /* not NEW_GC */
   SPECBIND_FAST_UNSAFE
     (f->args[max_non_rest_args],
      nargs > max_non_rest_args ?
      Flist (nargs - max_non_rest_args, &args[max_non_rest_args]) :
      Qnil);
+#endif /* not NEW_GC */
 }
 
 /* Apply compiled-function object FUN to the NARGS evaluated arguments
@@ -3405,7 +3425,12 @@
     {
 #if 1
       for (i = 0; i < nargs; i++)
+#ifdef NEW_GC
+	SPECBIND_FAST_UNSAFE (XCOMPILED_FUNCTION_ARGS_DATA (f->arguments)[i],
+			      args[i]);
+#else /* not NEW_GC */
 	SPECBIND_FAST_UNSAFE (f->args[i], args[i]);
+#endif /* not NEW_GC */
 #else
       /* Here's an alternate way to write the loop that tries to further
          optimize funcalls for functions with few arguments by partially
@@ -3436,9 +3461,19 @@
   else if (nargs < f->max_args)
     {
       for (i = 0; i < nargs; i++)
+#ifdef NEW_GC
+	SPECBIND_FAST_UNSAFE (XCOMPILED_FUNCTION_ARGS_DATA (f->arguments)[i],
+			      args[i]);
+#else /* not NEW_GC */
 	SPECBIND_FAST_UNSAFE (f->args[i], args[i]);
+#endif /* not NEW_GC */
       for (i = nargs; i < f->max_args; i++)
+#ifdef NEW_GC
+	SPECBIND_FAST_UNSAFE (XCOMPILED_FUNCTION_ARGS_DATA (f->arguments)[i],
+			      Qnil);
+#else /* not NEW_GC */
 	SPECBIND_FAST_UNSAFE (f->args[i], Qnil);
+#endif /* not NEW_GC */
     }
   else if (f->max_args == MANY)
     handle_compiled_function_with_and_rest (f, nargs, args);
@@ -3527,7 +3562,11 @@
     {
       struct gcpro gcpro1;
       GCPRO1 (form);
+#ifdef NEW_GC
+      gc_incremental ();
+#else /* not NEW_GC */
       garbage_collect_1 ();
+#endif /* not NEW_GC */
       UNGCPRO;
     }
 
@@ -3779,7 +3818,11 @@
     {
       if (need_to_garbage_collect)
 	/* Callers should gcpro lexpr args */
+#ifdef NEW_GC
+	gc_incremental ();
+#else /* not NEW_GC */
 	garbage_collect_1 ();
+#endif /* not NEW_GC */
       if (need_to_check_c_alloca)
 	{
 	  if (++funcall_alloca_count >= MAX_FUNCALLS_BETWEEN_ALLOCA_CLEANUP)
@@ -4305,9 +4348,11 @@
     /* We need to bail out of here pronto. */
     return Qnil;
 
+#ifndef NEW_GC
   /* Whenever gc_in_progress is true, preparing_for_armageddon
      will also be true unless something is really hosed. */
   assert (!gc_in_progress);
+#endif /* not NEW_GC */
 
   sym = args[0];
   val = symbol_value_in_buffer (sym, wrap_buffer (buf));