Mercurial > hg > xemacs-beta
changeset 3263:d674024a8674
[xemacs-hg @ 2006-02-27 16:29:00 by crestani]
- Introduce a fancy asynchronous finalization strategy on C level.
- Merge the code conditioned on MC_ALLOC into the code conditioned on
NEW_GC.
- Remove the possibility to free objects manually outside garbage
collections when the new collector is enabled.
author | crestani |
---|---|
date | Mon, 27 Feb 2006 16:29:29 +0000 |
parents | 79d41cfd8e6b |
children | 030da3c757eb |
files | ChangeLog configure configure.ac nt/ChangeLog nt/config.inc.samp nt/xemacs.mak src/ChangeLog src/Makefile.in.in src/alloc.c src/buffer.c src/bytecode.c src/bytecode.h src/config.h.in src/console-stream.c src/console.c src/dumper.c src/dumper.h src/elhash.c src/emacs.c src/eval.c src/event-msw.c src/event-stream.c src/extents.c src/faces.h src/file-coding.c src/gc.c src/gc.h src/glyphs.h src/gui.c src/lisp.h src/lrecord.h src/lstream.c src/marker.c src/mc-alloc.c src/mc-alloc.h src/opaque.c src/print.c src/ralloc.c src/specifier.c src/symbols.c src/symeval.h src/symsinit.h src/tests.c src/xemacs.def.in.in |
diffstat | 44 files changed, 646 insertions(+), 720 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Feb 26 22:51:04 2006 +0000 +++ b/ChangeLog Mon Feb 27 16:29:29 2006 +0000 @@ -1,3 +1,8 @@ +2006-02-22 Marcus Crestani <crestani@xemacs.org> + + * configure.ac: Remove mc-alloc, replace it with newgc, adjust + output and comments. + 2006-02-26 Stephen J. Turnbull <stephen@xemacs.org> * XEmacs 21.5.25 "eggplant" is released.
--- a/configure Sun Feb 26 22:51:04 2006 +0000 +++ b/configure Mon Feb 27 16:29:29 2006 +0000 @@ -1174,10 +1174,10 @@ --with-pdump Enable portable LISP preloader. --with-dump-in-exec Enable dumping into executable (enabled by default for `pdump', not enabled by default in combination - with `mc-alloc'). - --with-kkcc Enable experimental new GC algorithms. - --with-mc-alloc Enable experimental new allocator. - --with-newgc Enable new incremental garbage collector. + with `newgc'). + --with-kkcc Enable experimental new GC mark algorithms. + --with-newgc Enable new incremental garbage collector and new + allocator. --with-vdb=TYPE Override auto-detection of virtual-dirty-bit write-barrier implementation for the new garbage collector. TYPE must be one of "auto" (for @@ -3575,24 +3575,7 @@ else enable_kkcc=yes fi; -# If --with-mc-alloc or --without-mc-alloc were given then copy the value to the -# equivalent enable_mc-alloc variable. -if test "${with_mc_alloc+set}" = set; then - enable_mc_alloc="$with_mc_alloc" -fi; -# If -enable-mc-alloc or --disable-mc-alloc were given then copy the value to the -# equivalent with_mc-alloc variable. -if test "${enable_mc_alloc+set}" = set; then - with_mc_alloc="$enable_mc_alloc" -fi; -# Check whether --with-mc-alloc or --without-mc-alloc was given. -if test "${with_mc_alloc+set}" = set; then - enableval="$with_mc_alloc" - withval="$with_mc_alloc" - -else - enable_mc_alloc=yes -fi; + # If --with-newgc or --without-newgc were given then copy the value to the # equivalent enable_newgc variable. if test "${with_newgc+set}" = set; then @@ -8996,11 +8979,10 @@ fi test -z "$enable_kkcc" && enable_kkcc=yes -test -z "$enable_mc_alloc" && enable_mc_alloc=yes if test -z "$enable_dump_in_exec"; then if test "$enable_pdump" = "yes"; then - if test "$enable_mc_alloc" = "yes"; then + if test "$enable_newgc" = "yes"; then enable_dump_in_exec=no else enable_dump_in_exec=yes @@ -9009,7 +8991,6 @@ fi if test "$enable_newgc" = "yes"; then - enable_mc_alloc=yes enable_kkcc=yes fi @@ -39163,10 +39144,6 @@ #define USE_KKCC 1 _ACEOF -test "$enable_mc_alloc" = "yes" && cat >>confdefs.h <<\_ACEOF -#define MC_ALLOC 1 -_ACEOF - test "$enable_newgc" = "yes" && cat >>confdefs.h <<\_ACEOF #define NEW_GC 1 _ACEOF @@ -39481,22 +39458,14 @@ echo " WARNING: ---------------------------------------------------------" fi if test "$enable_kkcc" = yes ; then - echo " Using the new GC algorithms." + echo " Using the new GC mark algorithms (KKCC)." echo " WARNING: ---------------------------------------------------------" echo " WARNING: The new algorithms are experimental. They are enabled by" echo " WARNING: default for this release. Use \`--disable-kkcc' to" echo " WARNING: turn it off." echo " WARNING: ---------------------------------------------------------" fi -if test "$enable_mc_alloc" = yes ; then - echo " Using the new allocator." - echo " WARNING: ---------------------------------------------------------" - echo " WARNING: The new allocator is experimental. It is enabled by" - echo " WARNING: default for this release. Use \`--disable-mc-alloc' to" - echo " WARNING: turn it off." - echo " WARNING: ---------------------------------------------------------" -fi -test "$enable_newgc" = yes && echo " Using the new incremental garbage collector." +test "$enable_newgc" = yes && echo " Using the new incremental garbage collector and the new allocator." if test "$have_vdb_posix" = yes ; then if test "$have_vdb_sigaction" = yes ; then echo " Using POSIX sigaction() to install fault handler."
--- a/configure.ac Sun Feb 26 22:51:04 2006 +0000 +++ b/configure.ac Mon Feb 27 16:29:29 2006 +0000 @@ -919,16 +919,14 @@ XE_MERGED_ARG([dump-in-exec], AC_HELP_STRING([--enable-dump-in-exec],[Enable dumping into executable (enabled by default for `pdump', not enabled by default in combination - with `mc-alloc').]), + with `newgc').]), [], []) XE_MERGED_ARG([kkcc], - AC_HELP_STRING([--enable-kkcc],[Enable experimental new GC algorithms.]), + AC_HELP_STRING([--enable-kkcc],[Enable experimental new GC mark algorithms.]), [], [enable_kkcc=yes]) -XE_MERGED_ARG([mc-alloc], - AC_HELP_STRING([--enable-mc-alloc],[Enable experimental new allocator.]), - [], [enable_mc_alloc=yes]) + XE_MERGED_ARG([newgc], - AC_HELP_STRING([--enable-newgc],[Enable new incremental garbage collector.]), + AC_HELP_STRING([--enable-newgc],[Enable new incremental garbage collector and new allocator.]), [], []) XE_COMPLEX_ARG([vdb], AC_HELP_STRING([--enable-vdb=TYPE],[Override auto-detection of @@ -2128,14 +2126,13 @@ lib_gcc= fi -dnl Enable KKCC and MC-ALLOC by default +dnl Enable KKCC by default test -z "$enable_kkcc" && enable_kkcc=yes -test -z "$enable_mc_alloc" && enable_mc_alloc=yes dnl Dump into executable if test -z "$enable_dump_in_exec"; then if test "$enable_pdump" = "yes"; then - if test "$enable_mc_alloc" = "yes"; then + if test "$enable_newgc" = "yes"; then enable_dump_in_exec=no else enable_dump_in_exec=yes @@ -2145,7 +2142,6 @@ dnl New incremental garbage collector if test "$enable_newgc" = "yes"; then - enable_mc_alloc=yes enable_kkcc=yes fi @@ -5830,7 +5826,6 @@ test "$GCC" = "yes" && AC_DEFINE(USE_GCC) test "$enable_external_widget" = "yes" && AC_DEFINE(EXTERNAL_WIDGET) test "$enable_kkcc" = "yes" && AC_DEFINE(USE_KKCC) -test "$enable_mc_alloc" = "yes" && AC_DEFINE(MC_ALLOC) test "$enable_newgc" = "yes" && AC_DEFINE(NEW_GC) test "$have_vdb_posix" = "yes" && AC_DEFINE(VDB_POSIX) test "$have_vdb_fake" = "yes" && AC_DEFINE(VDB_FAKE) @@ -6115,22 +6110,14 @@ echo " WARNING: ---------------------------------------------------------" fi if test "$enable_kkcc" = yes ; then - echo " Using the new GC algorithms." + echo " Using the new GC mark algorithms (KKCC)." echo " WARNING: ---------------------------------------------------------" echo " WARNING: The new algorithms are experimental. They are enabled by" echo " WARNING: default for this release. Use \`--disable-kkcc' to" echo " WARNING: turn it off." echo " WARNING: ---------------------------------------------------------" fi -if test "$enable_mc_alloc" = yes ; then - echo " Using the new allocator." - echo " WARNING: ---------------------------------------------------------" - echo " WARNING: The new allocator is experimental. It is enabled by" - echo " WARNING: default for this release. Use \`--disable-mc-alloc' to" - echo " WARNING: turn it off." - echo " WARNING: ---------------------------------------------------------" -fi -test "$enable_newgc" = yes && echo " Using the new incremental garbage collector." +test "$enable_newgc" = yes && echo " Using the new incremental garbage collector and the new allocator." if test "$have_vdb_posix" = yes ; then if test "$have_vdb_sigaction" = yes ; then echo " Using POSIX sigaction() to install fault handler."
--- a/nt/ChangeLog Sun Feb 26 22:51:04 2006 +0000 +++ b/nt/ChangeLog Mon Feb 27 16:29:29 2006 +0000 @@ -1,3 +1,8 @@ +2006-02-22 Marcus Crestani <crestani@xemacs.org> + + * xemacs.mak: Remove mc-alloc, replace with newgc, adjust output. + * config.inc.samp: Remove MC_ALLOC option. + 2006-02-26 Stephen J. Turnbull <stephen@xemacs.org> * XEmacs 21.5.25 "eggplant" is released.
--- a/nt/config.inc.samp Sun Feb 26 22:51:04 2006 +0000 +++ b/nt/config.inc.samp Mon Feb 27 16:29:29 2006 +0000 @@ -220,10 +220,8 @@ # of the traditional XEmacs garbage-collection routines. USE_KKCC=1 -# Set this to use the new experimental allocator routines -MC_ALLOC=1 - -# Set this to use the new experimental incremental garbage collector routines +# Set this to use the new experimental incremental garbage collector +# and the new allocator routines NEW_GC=0 # Set this to turn on the use of the union type, which gets you improved
--- a/nt/xemacs.mak Sun Feb 26 22:51:04 2006 +0000 +++ b/nt/xemacs.mak Mon Feb 27 16:29:29 2006 +0000 @@ -215,9 +215,6 @@ !if !defined(USE_KKCC) USE_KKCC=0 !endif -!if !defined(MC_ALLOC) -MC_ALLOC=0 -!endif !if !defined(NEW_GC) NEW_GC=0 !endif @@ -644,20 +641,15 @@ !if $(NEW_GC) OPT_DEFINES=$(OPT_DEFINES) -DNEW_GC -OPT_OBJS=$(OPT_OBJS) $(OUTDIR)\vdb.obj $(OUTDIR)\vdb-win32.obj +OPT_OBJS=$(OPT_OBJS) $(OUTDIR)\vdb.obj $(OUTDIR)\vdb-win32.obj \ + $(OUTDIR)\mc-alloc.obj USE_KKCC=1 -MC_ALLOC=1 !endif !if $(USE_KKCC) OPT_DEFINES=$(OPT_DEFINES) -DUSE_KKCC !endif -!if $(MC_ALLOC) -OPT_DEFINES=$(OPT_DEFINES) -DMC_ALLOC -OPT_OBJS=$(OPT_OBJS) $(OUTDIR)\mc-alloc.obj -!endif - !if $(USE_SYSTEM_MALLOC) OPT_DEFINES=$(OPT_DEFINES) -DSYSTEM_MALLOC !else @@ -1266,13 +1258,10 @@ Disabling non-essential build actions. Use with care! !endif !if $(USE_KKCC) - Using new experimental GC algorithms. -!endif -!if $(MC_ALLOC) - Using new experimental allocator. + Using new experimental GC mark algorithms. !endif !if $(NEW_GC) - Using new experimental incremental garbage collector. + Using new experimental incremental garbage collector and new allocator. !endif <<NOKEEP @echo --------------------------------------------------------------------
--- a/src/ChangeLog Sun Feb 26 22:51:04 2006 +0000 +++ b/src/ChangeLog Mon Feb 27 16:29:29 2006 +0000 @@ -1,3 +1,78 @@ +2006-02-22 Marcus Crestani <crestani@xemacs.org> + + Asynchronous finalization: + + * Makefile.in.in: Remove mc-alloc, replace with newgc. + * alloc.c (alloc_lrecord): Add object that has a finalizer + to Vall_finalizable_objs. + * alloc.c (noseeum_alloc_lrecord): Add object that has a finalizer + to Vall_finalizable_objs. + * alloc.c (alloc_lrecord_array): Add object that has a finalizer + to Vall_finalizable_objs. + * alloc.c (free_lrecord): Disable manual free. + * dumper.c (pdump_register_object): Objects with finalizers cannot + be dumped. + * eval.c (Ffuncall): Add call to run_finalizers. + * gc.c (finalize_elem): New. + * gc.c (add_finalizable_object): New. + * gc.c (register_for_finalization): New. + * gc.c (gc_finalize): Call register_for_finalization. + * gc.c (gc_1): Move kkcc_gc_stack_free after finalization. + * gc.c (common_init_gc_early): Add asynchronous finalization + variables. + * gc.c (init_gc_early): Add asynchronous finalization variables. + * gc.c (vars_of_gc): Add asynchronous finalization variables. + * gc.h: Add asynchronous finalization prototypes. + * mc-alloc.c (finalize_heap): Remove. + * mc-alloc.c (mc_free): Disable manual free. + + * elhash.c (finalize_hash_table): Remove unneeded finalizer for + NEW_GC + * extents.c (finalize_extent_info): Remove unneeded finalizer for + NEW_GC. + * file-coding.c (finalize_coding_system): Remove unneeded + finalizer for NEW_GC. + * gui.c (finalize_gui_item): Remove unneeded finalizer. + * specifier.c (finalize_specifier): Remove unneeded finalizer for + NEW_GC. + + Merge #ifdef MC_ALLOC into #ifdef NEW_GC, remove no longer needed + MC_ALLOC specific code in all files: + * alloc.c: + * buffer.c: + * bytecode.c: + * bytecode.h: + * config.h.in: + * console-stream.c: + * console.c: + * dumper.c: + * dumper.h: + * elhash.c: + * emacs.c: + * event-msw.c: + * event-stream.c: + * extents.c: + * extents.c: + * faces.h: + * file-coding.c: + * gc.c: + * glyphs.h: + * lisp.h: + * lrecord.h: + * lstream.c: + * marker.c: + * mc-alloc.c: + * mc-alloc.h: + * opaque.c: + * print.c: + * ralloc.c: + * specifier.c: + * symbols.c: + * symeval.h: + * symsinit.h: + * tests.c: + * xemacs.def.in.in: + 2006-02-26 Stephen J. Turnbull <stephen@xemacs.org> * XEmacs 21.5.25 "eggplant" is released.
--- a/src/Makefile.in.in Sun Feb 26 22:51:04 2006 +0000 +++ b/src/Makefile.in.in Mon Feb 27 16:29:29 2006 +0000 @@ -254,12 +254,8 @@ xemacs_res.o #endif -#ifdef MC_ALLOC -mc_alloc_objs=mc-alloc.o -#endif - #ifdef NEW_GC -new_gc_objs=vdb.o +new_gc_objs=mc-alloc.o vdb.o # if defined (WIN32_ANY) || defined (VDB_WIN32) vdb_objs=vdb-win32.o # elif defined (VDB_MACH) @@ -294,7 +290,7 @@ gutter.o\ hash.o imgproc.o indent.o insdel.o intl.o\ keymap.o $(RTC_patch_objs) line-number.o $(ldap_objs) lread.o lstream.o\ - $(mc_alloc_objs) $(new_gc_objs) $(vdb_objs) \ + $(new_gc_objs) $(vdb_objs) \ macros.o marker.o md5.o minibuf.o $(mswindows_objs) $(mswindows_gui_objs)\ $(mule_objs) $(mule_canna_objs) $(mule_wnn_objs) $(number_objs) objects.o\ opaque.o $(postgresql_objs) print.o process.o $(process_objs) $(profile_objs)\
--- a/src/alloc.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/alloc.c Mon Feb 27 16:29:29 2006 +0000 @@ -191,13 +191,13 @@ void *minimum_address_seen; void *maximum_address_seen; -#ifndef MC_ALLOC +#ifndef NEW_GC int c_readonly (Lisp_Object obj) { return POINTER_TYPE_P (XTYPE (obj)) && C_READONLY (obj); } -#endif /* MC_ALLOC */ +#endif /* not NEW_GC */ int lisp_readonly (Lisp_Object obj) @@ -216,7 +216,7 @@ int ignore_malloc_warnings; -#ifndef MC_ALLOC +#ifndef NEW_GC void *breathing_space; void @@ -229,7 +229,7 @@ xfree (tmp, void *); } } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* malloc calls this if it finds we are near exhausting storage */ void @@ -258,9 +258,9 @@ */ consing_since_gc = gc_cons_threshold + 1; recompute_need_to_garbage_collect (); -#ifndef MC_ALLOC +#ifndef NEW_GC release_breathing_space (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Flush some histories which might conceivably contain garbalogical inhibitors. */ @@ -302,7 +302,7 @@ } \ while (0) -#ifdef MC_ALLOC +#ifdef NEW_GC #define FREE_OR_REALLOC_BEGIN(block) \ do \ { \ @@ -313,7 +313,7 @@ MALLOC_BEGIN (); \ } \ while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define FREE_OR_REALLOC_BEGIN(block) \ do \ { \ @@ -329,7 +329,7 @@ MALLOC_BEGIN (); \ } \ while (0) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #define MALLOC_END() \ do \ @@ -415,7 +415,7 @@ #ifdef ERROR_CHECK_GC -#ifndef MC_ALLOC +#ifndef NEW_GC static void deadbeef_memory (void *ptr, Bytecount size) { @@ -426,7 +426,7 @@ while (beefs--) (*ptr4++) = 0xDEADBEEF; /* -559038737 base 10 */ } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #else /* !ERROR_CHECK_GC */ @@ -455,7 +455,7 @@ #endif /* NEED_STRDUP */ -#ifndef MC_ALLOC +#ifndef NEW_GC static void * allocate_lisp_storage (Bytecount size) { @@ -480,9 +480,9 @@ return val; } -#endif /* not MC_ALLOC */ - -#if defined (MC_ALLOC) && defined (ALLOC_TYPE_STATS) +#endif /* not NEW_GC */ + +#if defined (NEW_GC) && defined (ALLOC_TYPE_STATS) static struct { int instances_in_use; @@ -539,16 +539,16 @@ size += lrecord_stats[i].bytes_in_use; return size; } -#endif /* not (MC_ALLOC && ALLOC_TYPE_STATS) */ - -#ifndef MC_ALLOC +#endif /* NEW_GC && ALLOC_TYPE_STATS */ + +#ifndef NEW_GC /* lcrecords are chained together through their "next" field. After doing the mark phase, GC will walk this linked list and free any lcrecord which hasn't been marked. */ static struct old_lcrecord_header *all_lcrecords; -#endif /* not MC_ALLOC */ - -#ifdef MC_ALLOC +#endif /* not NEW_GC */ + +#ifdef NEW_GC /* The basic lrecord allocation functions. See lrecord.h for details. */ void * alloc_lrecord (Bytecount size, @@ -567,6 +567,8 @@ #ifdef ALLOC_TYPE_STATS inc_lrecord_stats (size, lheader); #endif /* ALLOC_TYPE_STATS */ + if (implementation->finalizer) + add_finalizable_obj (wrap_pointer_1 (lheader)); INCREMENT_CONS_COUNTER (size, implementation->name); return lheader; } @@ -589,11 +591,12 @@ #ifdef ALLOC_TYPE_STATS inc_lrecord_stats (size, lheader); #endif /* ALLOC_TYPE_STATS */ + if (implementation->finalizer) + add_finalizable_obj (wrap_pointer_1 (lheader)); NOSEEUM_INCREMENT_CONS_COUNTER (size, implementation->name); return lheader; } -#ifdef NEW_GC void * alloc_lrecord_array (Bytecount size, int elemcount, const struct lrecord_implementation *implementation) @@ -619,35 +622,20 @@ #ifdef ALLOC_TYPE_STATS inc_lrecord_stats (size, lh); #endif /* not ALLOC_TYPE_STATS */ + if (implementation->finalizer) + add_finalizable_obj (wrap_pointer_1 (lh)); } INCREMENT_CONS_COUNTER (size * elemcount, implementation->name); return lheader; } -#endif /* NEW_GC */ void -free_lrecord (Lisp_Object lrecord) +free_lrecord (Lisp_Object UNUSED (lrecord)) { -#ifndef NEW_GC - gc_checking_assert (!gc_in_progress); -#endif /* not NEW_GC */ - gc_checking_assert (!LRECORD_FREE_P (XRECORD_LHEADER (lrecord))); - gc_checking_assert (!XRECORD_LHEADER (lrecord)->free); - -#ifdef NEW_GC - GC_STAT_EXPLICITLY_TRIED_FREED; - /* Ignore requests to manual free objects while in garbage collection. */ - if (write_barrier_enabled || gc_in_progress) - return; - - GC_STAT_EXPLICITLY_FREED; -#endif /* NEW_GC */ - - MC_ALLOC_CALL_FINALIZER (XPNTR (lrecord)); - mc_free (XPNTR (lrecord)); - recompute_need_to_garbage_collect (); + /* Manual frees are not allowed with asynchronous finalization */ + return; } -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* The most basic of the lcrecord allocation functions. Not usually called directly. Allocates an lrecord not managed by any lcrecord-list, of a @@ -719,15 +707,15 @@ return; } #endif /* Unused */ -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ static void disksave_object_finalization_1 (void) { -#ifdef MC_ALLOC +#ifdef NEW_GC mc_finalize_for_disksave (); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ struct old_lcrecord_header *header; for (header = all_lcrecords; header; header = header->next) @@ -736,7 +724,7 @@ !header->free) LHEADER_IMPLEMENTATION (&header->lheader)->finalizer (header, 1); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } /* Bitwise copy all parts of a Lisp object other than the header */ @@ -751,11 +739,11 @@ assert (imp == XRECORD_LHEADER_IMPLEMENTATION (dst)); assert (size == lisp_object_size (dst)); -#ifdef MC_ALLOC +#ifdef NEW_GC memcpy ((char *) XRECORD_LHEADER (dst) + sizeof (struct lrecord_header), (char *) XRECORD_LHEADER (src) + sizeof (struct lrecord_header), size - sizeof (struct lrecord_header)); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ if (imp->basic_p) memcpy ((char *) XRECORD_LHEADER (dst) + sizeof (struct lrecord_header), (char *) XRECORD_LHEADER (src) + sizeof (struct lrecord_header), @@ -766,7 +754,7 @@ (char *) XRECORD_LHEADER (src) + sizeof (struct old_lcrecord_header), size - sizeof (struct old_lcrecord_header)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } @@ -814,7 +802,7 @@ } -#ifdef MC_ALLOC +#ifdef NEW_GC #define DECLARE_FIXED_TYPE_ALLOC(type, structture) struct __foo__ #else /************************************************************************/ @@ -1164,9 +1152,9 @@ #else #define FREE_FIXED_TYPE_WHEN_NOT_IN_GC(type, structtype, ptr) #endif -#endif /* not MC_ALLOC */ - -#ifdef MC_ALLOC +#endif /* NEW_GC */ + +#ifdef NEW_GC #define ALLOCATE_FIXED_TYPE_AND_SET_IMPL(type, lisp_type, var, lrec_ptr) \ do { \ (var) = alloc_lrecord_type (lisp_type, lrec_ptr); \ @@ -1176,7 +1164,7 @@ do { \ (var) = noseeum_alloc_lrecord_type (lisp_type, lrec_ptr); \ } while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define ALLOCATE_FIXED_TYPE_AND_SET_IMPL(type, lisp_type, var, lrec_ptr) \ do \ { \ @@ -1190,7 +1178,7 @@ NOSEEUM_ALLOCATE_FIXED_TYPE (type, lisp_type, var); \ set_lheader_implementation (&(var)->lheader, lrec_ptr); \ } while (0) -#endif /* MC_ALLOC */ +#endif /* not NEW_GC */ @@ -2292,7 +2280,7 @@ return *string_plist_ptr (string); } -#ifndef MC_ALLOC +#ifndef NEW_GC /* No `finalize', or `hash' methods. internal_hash() already knows how to hash strings and finalization is done with the ADDITIONAL_FREE_string macro, which is the @@ -2309,7 +2297,7 @@ string_remprop, string_plist, Lisp_String); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #ifdef NEW_GC #define STRING_FULLSIZE(size) \ @@ -2348,32 +2336,7 @@ #define MARK_STRING_CHARS_AS_FREE(ptr) ((void) ((ptr)->string = NULL)) #endif /* not NEW_GC */ -#ifdef MC_ALLOC -#ifndef NEW_GC -static void -finalize_string (void *header, int for_disksave) -{ - if (!for_disksave) - { - Lisp_String *s = (Lisp_String *) header; - Bytecount size = s->size_; - if (BIG_STRING_SIZE_P (size)) - xfree (s->data_, Ibyte *); - } -} - -DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("string", string, - 1, /*dumpable-flag*/ - mark_string, print_string, - finalize_string, - string_equal, 0, - string_description, - string_getprop, - string_putprop, - string_remprop, - string_plist, - Lisp_String); -#else /* NEW_GC */ +#ifdef NEW_GC DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("string", string, 1, /*dumpable-flag*/ mark_string, print_string, @@ -2422,7 +2385,6 @@ string_indirect_data_description, Lisp_String_Indirect_Data); #endif /* NEW_GC */ -#endif /* MC_ALLOC */ #ifndef NEW_GC struct string_chars @@ -2524,14 +2486,14 @@ assert (length >= 0 && fullsize > 0); -#ifdef MC_ALLOC +#ifdef NEW_GC s = alloc_lrecord_type (Lisp_String, &lrecord_string); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* Allocate the string header */ ALLOCATE_FIXED_TYPE (string, Lisp_String, s); xzero (*s); set_lheader_implementation (&s->u.lheader, &lrecord_string); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* The above allocations set the UID field, which overlaps with the ascii-length field, to some non-zero value. We need to zero it. */ @@ -2616,7 +2578,7 @@ memmove (XSTRING_DATA (s) + pos + delta, XSTRING_DATA (s) + pos, len); -#else /* NEW_GC */ +#else /* not NEW_GC */ oldfullsize = STRING_FULLSIZE (XSTRING_LENGTH (s)); newfullsize = STRING_FULLSIZE (XSTRING_LENGTH (s) + delta); @@ -2929,17 +2891,17 @@ bytecount_to_charcount (contents, length); /* Just for the assertions */ #endif -#ifdef MC_ALLOC +#ifdef NEW_GC s = alloc_lrecord_type (Lisp_String, &lrecord_string); mcpro (wrap_pointer_1 (s)); /* otherwise nocopy_strings get collected and static data is tried to be freed. */ -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* Allocate the string header */ ALLOCATE_FIXED_TYPE (string, Lisp_String, s); set_lheader_implementation (&s->u.lheader, &lrecord_string); SET_C_READONLY_RECORD_HEADER (&s->u.lheader); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Don't need to XSET_STRING_ASCII_BEGIN() here because it happens in init_string_ascii_begin(). */ s->plist = Qnil; @@ -2963,7 +2925,7 @@ } -#ifndef MC_ALLOC +#ifndef NEW_GC /************************************************************************/ /* lcrecord lists */ /************************************************************************/ @@ -3171,7 +3133,7 @@ free_managed_lcrecord (all_lcrecord_lists[type], rec); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ DEFUN ("purecopy", Fpurecopy, 1, 1, 0, /* @@ -3350,7 +3312,7 @@ -#ifdef MC_ALLOC +#ifdef NEW_GC static const struct memory_description mcpro_description_1[] = { { XD_END } }; @@ -3421,10 +3383,10 @@ } #endif /* not DEBUG_XEMACS */ -#endif /* MC_ALLOC */ - - -#ifndef MC_ALLOC +#endif /* NEW_GC */ + + +#ifndef NEW_GC static int gc_count_num_short_string_in_use; static Bytecount gc_count_string_total_size; static Bytecount gc_count_short_string_total_size; @@ -3470,10 +3432,10 @@ } } } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ -#ifndef MC_ALLOC +#ifndef NEW_GC /* Free all unmarked records */ static void sweep_lcrecords_1 (struct old_lcrecord_header **prev, int *used) @@ -3669,10 +3631,10 @@ #define SWEEP_FIXED_TYPE_BLOCK(typename, obj_type) \ SWEEP_FIXED_TYPE_BLOCK_1 (typename, obj_type, lheader) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_conses (void) { @@ -3681,20 +3643,20 @@ SWEEP_FIXED_TYPE_BLOCK (cons, Lisp_Cons); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Explicitly free a cons cell. */ void free_cons (Lisp_Object cons) { -#ifndef MC_ALLOC /* to avoid compiler warning */ +#ifndef NEW_GC /* to avoid compiler warning */ Lisp_Cons *ptr = XCONS (cons); -#endif /* MC_ALLOC */ +#endif /* not NEW_GC */ #ifdef ERROR_CHECK_GC -#ifdef MC_ALLOC +#ifdef NEW_GC Lisp_Cons *ptr = XCONS (cons); -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ /* If the CAR is not an int, then it will be a pointer, which will always be four-byte aligned. If this cons cell has already been placed on the free list, however, its car will probably contain @@ -3709,11 +3671,11 @@ ASSERT_VALID_POINTER (XPNTR (cons_car (ptr))); #endif /* ERROR_CHECK_GC */ -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (cons); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (cons, Lisp_Cons, ptr); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } /* explicitly free a list. You **must make sure** that you have @@ -3751,7 +3713,7 @@ } } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_compiled_functions (void) { @@ -3830,11 +3792,11 @@ SWEEP_FIXED_TYPE_BLOCK (event, Lisp_Event); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #ifdef EVENT_DATA_AS_OBJECTS -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_key_data (void) { @@ -3843,19 +3805,19 @@ SWEEP_FIXED_TYPE_BLOCK (key_data, Lisp_Key_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_key_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (key_data, Lisp_Key_Data, XKEY_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_button_data (void) { @@ -3864,19 +3826,19 @@ SWEEP_FIXED_TYPE_BLOCK (button_data, Lisp_Button_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_button_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (button_data, Lisp_Button_Data, XBUTTON_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_motion_data (void) { @@ -3885,19 +3847,19 @@ SWEEP_FIXED_TYPE_BLOCK (motion_data, Lisp_Motion_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_motion_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (motion_data, Lisp_Motion_Data, XMOTION_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_process_data (void) { @@ -3906,19 +3868,19 @@ SWEEP_FIXED_TYPE_BLOCK (process_data, Lisp_Process_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_process_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (process_data, Lisp_Process_Data, XPROCESS_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_timeout_data (void) { @@ -3927,19 +3889,19 @@ SWEEP_FIXED_TYPE_BLOCK (timeout_data, Lisp_Timeout_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_timeout_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (timeout_data, Lisp_Timeout_Data, XTIMEOUT_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_magic_data (void) { @@ -3948,19 +3910,19 @@ SWEEP_FIXED_TYPE_BLOCK (magic_data, Lisp_Magic_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_magic_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (magic_data, Lisp_Magic_Data, XMAGIC_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_magic_eval_data (void) { @@ -3969,19 +3931,19 @@ SWEEP_FIXED_TYPE_BLOCK (magic_eval_data, Lisp_Magic_Eval_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_magic_eval_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (magic_eval_data, Lisp_Magic_Eval_Data, XMAGIC_EVAL_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_eval_data (void) { @@ -3990,19 +3952,19 @@ SWEEP_FIXED_TYPE_BLOCK (eval_data, Lisp_Eval_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_eval_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (eval_data, Lisp_Eval_Data, XEVAL_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_misc_user_data (void) { @@ -4011,21 +3973,21 @@ SWEEP_FIXED_TYPE_BLOCK (misc_user_data, Lisp_Misc_User_Data); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void free_misc_user_data (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (misc_user_data, Lisp_Misc_User_Data, XMISC_USER_DATA (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } #endif /* EVENT_DATA_AS_OBJECTS */ -#ifndef MC_ALLOC +#ifndef NEW_GC static void sweep_markers (void) { @@ -4038,17 +4000,17 @@ SWEEP_FIXED_TYPE_BLOCK (marker, Lisp_Marker); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Explicitly free a marker. */ void free_marker (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ FREE_FIXED_TYPE_WHEN_NOT_IN_GC (marker, Lisp_Marker, XMARKER (ptr)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } @@ -4201,7 +4163,7 @@ } #endif /* not NEW_GC */ -#ifndef MC_ALLOC +#ifndef NEW_GC #if 1 /* Hack to debug missing purecopy's */ static int debug_string_purity; @@ -4224,9 +4186,9 @@ stderr_out ("\"\n"); } #endif /* 1 */ -#endif /* not MC_ALLOC */ - -#ifndef MC_ALLOC +#endif /* not NEW_GC */ + +#ifndef NEW_GC static void sweep_strings (void) { @@ -4259,17 +4221,12 @@ gc_count_string_total_size = num_bytes; gc_count_short_string_total_size = num_small_bytes; } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #ifndef NEW_GC void gc_sweep_1 (void) { -#ifdef MC_ALLOC - compact_string_chars (); - mc_finalize (); - mc_sweep (); -#else /* not MC_ALLOC */ /* Free all unmarked records. Do this at the very beginning, before anything else, so that the finalize methods can safely examine items in the objects. sweep_lcrecords_1() makes @@ -4344,13 +4301,12 @@ sweep_eval_data (); sweep_misc_user_data (); #endif /* EVENT_DATA_AS_OBJECTS */ -#endif /* not MC_ALLOC */ - -#ifndef MC_ALLOC +#endif /* not NEW_GC */ + +#ifndef NEW_GC #ifdef PDUMP pdump_objects_unmark (); #endif -#endif /* not MC_ALLOC */ } #endif /* not NEW_GC */ @@ -4440,7 +4396,7 @@ int i; EMACS_INT tgu_val = 0; -#ifdef MC_ALLOC +#ifdef NEW_GC for (i = 0; i < (countof (lrecord_implementations_table) + MODULE_DEFINABLE_TYPE_COUNT); i++) @@ -4475,7 +4431,7 @@ } } -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define HACK_O_MATIC(type, name, pl) do { \ EMACS_INT s = 0; \ @@ -4577,7 +4533,7 @@ #undef HACK_O_MATIC -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ if (set_total_gc_usage) { @@ -4625,7 +4581,7 @@ total_gc_usage_set = 0; #ifdef ALLOC_TYPE_STATS /* The things we do for backwards-compatibility */ -#ifdef MC_ALLOC +#ifdef NEW_GC return list6 (Fcons (make_int (lrecord_stats[lrecord_type_cons].instances_in_use), @@ -4642,7 +4598,7 @@ make_int (lrecord_stats[lrecord_type_vector] .bytes_in_use_including_overhead), object_memory_usage_stats (1)); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ return list6 (Fcons (make_int (gc_count_num_cons_in_use), make_int (gc_count_num_cons_freelist)), @@ -4654,7 +4610,7 @@ make_int (lcrecord_stats[lrecord_type_vector].bytes_in_use + lcrecord_stats[lrecord_type_vector].bytes_freed), object_memory_usage_stats (1)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #else /* not ALLOC_TYPE_STATS */ return Qnil; #endif /* ALLOC_TYPE_STATS */ @@ -4849,7 +4805,7 @@ return claimed_size; } -#ifndef MC_ALLOC +#ifndef NEW_GC Bytecount fixed_type_block_overhead (Bytecount size) { @@ -4865,7 +4821,7 @@ overhead += sizeof (void *) + per_block - storage_size; return overhead; } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #endif /* MEMORY_USAGE_STATS */ @@ -4883,12 +4839,10 @@ Qnull_pointer = wrap_pointer_1 (0); #endif -#ifndef MC_ALLOC +#ifndef NEW_GC breathing_space = 0; -#endif /* not MC_ALLOC */ -#ifndef MC_ALLOC all_lcrecords = 0; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ ignore_malloc_warnings = 1; #ifdef DOUG_LEA_MALLOC mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */ @@ -4899,8 +4853,6 @@ #endif #ifndef NEW_GC init_string_chars_alloc (); -#endif /* not NEW_GC */ -#ifndef MC_ALLOC init_string_alloc (); init_string_chars_alloc (); init_cons_alloc (); @@ -4930,7 +4882,7 @@ init_eval_data_alloc (); init_misc_user_data_alloc (); #endif /* EVENT_DATA_AS_OBJECTS */ -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ ignore_malloc_warnings = 0; @@ -4945,7 +4897,7 @@ Dynarr_resize (staticpro_nodump_names, 100); /* ditto */ #endif -#ifdef MC_ALLOC +#ifdef NEW_GC mcpros = Dynarr_new2 (Lisp_Object_dynarr, Lisp_Object); Dynarr_resize (mcpros, 1410); /* merely a small optimization */ dump_add_root_block_ptr (&mcpros, &mcpros_description); @@ -4954,7 +4906,7 @@ Dynarr_resize (mcpro_names, 1410); /* merely a small optimization */ dump_add_root_block_ptr (&mcpro_names, &mcpro_names_description); #endif -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ consing_since_gc = 0; need_to_check_c_alloca = 0; @@ -4962,9 +4914,9 @@ funcall_alloca_count = 0; lrecord_uid_counter = 259; -#ifndef MC_ALLOC +#ifndef NEW_GC debug_string_purity = 0; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #ifdef ERROR_CHECK_TYPES ERROR_ME.really_unlikely_name_to_have_accidentally_in_a_non_errb_structure = @@ -4980,7 +4932,7 @@ #endif /* ERROR_CHECK_TYPES */ } -#ifndef MC_ALLOC +#ifndef NEW_GC static void init_lcrecord_lists (void) { @@ -4992,7 +4944,7 @@ staticpro_nodump (&all_lcrecord_lists[i]); } } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void init_alloc_early (void) @@ -5013,9 +4965,9 @@ reinit_alloc_early (void) { common_init_alloc_early (); -#ifndef MC_ALLOC +#ifndef NEW_GC init_lcrecord_lists (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } void @@ -5036,10 +4988,10 @@ INIT_LRECORD_IMPLEMENTATION (string_indirect_data); INIT_LRECORD_IMPLEMENTATION (string_direct_data); #endif /* NEW_GC */ -#ifndef MC_ALLOC +#ifndef NEW_GC INIT_LRECORD_IMPLEMENTATION (lcrecord_list); INIT_LRECORD_IMPLEMENTATION (free); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ staticpros = Dynarr_new2 (Lisp_Object_ptr_dynarr, Lisp_Object *); Dynarr_resize (staticpros, 1410); /* merely a small optimization */ @@ -5050,7 +5002,7 @@ dump_add_root_block_ptr (&staticpro_names, &staticpro_names_description); #endif -#ifdef MC_ALLOC +#ifdef NEW_GC mcpros = Dynarr_new2 (Lisp_Object_dynarr, Lisp_Object); Dynarr_resize (mcpros, 1410); /* merely a small optimization */ dump_add_root_block_ptr (&mcpros, &mcpros_description); @@ -5059,11 +5011,9 @@ Dynarr_resize (mcpro_names, 1410); /* merely a small optimization */ dump_add_root_block_ptr (&mcpro_names, &mcpro_names_description); #endif -#endif /* MC_ALLOC */ - -#ifndef MC_ALLOC +#else /* not NEW_GC */ init_lcrecord_lists (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } void
--- a/src/buffer.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/buffer.c Mon Feb 27 16:29:29 2006 +0000 @@ -2130,7 +2130,7 @@ /* The docstrings for DEFVAR_* are recorded externally by make-docfile. */ -#ifdef MC_ALLOC +#ifdef NEW_GC #define DEFVAR_BUFFER_LOCAL_1(lname, field_name, forward_type, magic_fun) \ do \ { \ @@ -2155,7 +2155,7 @@ } \ } while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* Renamed from DEFVAR_PER_BUFFER because FSFmacs D_P_B takes a bogus extra arg, which confuses an otherwise identical make-docfile.c */ #define DEFVAR_BUFFER_LOCAL_1(lname, field_name, forward_type, magicfun) \ @@ -2189,7 +2189,7 @@ = intern (lname); \ } \ } while (0) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #define DEFVAR_BUFFER_LOCAL_MAGIC(lname, field_name, magicfun) \ DEFVAR_BUFFER_LOCAL_1 (lname, field_name, \
--- a/src/bytecode.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/bytecode.c Mon Feb 27 16:29:29 2006 +0000 @@ -2247,29 +2247,6 @@ { XD_END } }; -#if defined(MC_ALLOC) && !defined(NEW_GC) -static void -finalize_compiled_function (void *header, int for_disksave) -{ - if (!for_disksave) - { - struct Lisp_Compiled_Function *cf = - (struct Lisp_Compiled_Function *) header; - if (cf->args_in_array) - xfree (cf->args, Lisp_Object *); - } -} - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("compiled-function", compiled_function, - 1, /*dumpable_flag*/ - mark_compiled_function, - print_compiled_function, - finalize_compiled_function, - compiled_function_equal, - compiled_function_hash, - compiled_function_description, - Lisp_Compiled_Function); -#else /* !MC_ALLOC || NEW_GC */ DEFINE_BASIC_LRECORD_IMPLEMENTATION ("compiled-function", compiled_function, 1, /*dumpable_flag*/ mark_compiled_function, @@ -2278,7 +2255,6 @@ compiled_function_hash, compiled_function_description, Lisp_Compiled_Function); -#endif /* !MC_ALLOC || NEW_GC */ DEFUN ("compiled-function-p", Fcompiled_function_p, 1, 1, 0, /*
--- a/src/bytecode.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/bytecode.h Mon Feb 27 16:29:29 2006 +0000 @@ -55,7 +55,7 @@ #define compiled_function_args_data(v) ((v)->args) #define XCOMPILED_FUNCTION_ARGS_DATA(s) \ compiled_function_args_data (XCOMPILED_FUNCTION_ARGS (s)) -#endif /* not NEW_GC */ +#endif /* NEW_GC */ /* Meanings of slots in a Lisp_Compiled_Function. Don't use these! For backward compatibility only. */
--- a/src/config.h.in Sun Feb 26 22:51:04 2006 +0000 +++ b/src/config.h.in Mon Feb 27 16:29:29 2006 +0000 @@ -693,10 +693,8 @@ /* If defined, use experimental pdump-based GC algorithms. */ #undef USE_KKCC -/* If defined, use experimental allocator. */ -#undef MC_ALLOC - -/* If defined, use experimental incremental garbage collector. */ +/* If defined, use experimental incremental garbage collector and new + allocator. */ #undef NEW_GC /* Virtual dirty bit implementation for incremental gc. */
--- a/src/console-stream.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/console-stream.c Mon Feb 27 16:29:29 2006 +0000 @@ -137,9 +137,7 @@ if (stream_con->in != stdin) retry_fclose (stream_con->in); -#ifdef NEW_GC - mc_free (stream_con); -#else /* not NEW_GC */ +#ifndef NEW_GC xfree (stream_con, struct stream_console *); #endif /* not NEW_GC */ CONSOLE_STREAM_DATA (con) = NULL;
--- a/src/console.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/console.c Mon Feb 27 16:29:29 2006 +0000 @@ -1202,7 +1202,7 @@ INIT_LRECORD_IMPLEMENTATION (tty_console); #endif INIT_LRECORD_IMPLEMENTATION (stream_console); -#endif /* not NEW_GC */ +#endif /* NEW_GC */ DEFSUBR (Fvalid_console_type_p); DEFSUBR (Fconsole_type_list); @@ -1325,7 +1325,7 @@ } /* The docstrings for DEFVAR_* are recorded externally by make-docfile. */ -#ifdef MC_ALLOC +#ifdef NEW_GC #define DEFVAR_CONSOLE_LOCAL_1(lname, field_name, forward_type, magic_fun) \ do { \ struct symbol_value_forward *I_hate_C = \ @@ -1349,7 +1349,7 @@ = intern (lname); \ } \ } while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define DEFVAR_CONSOLE_LOCAL_1(lname, field_name, forward_type, magicfun) \ do { \ static const struct symbol_value_forward I_hate_C = \ @@ -1382,7 +1382,7 @@ = intern (lname); \ } \ } while (0) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #define DEFVAR_CONSOLE_LOCAL_MAGIC(lname, field_name, magicfun) \ DEFVAR_CONSOLE_LOCAL_1 (lname, field_name, \
--- a/src/dumper.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/dumper.c Mon Feb 27 16:29:29 2006 +0000 @@ -237,7 +237,7 @@ static Rawbyte *pdump_rt_list = 0; -#ifndef MC_ALLOC +#ifndef NEW_GC void pdump_objects_unmark (void) { @@ -261,10 +261,10 @@ break; } } -#endif /* not MC_ALLOC */ - - -#ifdef MC_ALLOC +#endif /* not NEW_GC */ + + +#ifdef NEW_GC /* The structure of the dump file looks like this: 0 - header - dumped objects @@ -281,7 +281,7 @@ - root lisp object address/value couples with the count preceding the list */ -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* The structure of the dump file looks like this: 0 - header - dumped objects @@ -296,7 +296,7 @@ - root lisp object address/value couples with the count preceding the list */ -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #define PDUMP_SIGNATURE "XEmacsDP" @@ -434,7 +434,7 @@ static void *pdump_buf; static FILE *pdump_out; -#ifdef MC_ALLOC +#ifdef NEW_GC /* PDUMP_HASHSIZE is a large prime. */ #define PDUMP_HASHSIZE 1000003 /* Nothing special about PDUMP_HASH_MULTIPLIER: arbitrary odd integer @@ -443,23 +443,23 @@ /* Nothing special about PDUMP_HASH_STEP: arbitrary integer for linear probing. */ #define PDUMP_HASH_STEP 574853 -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define PDUMP_HASHSIZE 200001 -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ static pdump_block_list_elt **pdump_hash; -#ifndef MC_ALLOC +#ifndef NEW_GC /* Since most pointers are eight bytes aligned, the >>3 allows for a better hash */ -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ static int pdump_make_hash (const void *obj) { -#ifdef MC_ALLOC +#ifdef NEW_GC return ((unsigned long)(obj) * PDUMP_HASH_MULTIPLIER) % PDUMP_HASHSIZE; -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ return ((unsigned long)(obj)>>3) % PDUMP_HASHSIZE; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } /* Return the entry for an already-registered memory block at OBJ, @@ -524,7 +524,7 @@ } } -#ifdef MC_ALLOC +#ifdef NEW_GC typedef struct mc_addr_elt { const void *obj; @@ -587,7 +587,7 @@ pdump_mc_hash[pos].obj = obj; pdump_mc_hash[pos].addr = addr; } -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ static pdump_block_list * pdump_get_block_list (const struct memory_description *desc) @@ -879,6 +879,11 @@ imp = LHEADER_IMPLEMENTATION (objh); if (imp->description +#ifdef NEW_GC + /* Objects with finalizers cannot be dumped with the new + allocator's asynchronous finalization strategy. */ + && !imp->finalizer +#endif /* not NEW_GC */ && RECORD_DUMPABLE (objh)) { pdump_bump_depth (); @@ -1200,7 +1205,7 @@ retry_fwrite (desc ? pdump_buf : elt->obj, size, count, pdump_out); } -#ifdef MC_ALLOC +#ifdef NEW_GC /* To be able to relocate during load time, more information about the dumped objects are needed: The count (for array-like data structures), the size of the object, and the location in the dumped @@ -1237,9 +1242,6 @@ if (pdump_object_table[i].align == align) for (elt = pdump_object_table[i].first; elt; elt = elt->next) { -#ifndef NEW_GC - assert (elt->count == 1); -#endif /* not NEW_GC */ f (elt, lrecord_implementations_table[i]->description); } } @@ -1300,9 +1302,7 @@ case XD_LONG: case XD_INT_RESET: break; -#ifdef NEW_GC case XD_LISP_OBJECT_BLOCK_PTR: -#endif /* NEW_GC */ case XD_OPAQUE_DATA_PTR: case XD_ASCII_STRING: case XD_BLOCK_PTR: @@ -1405,7 +1405,7 @@ } } } -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* Relocate a single memory block at DATA, described by DESC, from its assumed load location to its actual one by adding DELTA to all pointers in the block. Does not recursively relocate any other memory blocks @@ -1539,7 +1539,7 @@ } } } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ static void pdump_allocate_offset (pdump_block_list_elt *elt, @@ -2160,7 +2160,7 @@ fseek (pdump_out, header.stab_offset, SEEK_SET); -#ifdef MC_ALLOC +#ifdef NEW_GC { EMACS_INT zero = 0; pdump_scan_lisp_objects_by_alignment (pdump_dump_mc_data); @@ -2168,17 +2168,17 @@ pdump_scan_non_lisp_objects_by_alignment (pdump_dump_mc_data); PDUMP_WRITE_ALIGNED (EMACS_INT, zero); } -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ pdump_dump_cv_data_info (); pdump_dump_cv_ptr_info (); -#ifdef MC_ALLOC +#ifdef NEW_GC pdump_dump_rtables (); -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ pdump_dump_root_block_ptrs (); pdump_dump_root_blocks (); -#ifndef MC_ALLOC +#ifndef NEW_GC pdump_dump_rtables (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ pdump_dump_root_lisp_objects (); retry_fclose (pdump_out); @@ -2227,7 +2227,7 @@ delta = ((EMACS_INT) pdump_start) - header->reloc_address; p = pdump_start + header->stab_offset; -#ifdef MC_ALLOC +#ifdef NEW_GC pdump_mc_hash = xnew_array_and_zero (mc_addr_elt, PDUMP_HASHSIZE); /* Allocate space for each object individually. First the @@ -2251,10 +2251,8 @@ { if (elt_count <= 1) mc_addr = (Rawbyte *) mc_alloc (real_size); -#ifdef NEW_GC else mc_addr = (Rawbyte *) mc_alloc_array (size, elt_count); -#endif /* NEW_GC */ #ifdef ALLOC_TYPE_STATS inc_lrecord_stats (real_size, (const struct lrecord_header *) @@ -2274,7 +2272,7 @@ else if (!(--count)) break; } -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ /* Get the cv_data array */ p = (Rawbyte *) ALIGN_PTR (p, pdump_cv_data_dump_info); @@ -2293,7 +2291,7 @@ pdump_loaded_cv_ptr[i].adr = 0; } -#ifdef MC_ALLOC +#ifdef NEW_GC /* Relocate the heap objects */ pdump_rt_list = p; count = 2; @@ -2314,18 +2312,18 @@ else if (!(--count)) break; } -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ /* Put back the pdump_root_block_ptrs */ p = (Rawbyte *) ALIGN_PTR (p, pdump_static_pointer); for (i = 0; i < header->nb_root_block_ptrs; i++) { pdump_static_pointer ptr = PDUMP_READ (p, pdump_static_pointer); -#ifdef MC_ALLOC +#ifdef NEW_GC (* ptr.address) = (Rawbyte *) pdump_get_mc_addr (ptr.value); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ (* ptr.address) = ptr.value + delta; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } /* Put back the pdump_root_blocks and relocate */ @@ -2334,15 +2332,15 @@ pdump_root_block info = PDUMP_READ_ALIGNED (p, pdump_root_block); memcpy ((void *) info.blockaddr, p, info.size); if (info.desc) -#ifdef MC_ALLOC +#ifdef NEW_GC pdump_reloc_one_mc ((void *) info.blockaddr, info.desc); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ pdump_reloc_one ((void *) info.blockaddr, delta, info.desc); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ p += info.size; } -#ifndef MC_ALLOC +#ifndef NEW_GC /* Relocate the heap objects */ pdump_rt_list = p; count = 2; @@ -2363,7 +2361,7 @@ else if (!(--count)) break; } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Put the pdump_root_lisp_objects variables in place */ i = PDUMP_READ_ALIGNED (p, Elemcount); @@ -2373,12 +2371,12 @@ pdump_static_Lisp_Object obj = PDUMP_READ (p, pdump_static_Lisp_Object); if (POINTER_TYPE_P (XTYPE (obj.value))) -#ifdef MC_ALLOC +#ifdef NEW_GC obj.value = wrap_pointer_1 ((Rawbyte *) pdump_get_mc_addr (XPNTR (obj.value))); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ obj.value = wrap_pointer_1 ((Rawbyte *) XPNTR (obj.value) + delta); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ (* obj.address) = obj.value; } @@ -2402,9 +2400,9 @@ p += sizeof (Lisp_Object) * rt.count; } -#ifdef MC_ALLOC +#ifdef NEW_GC xfree (pdump_mc_hash, mc_addr_elt *); -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ #ifdef NEW_GC allow_incremental_gc = allow_inc_gc; @@ -2748,9 +2746,9 @@ { pdump_load_finish (); in_pdump = 0; -#ifdef MC_ALLOC +#ifdef NEW_GC pdump_free (); -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ return 1; } @@ -2761,9 +2759,9 @@ { pdump_load_finish (); in_pdump = 0; -#ifdef MC_ALLOC +#ifdef NEW_GC pdump_free (); -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ return 1; } pdump_free ();
--- a/src/dumper.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/dumper.h Mon Feb 27 16:29:29 2006 +0000 @@ -27,9 +27,9 @@ BEGIN_C_DECLS -#ifndef MC_ALLOC +#ifndef NEW_GC void pdump_objects_unmark (void); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void pdump (void); int pdump_load (const Wexttext *argv0); void pdump_backtrace (void);
--- a/src/elhash.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/elhash.c Mon Feb 27 16:29:29 2006 +0000 @@ -417,9 +417,9 @@ #endif #ifdef ERROR_CHECK_STRUCTURES size_t size -#else +#else /* not (NEW_GC && ! ERROR_CHECK_STRUCTURES) */ size_t UNUSED (size) -#endif +#endif /* not (NEW_GC && ! ERROR_CHECK_STRUCTURES) */ ) { #ifdef NEW_GC @@ -443,6 +443,7 @@ #endif /* not NEW_GC */ } +#ifndef NEW_GC static void finalize_hash_table (void *header, int for_disksave) { @@ -453,6 +454,7 @@ ht->hentries = 0; } } +#endif /* not NEW_GC */ static const struct memory_description htentry_description_1[] = { { XD_LISP_OBJECT, offsetof (htentry, key) }, @@ -515,6 +517,14 @@ { XD_END } }; +#ifdef NEW_GC +DEFINE_LRECORD_IMPLEMENTATION ("hash-table", hash_table, + 1, /*dumpable-flag*/ + mark_hash_table, print_hash_table, + 0, hash_table_equal, hash_table_hash, + hash_table_description, + Lisp_Hash_Table); +#else /* not NEW_GC */ DEFINE_LRECORD_IMPLEMENTATION ("hash-table", hash_table, 1, /*dumpable-flag*/ mark_hash_table, print_hash_table, @@ -522,6 +532,7 @@ hash_table_equal, hash_table_hash, hash_table_description, Lisp_Hash_Table); +#endif /* not NEW_GC */ static Lisp_Hash_Table * xhash_table (Lisp_Object hash_table)
--- a/src/emacs.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/emacs.c Mon Feb 27 16:29:29 2006 +0000 @@ -914,7 +914,7 @@ display_use = 0; inhibit_non_essential_conversion_operations = 1; -#ifdef MC_ALLOC +#ifdef NEW_GC #ifndef PDUMP if (!initialized) #endif @@ -927,7 +927,7 @@ #endif /* ALLOC_TYPE_STATS */ } } -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ #ifdef NeXT /* 19-Jun-1995 -baw @@ -1320,7 +1320,7 @@ init_signals_very_early (); #ifdef NEW_GC vdb_install_signal_handler (); -#endif +#endif /* NEW_GC */ 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. @@ -1454,9 +1454,9 @@ syms_of_abbrev (); syms_of_alloc (); -#ifdef MC_ALLOC +#ifdef NEW_GC syms_of_mc_alloc (); -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ syms_of_gc (); #ifdef NEW_GC syms_of_vdb (); @@ -1874,9 +1874,9 @@ reinit_alloc_early (); reinit_gc_early (); reinit_symbols_early (); -#ifndef MC_ALLOC +#ifndef NEW_GC reinit_opaque_early (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ reinit_eistring_early (); reinit_console_type_create_stream (); @@ -2296,9 +2296,9 @@ reinit_vars_of_glyphs_widget (); reinit_vars_of_insdel (); reinit_vars_of_lread (); -#ifndef MC_ALLOC +#ifndef NEW_GC reinit_vars_of_lstream (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ reinit_vars_of_minibuf (); #ifdef HAVE_SHLIB reinit_vars_of_module (); @@ -3239,9 +3239,9 @@ fflush (stdout); disksave_object_finalization (); -#ifndef MC_ALLOC +#ifndef NEW_GC release_breathing_space (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Tell malloc where start of impure now is */ /* Also arrange for warnings when nearly out of space. */
--- a/src/eval.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/eval.c Mon Feb 27 16:29:29 2006 +0000 @@ -3835,6 +3835,9 @@ { need_to_signal_post_gc = 0; recompute_funcall_allocation_flag (); +#ifdef NEW_GC + run_finalizers (); +#endif /* NEW_GC */ run_post_gc_hook (); } }
--- a/src/event-msw.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/event-msw.c Mon Feb 27 16:29:29 2006 +0000 @@ -2502,7 +2502,7 @@ /* If you hit this, rewrite the offending API call to occur after GC, using register_post_gc_action(). */ assert (!gc_in_progress); -#endif /* NEW_GC */ +#endif /* not NEW_GC */ #ifdef DEBUG_XEMACS if (debug_mswindows_events)
--- a/src/event-stream.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/event-stream.c Mon Feb 27 16:29:29 2006 +0000 @@ -329,9 +329,9 @@ #define CHECK_COMMAND_BUILDER(x) CHECK_RECORD (x, command_builder) #define CONCHECK_COMMAND_BUILDER(x) CONCHECK_RECORD (x, command_builder) -#ifndef MC_ALLOC +#ifndef NEW_GC static Lisp_Object Vcommand_builder_free_list; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ static const struct memory_description command_builder_description [] = { { XD_LISP_OBJECT, offsetof (struct command_builder, current_events) }, @@ -389,12 +389,12 @@ allocate_command_builder (Lisp_Object console, int with_echo_buf) { Lisp_Object builder_obj = -#ifdef MC_ALLOC +#ifdef NEW_GC wrap_pointer_1 (alloc_lrecord_type (struct command_builder, &lrecord_command_builder)); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ alloc_managed_lcrecord (Vcommand_builder_free_list); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ struct command_builder *builder = XCOMMAND_BUILDER (builder_obj); builder->console = console; @@ -463,12 +463,12 @@ xfree (builder->echo_buf, Ibyte *); builder->echo_buf = NULL; } -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (wrap_command_builder (builder)); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ free_managed_lcrecord (Vcommand_builder_free_list, wrap_command_builder (builder)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } static void @@ -1031,9 +1031,9 @@ static Lisp_Object pending_timeout_list, pending_async_timeout_list; -#ifndef MC_ALLOC +#ifndef NEW_GC static Lisp_Object Vtimeout_free_list; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ static Lisp_Object mark_timeout (Lisp_Object obj) @@ -1062,12 +1062,12 @@ Lisp_Object function, Lisp_Object object, int async_p) { -#ifdef MC_ALLOC +#ifdef NEW_GC Lisp_Object op = wrap_pointer_1 (alloc_lrecord_type (Lisp_Timeout, &lrecord_timeout)); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ Lisp_Object op = alloc_managed_lcrecord (Vtimeout_free_list); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ Lisp_Timeout *timeout = XTIMEOUT (op); EMACS_TIME current_time; EMACS_TIME interval; @@ -1185,11 +1185,11 @@ *timeout_list = noseeum_cons (op, *timeout_list); } else -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (op); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ free_managed_lcrecord (Vtimeout_free_list, op); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ UNGCPRO; return id; @@ -1226,11 +1226,11 @@ signal_remove_async_interval_timeout (timeout->interval_id); else event_stream_remove_timeout (timeout->interval_id); -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (op); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ free_managed_lcrecord (Vtimeout_free_list, op); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } } @@ -4925,7 +4925,7 @@ recent_keys_ring_index = 0; recent_keys_ring_size = 100; num_input_chars = 0; -#ifndef MC_ALLOC +#ifndef NEW_GC Vtimeout_free_list = make_lcrecord_list (sizeof (Lisp_Timeout), &lrecord_timeout); staticpro_nodump (&Vtimeout_free_list); @@ -4933,7 +4933,7 @@ make_lcrecord_list (sizeof (struct command_builder), &lrecord_command_builder); staticpro_nodump (&Vcommand_builder_free_list); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ the_low_level_timeout_blocktype = Blocktype_new (struct low_level_timeout_blocktype); something_happened = 0;
--- a/src/extents.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/extents.c Mon Feb 27 16:29:29 2006 +0000 @@ -1269,6 +1269,14 @@ return Qnil; } +#ifdef NEW_GC +DEFINE_LRECORD_IMPLEMENTATION ("extent-info", extent_info, + 0, /*dumpable-flag*/ + mark_extent_info, internal_object_printer, + 0, 0, 0, + extent_info_description, + struct extent_info); +#else /* not NEW_GC */ static void finalize_extent_info (void *header, int for_disksave) { @@ -1277,10 +1285,8 @@ if (for_disksave) return; -#ifdef NEW_GC data->soe = 0; data->extents = 0; -#else /* not NEW_GC */ if (data->soe) { free_soe (data->soe); @@ -1291,7 +1297,6 @@ free_extent_list (data->extents); data->extents = 0; } -#endif /* not NEW_GC */ } DEFINE_LRECORD_IMPLEMENTATION ("extent-info", extent_info, @@ -1300,6 +1305,7 @@ finalize_extent_info, 0, 0, extent_info_description, struct extent_info); +#endif /* not NEW_GC */ static Lisp_Object allocate_extent_info (void) @@ -7458,7 +7464,7 @@ INIT_LRECORD_IMPLEMENTATION (extent_list_marker); INIT_LRECORD_IMPLEMENTATION (extent_list); INIT_LRECORD_IMPLEMENTATION (stack_of_extents); -#endif /* not NEW_GC */ +#endif /* NEW_GC */ DEFSYMBOL (Qextentp); DEFSYMBOL (Qextent_live_p);
--- a/src/faces.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/faces.h Mon Feb 27 16:29:29 2006 +0000 @@ -119,7 +119,7 @@ { #ifdef NEW_GC struct lrecord_header header; -#endif /* not NEW_GC */ +#endif /* NEW_GC */ /* There are two kinds of cachels; those created from a single face and those created by merging more than one face. In the former case, the FACE element specifies the face used. In the latter
--- a/src/file-coding.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/file-coding.c Mon Feb 27 16:29:29 2006 +0000 @@ -305,6 +305,7 @@ write_c_string (printcharfun, "]"); } +#ifndef NEW_GC static void finalize_coding_system (void *header, int for_disksave) { @@ -315,6 +316,7 @@ if (!for_disksave) /* see comment in lstream.c */ MAYBE_XCODESYSMETH (cs, finalize, (cs)); } +#endif /* not NEW_GC */ static Bytecount sizeof_coding_system (const void *header) @@ -366,6 +368,15 @@ 0, coding_system_empty_extra_description_1 }; +#ifdef NEW_GC +DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("coding-system", coding_system, + 1, /*dumpable-flag*/ + mark_coding_system, + print_coding_system, + 0, 0, 0, coding_system_description, + sizeof_coding_system, + Lisp_Coding_System); +#else /* not NEW_GC */ DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("coding-system", coding_system, 1, /*dumpable-flag*/ mark_coding_system, @@ -374,6 +385,7 @@ 0, 0, coding_system_description, sizeof_coding_system, Lisp_Coding_System); +#endif /* not NEW_GC */ /************************************************************************/ /* Creating coding systems */
--- a/src/gc.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/gc.c Mon Feb 27 16:29:29 2006 +0000 @@ -632,15 +632,15 @@ } #endif /* defined (USE_KKCC) || defined (PDUMP) */ -#ifdef MC_ALLOC +#ifdef NEW_GC #define GC_CHECK_NOT_FREE(lheader) \ gc_checking_assert (! LRECORD_FREE_P (lheader)); -#else /* MC_ALLOC */ +#else /* not NEW_GC */ #define GC_CHECK_NOT_FREE(lheader) \ gc_checking_assert (! LRECORD_FREE_P (lheader)); \ gc_checking_assert (LHEADER_IMPLEMENTATION (lheader)->basic_p || \ ! ((struct old_lcrecord_header *) lheader)->free) -#endif /* MC_ALLOC */ +#endif /* not NEW_GC */ #ifdef USE_KKCC /* The following functions implement the new mark algorithm. @@ -1147,13 +1147,13 @@ though. */ if (EQ (*stored_obj, Qnull_pointer)) break; -#ifdef MC_ALLOC +#ifdef NEW_GC mark_object_maybe_checking_free (*stored_obj, 0, level, pos); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ mark_object_maybe_checking_free (*stored_obj, (desc1->flags) & XD_FLAG_FREE_LISP_OBJECT, level, pos); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ break; } case XD_LISP_OBJECT_ARRAY: @@ -1169,14 +1169,14 @@ if (EQ (*stored_obj, Qnull_pointer)) break; -#ifdef MC_ALLOC +#ifdef NEW_GC mark_object_maybe_checking_free (*stored_obj, 0, level, pos); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ mark_object_maybe_checking_free (*stored_obj, (desc1->flags) & XD_FLAG_FREE_LISP_OBJECT, level, pos); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } break; } @@ -1392,6 +1392,76 @@ } } +#ifdef NEW_GC +/* Asynchronous finalization. */ +typedef struct finalize_elem +{ + Lisp_Object obj; + struct finalize_elem *next; +} finalize_elem; + +finalize_elem *Vall_finalizable_objs; +Lisp_Object Vfinalizers_to_run; + +void +add_finalizable_obj (Lisp_Object obj) +{ + finalize_elem *next = Vall_finalizable_objs; + Vall_finalizable_objs = + (finalize_elem *) xmalloc_and_zero (sizeof (finalize_elem)); + Vall_finalizable_objs->obj = obj; + Vall_finalizable_objs->next = next; +} + +void +register_for_finalization (void) +{ + finalize_elem *rest = Vall_finalizable_objs; + + if (!rest) + return; + + while (!marked_p (rest->obj)) + { + finalize_elem *temp = rest; + Vfinalizers_to_run = Fcons (rest->obj, Vfinalizers_to_run); + Vall_finalizable_objs = rest->next; + xfree (temp, finalize_elem *); + rest = Vall_finalizable_objs; + } + + while (rest->next) + { + if (LRECORDP (rest->next->obj) + && !marked_p (rest->next->obj)) + { + finalize_elem *temp = rest->next; + Vfinalizers_to_run = Fcons (rest->next->obj, Vfinalizers_to_run); + rest->next = rest->next->next; + xfree (temp, finalize_elem *); + } + else + { + rest = rest->next; + } + } + /* Keep objects alive that need to be finalized by marking + Vfinalizers_to_run transitively. */ + kkcc_gc_stack_push_lisp_object (Vfinalizers_to_run, 0, -1); + kkcc_marking (0); +} + +void +run_finalizers (void) +{ + Lisp_Object rest; + for (rest = Vfinalizers_to_run; !NILP (rest); rest = XCDR (rest)) + { + MC_ALLOC_CALL_FINALIZER (XPNTR (XCAR (rest))); + } + Vfinalizers_to_run = Qnil; +} +#endif /* not NEW_GC */ /************************************************************************/ @@ -1514,7 +1584,7 @@ gc_in_progress = 1; #ifndef NEW_GC inhibit_non_essential_conversion_operations = 1; -#endif /* NEW_GC */ +#endif /* not NEW_GC */ #if MAX_SAVE_STACK > 0 @@ -1596,14 +1666,14 @@ **p++; } -#ifdef MC_ALLOC +#ifdef NEW_GC { /* mcpro () */ Lisp_Object *p = Dynarr_begin (mcpros); Elemcount count; for (count = Dynarr_length (mcpros); count; count--) mark_object (*p++); } -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ { /* GCPRO() */ struct gcpro *tail; @@ -1708,7 +1778,7 @@ gc_finalize (void) { GC_SET_PHASE (FINALIZE); - mc_finalize (); + register_for_finalization (); } void @@ -1769,12 +1839,12 @@ } } -#ifndef MC_ALLOC +#ifndef NEW_GC if (!breathing_space) { breathing_space = malloc (4096 - MALLOC_OVERHEAD); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ need_to_signal_post_gc = 1; funcall_allocation_flag = 1; @@ -1887,12 +1957,12 @@ if (!gc_resume_mark (incremental)) return; /* suspend gc */ gc_finish_mark (); + case FINISH_MARK: + gc_finalize (); kkcc_gc_stack_free (); #ifdef DEBUG_XEMACS kkcc_bt_free (); #endif - case FINISH_MARK: - gc_finalize (); case FINALIZE: gc_sweep (); case SWEEP: @@ -2023,12 +2093,16 @@ #ifdef NEW_GC gc_cons_incremental_threshold = GC_CONS_INCREMENTAL_THRESHOLD; gc_incremental_traversal_threshold = GC_INCREMENTAL_TRAVERSAL_THRESHOLD; -#endif /* not NEW_GC */ +#endif /* NEW_GC */ } void init_gc_early (void) { +#ifdef NEW_GC + /* Reset the finalizers_to_run list after pdump_load. */ + Vfinalizers_to_run = Qnil; +#endif /* NEW_GC */ } void @@ -2174,6 +2248,9 @@ *incremental garbage collection, the garbage collector then only does *full collects (even if (gc-incremental) is called). */ ); + + Vfinalizers_to_run = Qnil; + staticpro_nodump (&Vfinalizers_to_run); #endif /* NEW_GC */ }
--- a/src/gc.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/gc.h Mon Feb 27 16:29:29 2006 +0000 @@ -169,11 +169,15 @@ alloc.c to gc.c. */ void gc_sweep_1 (void); -#ifndef MC_ALLOC extern void *breathing_space; -#endif /* not MC_ALLOC */ #endif /* not NEW_GC */ +#ifdef NEW_GC +void add_finalizable_obj (Lisp_Object obj); +void register_for_finalization (void); +void run_finalizers (void); +#endif /* NEW_GC */ + END_C_DECLS #endif /* INCLUDED_gc_h_ */
--- a/src/glyphs.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/glyphs.h Mon Feb 27 16:29:29 2006 +0000 @@ -1069,7 +1069,7 @@ { #ifdef NEW_GC struct lrecord_header header; -#endif /* not NEW_GC */ +#endif /* NEW_GC */ Lisp_Object glyph; unsigned int dirty :1; /* I'm copying faces here. I'm not
--- a/src/gui.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/gui.c Mon Feb 27 16:29:29 2006 +0000 @@ -804,15 +804,10 @@ RETURN_UNGCPRO (ret); } -static void -finalize_gui_item (void *UNUSED (header), int UNUSED (for_disksave)) -{ -} - DEFINE_LRECORD_IMPLEMENTATION ("gui-item", gui_item, 0, /*dumpable-flag*/ mark_gui_item, print_gui_item, - finalize_gui_item, gui_item_equal, + 0, gui_item_equal, gui_item_hash, gui_item_description, Lisp_Gui_Item);
--- a/src/lisp.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/lisp.h Mon Feb 27 16:29:29 2006 +0000 @@ -2038,13 +2038,13 @@ #define CHECK_CONS(x) CHECK_RECORD (x, cons) #define CONCHECK_CONS(x) CONCHECK_RECORD (x, cons) -#ifdef MC_ALLOC +#ifdef NEW_GC #define CONS_MARKED_P(c) MARKED_P (&((c)->lheader)) #define MARK_CONS(c) MARK (&((c)->lheader)) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define CONS_MARKED_P(c) MARKED_RECORD_HEADER_P(&((c)->lheader)) #define MARK_CONS(c) MARK_RECORD_HEADER (&((c)->lheader)) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ extern MODULE_API Lisp_Object Qnil; @@ -2637,20 +2637,20 @@ /* WARNING: Everything before ascii_begin must agree exactly with struct lrecord_header */ unsigned int type :8; -#ifdef MC_ALLOC +#ifdef NEW_GC unsigned int lisp_readonly :1; unsigned int free :1; /* Number of chars at beginning of string that are one byte in length (byte_ascii_p) */ unsigned int ascii_begin :22; -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ unsigned int mark :1; unsigned int c_readonly :1; unsigned int lisp_readonly :1; /* Number of chars at beginning of string that are one byte in length (byte_ascii_p) */ unsigned int ascii_begin :21; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } v; } u; #ifdef NEW_GC @@ -2664,11 +2664,11 @@ }; typedef struct Lisp_String Lisp_String; -#ifdef MC_ALLOC +#ifdef NEW_GC #define MAX_STRING_ASCII_BEGIN ((1 << 22) - 1) -#else +#else /* not NEW_GC */ #define MAX_STRING_ASCII_BEGIN ((1 << 21) - 1) -#endif +#endif /* not NEW_GC */ DECLARE_MODULE_API_LRECORD (string, Lisp_String); #define XSTRING(x) XRECORD (x, string, Lisp_String) @@ -3185,12 +3185,12 @@ /*--------------------------- readonly objects -------------------------*/ -#ifndef MC_ALLOC +#ifndef NEW_GC #define CHECK_C_WRITEABLE(obj) \ do { if (c_readonly (obj)) c_write_error (obj); } while (0) #define C_READONLY(obj) (C_READONLY_RECORD_HEADER_P(XRECORD_LHEADER (obj))) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #define CHECK_LISP_WRITEABLE(obj) \ do { if (lisp_readonly (obj)) lisp_write_error (obj); } while (0) @@ -3432,7 +3432,7 @@ /* Can't be const, because then subr->doc is read-only and Snarf_documentation chokes */ -#ifdef MC_ALLOC +#ifdef NEW_GC #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \ Lisp_Object Fname (EXFUN_##max_args); \ static struct Lisp_Subr MC_ALLOC_S##Fname = \ @@ -3474,7 +3474,7 @@ DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) #define GET_DEFUN_LISP_OBJECT(Fname) \ wrap_subr (S##Fname); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \ Lisp_Object Fname (EXFUN_##max_args); \ static struct Lisp_Subr S##Fname = \ @@ -3516,7 +3516,7 @@ DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) #define GET_DEFUN_LISP_OBJECT(Fname) \ wrap_subr (&S##Fname); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a prototype that matches max_args, and add the obligatory @@ -4021,7 +4021,7 @@ #endif -#ifdef MC_ALLOC +#ifdef NEW_GC extern Lisp_Object_dynarr *mcpros; #ifdef DEBUG_XEMACS /* Help debug crashes gc-marking a mcpro'ed object. */ @@ -4031,7 +4031,7 @@ /* Call mcpro (&var) to protect mc variable `var'. */ MODULE_API void mcpro (Lisp_Object); #endif /* not DEBUG_XEMACS */ -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ void register_post_gc_action (void (*fun) (void *), void *arg); int begin_gc_forbidden (void); @@ -4089,9 +4089,9 @@ MODULE_API EXFUN (Fmake_vector, 2); MODULE_API EXFUN (Fvector, MANY); -#ifndef MC_ALLOC +#ifndef NEW_GC void release_breathing_space (void); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ Lisp_Object noseeum_cons (Lisp_Object, Lisp_Object); MODULE_API Lisp_Object make_vector (Elemcount, Lisp_Object); MODULE_API Lisp_Object vector1 (Lisp_Object);
--- a/src/lrecord.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/lrecord.h Mon Feb 27 16:29:29 2006 +0000 @@ -26,7 +26,7 @@ #ifndef INCLUDED_lrecord_h_ #define INCLUDED_lrecord_h_ -#ifdef MC_ALLOC +#ifdef NEW_GC /* The "lrecord" type of Lisp object is used for all object types other than a few simple ones (like char and int). This allows many types to be implemented but only a few bits required in a Lisp @@ -45,7 +45,7 @@ could contain Lisp_Objects in it), you may well be able to use the opaque type. */ -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* The "lrecord" type of Lisp object is used for all object types other than a few simple ones. This allows many types to be implemented but only a few bits required in a Lisp object for type @@ -79,9 +79,9 @@ could contain Lisp_Objects in it), you may well be able to use the opaque type. --ben */ -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ -#ifdef MC_ALLOC +#ifdef NEW_GC #define ALLOC_LCRECORD_TYPE alloc_lrecord_type #define COPY_SIZED_LCRECORD copy_sized_lrecord #define COPY_LCRECORD copy_lrecord @@ -91,7 +91,7 @@ #define LCRECORD_HEADER lrecord_header #define BASIC_ALLOC_LCRECORD alloc_lrecord #define FREE_LCRECORD free_lrecord -#else +#else /* not NEW_GC */ #define ALLOC_LCRECORD_TYPE old_alloc_lcrecord_type #define COPY_SIZED_LCRECORD old_copy_sized_lcrecord #define COPY_LCRECORD old_copy_lcrecord @@ -100,7 +100,7 @@ #define LCRECORD_HEADER old_lcrecord_header #define BASIC_ALLOC_LCRECORD old_basic_alloc_lcrecord #define FREE_LCRECORD old_free_lcrecord -#endif +#endif /* not NEW_GC */ BEGIN_C_DECLS @@ -111,7 +111,7 @@ field. */ unsigned int type :8; -#ifdef MC_ALLOC +#ifdef NEW_GC /* 1 if the object is readonly from lisp */ unsigned int lisp_readonly :1; @@ -125,7 +125,7 @@ anyway. (The bits are used for strings, though.) */ unsigned int uid :22; -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* If `mark' is 0 after the GC mark phase, the object will be freed during the GC sweep phase. There are 2 ways that `mark' can be 1: - by being referenced from other objects during the GC mark phase @@ -145,14 +145,14 @@ anyway. (The bits are used for strings, though.) */ unsigned int uid :21; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ }; struct lrecord_implementation; int lrecord_type_index (const struct lrecord_implementation *implementation); extern int lrecord_uid_counter; -#ifdef MC_ALLOC +#ifdef NEW_GC #define set_lheader_implementation(header,imp) do { \ struct lrecord_header* SLI_header = (header); \ SLI_header->type = (imp)->lrecord_type_index; \ @@ -160,7 +160,7 @@ SLI_header->free = 0; \ SLI_header->uid = lrecord_uid_counter++; \ } while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define set_lheader_implementation(header,imp) do { \ struct lrecord_header* SLI_header = (header); \ SLI_header->type = (imp)->lrecord_type_index; \ @@ -169,9 +169,9 @@ SLI_header->lisp_readonly = 0; \ SLI_header->uid = lrecord_uid_counter++; \ } while (0) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ -#ifndef MC_ALLOC +#ifndef NEW_GC struct old_lcrecord_header { struct lrecord_header lheader; @@ -209,7 +209,7 @@ struct old_lcrecord_header lcheader; Lisp_Object chain; }; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ enum lrecord_type { @@ -226,9 +226,9 @@ lrecord_type_cons, lrecord_type_vector, lrecord_type_string, -#ifndef MC_ALLOC +#ifndef NEW_GC lrecord_type_lcrecord_list, -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ lrecord_type_compiled_function, lrecord_type_weak_list, lrecord_type_bit_vector, @@ -297,10 +297,10 @@ lrecord_type_bignum, lrecord_type_ratio, lrecord_type_bigfloat, -#ifndef MC_ALLOC +#ifndef NEW_GC lrecord_type_free, /* only used for "free" lrecords */ lrecord_type_undefined, /* only used for debugging */ -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #ifdef NEW_GC lrecord_type_string_indirect_data, lrecord_type_string_direct_data, @@ -400,25 +400,25 @@ int (*remprop) (Lisp_Object obj, Lisp_Object prop); Lisp_Object (*plist) (Lisp_Object obj); -#ifdef MC_ALLOC +#ifdef NEW_GC /* Only one of `static_size' and `size_in_bytes_method' is non-0. */ -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* Only one of `static_size' and `size_in_bytes_method' is non-0. If both are 0, this type is not instantiable by old_basic_alloc_lcrecord(). */ -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ Bytecount static_size; Bytecount (*size_in_bytes_method) (const void *header); /* The (constant) index into lrecord_implementations_table */ enum lrecord_type lrecord_type_index; -#ifndef MC_ALLOC +#ifndef NEW_GC /* A "basic" lrecord is any lrecord that's not an lcrecord, i.e. one that does not have an old_lcrecord_header at the front and which is (usually) allocated in frob blocks. */ unsigned int basic_p :1; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ }; /* All the built-in lisp object types are enumerated in `enum lrecord_type'. @@ -441,7 +441,7 @@ extern int gc_in_progress; -#ifdef MC_ALLOC +#ifdef NEW_GC #include "mc-alloc.h" #ifdef ALLOC_TYPE_STATS @@ -453,7 +453,6 @@ #endif /* ALLOC_TYPE_STATS */ /* Tell mc-alloc how to call a finalizer. */ -#ifdef NEW_GC #define MC_ALLOC_CALL_FINALIZER(ptr) \ { \ Lisp_Object MCACF_obj = wrap_pointer_1 (ptr); \ @@ -470,21 +469,6 @@ } \ } \ } while (0) -#else /* not NEW_GC */ -#define MC_ALLOC_CALL_FINALIZER(ptr) \ -{ \ - Lisp_Object MCACF_obj = wrap_pointer_1 (ptr); \ - struct lrecord_header *MCACF_lheader = XRECORD_LHEADER (MCACF_obj); \ - if (XRECORD_LHEADER (MCACF_obj) && LRECORDP (MCACF_obj) \ - && !LRECORD_FREE_P (MCACF_lheader) ) \ - { \ - const struct lrecord_implementation *MCACF_implementation \ - = LHEADER_IMPLEMENTATION (MCACF_lheader); \ - if (MCACF_implementation && MCACF_implementation->finalizer) \ - MCACF_implementation->finalizer (ptr, 0); \ - } \ -} while (0) -#endif /* not NEW_GC */ /* Tell mc-alloc how to call a finalizer for disksave. */ #define MC_ALLOC_CALL_FINALIZER_FOR_DISKSAVE(ptr) \ @@ -521,7 +505,7 @@ #define MARK_LRECORD_AS_LISP_READONLY(ptr) \ ((void) (((struct lrecord_header *) ptr)->lisp_readonly = 1)) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define LRECORD_FREE_P(ptr) \ (((struct lrecord_header *) ptr)->type == lrecord_type_free) @@ -544,7 +528,7 @@ } while (0) #define SET_LISP_READONLY_RECORD_HEADER(lheader) \ ((void) ((lheader)->lisp_readonly = 1)) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #ifdef USE_KKCC #define RECORD_DESCRIPTION(lheader) lrecord_memory_descriptions[(lheader)->type] @@ -1054,14 +1038,14 @@ XD_FLAG_NO_PDUMP = 2, /* Indicates that this is a "default" entry in a union map. */ XD_FLAG_UNION_DEFAULT_ENTRY = 4, -#ifndef MC_ALLOC +#ifndef NEW_GC /* Indicates that this is a free Lisp object we're marking. Only relevant for ERROR_CHECK_GC. This occurs when we're marking lcrecord-lists, where the objects have had their type changed to lrecord_type_free and also have had their free bit set, but we mark them as normal. */ XD_FLAG_FREE_LISP_OBJECT = 8 -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #if 0 , /* Suggestions for other possible flags: */ @@ -1188,21 +1172,21 @@ #define DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,sizer,structtype) \ MAKE_LRECORD_IMPLEMENTATION(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,0,sizer,0,structtype) -#ifdef MC_ALLOC +#ifdef NEW_GC #define MAKE_LRECORD_IMPLEMENTATION(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,size,sizer,basic_p,structtype) \ DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \ const struct lrecord_implementation lrecord_##c_name = \ { name, dumpable, marker, printer, nuker, equal, hash, desc, \ getprop, putprop, remprop, plist, size, sizer, \ lrecord_type_##c_name } -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define MAKE_LRECORD_IMPLEMENTATION(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,size,sizer,basic_p,structtype) \ DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \ const struct lrecord_implementation lrecord_##c_name = \ { name, dumpable, marker, printer, nuker, equal, hash, desc, \ getprop, putprop, remprop, plist, size, sizer, \ lrecord_type_##c_name, basic_p } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #define DEFINE_EXTERNAL_LRECORD_IMPLEMENTATION(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,structtype) \ DEFINE_EXTERNAL_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,0,0,0,0,structtype) @@ -1216,7 +1200,7 @@ #define DEFINE_EXTERNAL_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,sizer,structtype) \ MAKE_EXTERNAL_LRECORD_IMPLEMENTATION(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,0,sizer,0,structtype) -#ifdef MC_ALLOC +#ifdef NEW_GC #define MAKE_EXTERNAL_LRECORD_IMPLEMENTATION(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,size,sizer,basic_p,structtype) \ DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \ int lrecord_type_##c_name; \ @@ -1224,7 +1208,7 @@ { name, dumpable, marker, printer, nuker, equal, hash, desc, \ getprop, putprop, remprop, plist, size, sizer, \ lrecord_type_last_built_in_type } -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define MAKE_EXTERNAL_LRECORD_IMPLEMENTATION(name,c_name,dumpable,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,plist,size,sizer,basic_p,structtype) \ DECLARE_ERROR_CHECK_TYPES(c_name, structtype) \ int lrecord_type_##c_name; \ @@ -1232,7 +1216,7 @@ { name, dumpable, marker, printer, nuker, equal, hash, desc, \ getprop, putprop, remprop, plist, size, sizer, \ lrecord_type_last_built_in_type, basic_p } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #ifdef USE_KKCC extern MODULE_API const struct memory_description *lrecord_memory_descriptions[]; @@ -1588,7 +1572,7 @@ dead_wrong_type_argument (predicate, x); \ } while (0) -#ifndef MC_ALLOC +#ifndef NEW_GC /*-------------------------- lcrecord-list -----------------------------*/ struct lcrecord_list @@ -1723,7 +1707,7 @@ #define old_zero_lcrecord(lcr) old_zero_sized_lcrecord (lcr, sizeof (*(lcr))) -#else /* MC_ALLOC */ +#else /* NEW_GC */ /* How to allocate a lrecord: @@ -1767,7 +1751,7 @@ #define copy_lrecord(dst, src) copy_sized_lrecord (dst, src, sizeof (*(dst))) -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ #define zero_sized_lrecord(lcr, size) \ memset ((char *) (lcr) + sizeof (struct lrecord_header), 0, \ @@ -1886,12 +1870,12 @@ #ifdef PDUMP #include "dumper.h" -#ifdef MC_ALLOC +#ifdef NEW_GC #define DUMPEDP(adr) 0 -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define DUMPEDP(adr) ((((Rawbyte *) (adr)) < pdump_end) && \ (((Rawbyte *) (adr)) >= pdump_start)) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #else #define DUMPEDP(adr) 0 #endif
--- a/src/lstream.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/lstream.c Mon Feb 27 16:29:29 2006 +0000 @@ -180,11 +180,11 @@ } } -#ifndef MC_ALLOC +#ifndef NEW_GC static const Lstream_implementation *lstream_types[32]; static Lisp_Object Vlstream_free_list[32]; static int lstream_type_count; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Allocate and return a new Lstream. This function is not really meant to be called directly; rather, each stream type should @@ -196,11 +196,11 @@ Lstream_new (const Lstream_implementation *imp, const char *mode) { Lstream *p; -#ifdef MC_ALLOC +#ifdef NEW_GC p = XLSTREAM (wrap_pointer_1 (alloc_lrecord (aligned_sizeof_lstream (imp->size), &lrecord_lstream))); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ int i; for (i = 0; i < lstream_type_count; i++) @@ -220,7 +220,7 @@ } p = XLSTREAM (alloc_managed_lcrecord (Vlstream_free_list[i])); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Zero it out, except the header. */ memset ((char *) p + sizeof (p->header), '\0', aligned_sizeof_lstream (imp->size) - sizeof (p->header)); @@ -296,14 +296,14 @@ void Lstream_delete (Lstream *lstr) { -#ifndef MC_ALLOC +#ifndef NEW_GC int i; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ Lisp_Object val = wrap_lstream (lstr); -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (val); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ for (i = 0; i < lstream_type_count; i++) { if (lstream_types[i] == lstr->imp) @@ -314,7 +314,7 @@ } ABORT (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } #define Lstream_internal_error(reason, lstr) \ @@ -1865,7 +1865,7 @@ LSTREAM_HAS_METHOD (lisp_buffer, marker); } -#ifndef MC_ALLOC +#ifndef NEW_GC void reinit_vars_of_lstream (void) { @@ -1877,7 +1877,7 @@ staticpro_nodump (&Vlstream_free_list[i]); } } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void vars_of_lstream (void)
--- a/src/marker.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/marker.c Mon Feb 27 16:29:29 2006 +0000 @@ -104,7 +104,7 @@ { XD_END } }; -#ifdef MC_ALLOC +#ifdef NEW_GC static void finalize_marker (void *header, int for_disksave) { @@ -121,13 +121,13 @@ finalize_marker, marker_equal, marker_hash, marker_description, Lisp_Marker); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ DEFINE_BASIC_LRECORD_IMPLEMENTATION ("marker", marker, 1, /*dumpable-flag*/ mark_marker, print_marker, 0, marker_equal, marker_hash, marker_description, Lisp_Marker); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Operations on markers. */ @@ -512,11 +512,11 @@ for (m = BUF_MARKERS (b); m; m = m->next) total += sizeof (Lisp_Marker); ovstats->was_requested += total; -#ifdef MC_ALLOC +#ifdef NEW_GC overhead = mc_alloced_storage_size (total, 0); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ overhead = fixed_type_block_overhead (total); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* #### claiming this is all malloc overhead is not really right, but it has to go somewhere. */ ovstats->malloc_overhead += overhead;
--- a/src/mc-alloc.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/mc-alloc.c Mon Feb 27 16:29:29 2006 +0000 @@ -403,11 +403,7 @@ /* Number of mark bits: minimum 1, maximum 8. */ -#ifdef NEW_GC #define N_MARK_BITS 2 -#else /* not NEW_GC */ -#define N_MARK_BITS 1 -#endif /* not NEW_GC */ @@ -773,11 +769,9 @@ assert (ph && PH_ON_USED_LIST_P (ph)); if (ph) { -#ifdef NEW_GC if (value == BLACK) if (!PH_BLACK_BIT (ph)) PH_BLACK_BIT (ph) = 1; -#endif /* NEW_GC */ SET_BIT (ph, get_mark_bit_index (ptr, ph), value); } } @@ -1271,10 +1265,8 @@ { page_list_header *plh = PH_PLH (ph); -#ifdef NEW_GC if (gc_in_progress && PH_PROTECTION_BIT (ph)) ABORT(); /* cleanup: remove memory protection, zero page_header bits. */ -#endif /* not NEW_GC */ #ifdef MEMORY_USAGE_STATS PLH_TOTAL_CELLS (plh) -= PH_CELLS_ON_PAGE (ph); @@ -1482,59 +1474,11 @@ free_link *fl = PH_FREE_LIST (ph); while (fl) { -#ifdef NEW_GC SET_BIT (ph, get_mark_bit_index (fl, ph), BLACK); -#else /* not NEW_GC */ - SET_BIT (ph, get_mark_bit_index (fl, ph), 1); -#endif /* not NEW_GC */ fl = NEXT_FREE (fl); } } -/* Finalize a page. You have to tell mc-alloc how to call your - object's finalizer. Therefore, you have to define the macro - MC_ALLOC_CALL_FINALIZER(ptr). This macro should do nothing else - then test if there is a finalizer and call it on the given - argument, which is the heap address of the object. */ -static void -finalize_page (page_header *ph) -{ - EMACS_INT heap_space = (EMACS_INT) PH_HEAP_SPACE (ph); - EMACS_INT heap_space_step = PH_CELL_SIZE (ph); - EMACS_INT mark_bit = 0; - EMACS_INT mark_bit_max_index = PH_CELLS_ON_PAGE (ph); - unsigned int bit = 0; - - mark_free_list (ph); - -#ifdef NEW_GC - /* ARRAY_BIT_HACK */ - if (PH_ARRAY_BIT (ph)) - for (mark_bit = 0; mark_bit < mark_bit_max_index; mark_bit++) - { - GET_BIT (bit, ph, mark_bit * N_MARK_BITS); - if (bit) - { - return; - } - } -#endif /* NEW_GC */ - - for (mark_bit = 0; mark_bit < mark_bit_max_index; mark_bit++) - { - GET_BIT (bit, ph, mark_bit * N_MARK_BITS); -#ifdef NEW_GC - if (bit == WHITE) -#else /* not NEW_GC */ - if (bit == 0) -#endif /* not NEW_GC */ - { - EMACS_INT ptr = (heap_space + (heap_space_step * mark_bit)); - MC_ALLOC_CALL_FINALIZER ((void *) ptr); - } - } -} - /* Finalize a page for disksave. XEmacs calls this routine before it dumps the heap image. You have to tell mc-alloc how to call your @@ -1558,14 +1502,6 @@ } -/* Finalizes the heap. */ -void -mc_finalize (void) -{ - visit_all_used_page_headers (finalize_page); -} - - /* Finalizes the heap for disksave. */ void mc_finalize_for_disksave (void) @@ -1588,7 +1524,6 @@ mark_free_list (ph); -#ifdef NEW_GC /* ARRAY_BIT_HACK */ if (PH_ARRAY_BIT (ph)) for (mark_bit = 0; mark_bit < mark_bit_max_index; mark_bit++) @@ -1601,20 +1536,13 @@ return; } } -#endif /* NEW_GC */ for (mark_bit = 0; mark_bit < mark_bit_max_index; mark_bit++) { GET_BIT (bit, ph, mark_bit * N_MARK_BITS); -#ifdef NEW_GC if (bit == WHITE) -#else /* not NEW_GC */ - if (bit == 0) -#endif /* not NEW_GC */ { -#ifdef NEW_GC GC_STAT_FREED; -#endif /* NEW_GC */ remove_cell (heap_space + (heap_space_step * mark_bit), ph); } } @@ -1637,32 +1565,10 @@ /* Frees the cell pointed to by ptr. */ void -mc_free (void *ptr) +mc_free (void *UNUSED (ptr)) { - page_header *ph; - -#ifdef NEW_GC - /* Do not allow manual freeing while a gc is running. Data is going - to be freed next gc cycle. */ - if (write_barrier_enabled || gc_in_progress) - return; -#endif /* NEW_GC */ - - ph = get_page_header (ptr); - assert (ph); - assert (PH_PLH (ph)); - assert (PLH_LIST_TYPE (PH_PLH (ph)) != FREE_LIST); - -#ifdef NEW_GC - if (PH_ON_USED_LIST_P (ph)) - SET_BIT (ph, get_mark_bit_index (ptr, ph), WHITE); -#endif /* NEW_GC */ - remove_cell (ptr, ph); - - if (PH_CELLS_USED (ph) == 0) - remove_page_from_used_list (ph); - else if (PH_CELLS_USED (ph) < PH_CELLS_ON_PAGE (ph)) - move_page_header_to_front (ph); + /* Manual frees are not allowed with asynchronous finalization */ + return; } @@ -1871,7 +1777,6 @@ } -#ifdef NEW_GC /*--- incremental garbage collector ----------------------------------*/ /* access dirty bit of page header */ @@ -2062,5 +1967,3 @@ page_header *ph = get_page_header_internal (ptr); return (ph && PH_ON_USED_LIST_P (ph)); } - -#endif /* NEW_GC */
--- a/src/mc-alloc.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/mc-alloc.h Mon Feb 27 16:29:29 2006 +0000 @@ -72,7 +72,6 @@ /* Garbage collection related functions and macros: */ -#ifdef NEW_GC enum mark_bit_colors { WHITE = 0, @@ -103,23 +102,6 @@ #define MARKED_WHITE_P(ptr) (get_mark_bit (ptr) == WHITE) #define MARKED_GREY_P(ptr) (get_mark_bit (ptr) == GREY) #define MARKED_BLACK_P(ptr) (get_mark_bit (ptr) == BLACK) -#else /* not NEW_GC */ -/* Set the mark bit of the object pointed to by ptr to value.*/ -void set_mark_bit (void *ptr, EMACS_INT value); - -/* Return the mark bit of the object pointed to by ptr. */ -EMACS_INT get_mark_bit (void *ptr); - -/* mark bit macros */ -/* Returns true if the mark bit of the object pointed to by ptr is set. */ -#define MARKED_P(ptr) (get_mark_bit (ptr) == 1) - -/* Marks the object pointed to by ptr (sets the mark bit to 1). */ -#define MARK(ptr) set_mark_bit (ptr, 1) - -/* Unmarks the object pointed to by ptr (sets the mark bit to 0). */ -#define UNMARK(ptr) set_mark_bit (ptr, 0) -#endif /* not NEW_GC */ /* The finalizer of every not marked object is called. The macro MC_ALLOC_CALL_FINALIZER has to be defined and call the finalizer of @@ -150,7 +132,6 @@ #endif /* MEMORY_USAGE_STATS */ -#ifdef NEW_GC /* Incremental Garbage Collector / Write Barrier Support: */ /* Return the PAGESIZE the allocator uses. Generally equals to the @@ -180,8 +161,6 @@ /* Only for debugging---not used anywhere in the sources. */ EMACS_INT object_on_heap_p (void *ptr); -#endif /* NEW_GC */ - END_C_DECLS #endif /* INCLUDED_mc_alloc_h_ */
--- a/src/opaque.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/opaque.c Mon Feb 27 16:29:29 2006 +0000 @@ -38,9 +38,9 @@ #include "lisp.h" #include "opaque.h" -#ifndef MC_ALLOC +#ifndef NEW_GC Lisp_Object Vopaque_ptr_free_list; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ /* Should never, ever be called. (except by an external debugger) */ static void @@ -162,13 +162,13 @@ Lisp_Object make_opaque_ptr (void *val) { -#ifdef MC_ALLOC +#ifdef NEW_GC Lisp_Object res = wrap_pointer_1 (alloc_lrecord_type (Lisp_Opaque_Ptr, &lrecord_opaque_ptr)); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ Lisp_Object res = alloc_managed_lcrecord (Vopaque_ptr_free_list); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ set_opaque_ptr (res, val); return res; } @@ -179,14 +179,14 @@ void free_opaque_ptr (Lisp_Object ptr) { -#ifdef MC_ALLOC +#ifdef NEW_GC free_lrecord (ptr); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ free_managed_lcrecord (Vopaque_ptr_free_list, ptr); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } -#ifndef MC_ALLOC +#ifndef NEW_GC void reinit_opaque_early (void) { @@ -194,7 +194,7 @@ &lrecord_opaque_ptr); staticpro_nodump (&Vopaque_ptr_free_list); } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void init_opaque_once_early (void) @@ -202,7 +202,7 @@ INIT_LRECORD_IMPLEMENTATION (opaque); INIT_LRECORD_IMPLEMENTATION (opaque_ptr); -#ifndef MC_ALLOC +#ifndef NEW_GC reinit_opaque_early (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ }
--- a/src/print.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/print.c Mon Feb 27 16:29:29 2006 +0000 @@ -1458,19 +1458,19 @@ if (print_readably) printing_unreadable_object ("#<%s 0x%x>", -#ifdef MC_ALLOC +#ifdef NEW_GC LHEADER_IMPLEMENTATION (header)->name, -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ LHEADER_IMPLEMENTATION (&header->lheader)->name, -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ header->uid); write_fmt_string (printcharfun, "#<%s 0x%x>", -#ifdef MC_ALLOC +#ifdef NEW_GC LHEADER_IMPLEMENTATION (header)->name, -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ LHEADER_IMPLEMENTATION (&header->lheader)->name, -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ header->uid); } @@ -1692,7 +1692,7 @@ } } -#ifndef MC_ALLOC +#ifndef NEW_GC if (lheader->type == lrecord_type_free) { printing_major_badness (printcharfun, "freed lrecord", 0, @@ -1705,7 +1705,7 @@ lheader, BADNESS_NO_TYPE); break; } -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ else if ((int) (lheader->type) >= lrecord_type_count) { printing_major_badness (printcharfun, "illegal lrecord type", @@ -2222,19 +2222,19 @@ debug_out ("<< bad object type=%d 0x%lx>>", header->type, (EMACS_INT) header); else -#ifdef MC_ALLOC +#ifdef NEW_GC debug_out ("#<%s addr=0x%lx uid=0x%lx>", LHEADER_IMPLEMENTATION (header)->name, (EMACS_INT) header, (EMACS_INT) ((struct lrecord_header *) header)->uid); -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ debug_out ("#<%s addr=0x%lx uid=0x%lx>", LHEADER_IMPLEMENTATION (header)->name, (EMACS_INT) header, (EMACS_INT) (LHEADER_IMPLEMENTATION (header)->basic_p ? ((struct lrecord_header *) header)->uid : ((struct old_lcrecord_header *) header)->uid)); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ } inhibit_non_essential_conversion_operations = 0;
--- a/src/ralloc.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/ralloc.c Mon Feb 27 16:29:29 2006 +0000 @@ -61,9 +61,9 @@ #include "getpagesize.h" #include <string.h> -#ifndef MC_ALLOC +#ifndef NEW_GC void refill_memory_reserve (void); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #else /* Not emacs. */ @@ -986,9 +986,9 @@ *ptr = 0; #ifdef emacs -#ifndef MC_ALLOC +#ifndef NEW_GC refill_memory_reserve (); -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #endif }
--- a/src/specifier.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/specifier.c Mon Feb 27 16:29:29 2006 +0000 @@ -295,6 +295,7 @@ write_fmt_string (printcharfun, " 0x%x>", sp->header.uid); } +#ifndef NEW_GC static void finalize_specifier (void *header, int for_disksave) { @@ -302,14 +303,11 @@ /* don't be snafued by the disksave finalization. */ if (!for_disksave && !GHOST_SPECIFIER_P(sp) && sp->caching) { -#ifdef NEW_GC - mc_free (sp->caching); -#else /* not NEW_GC */ xfree (sp->caching, struct specifier_caching *); -#endif /* not NEW_GC */ sp->caching = 0; } } +#endif /* not NEW_GC */ static int specifier_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) @@ -438,6 +436,15 @@ 0, specifier_empty_extra_description_1 }; +#ifdef NEW_GC +DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("specifier", specifier, + 1, /*dumpable-flag*/ + mark_specifier, print_specifier, + 0, specifier_equal, specifier_hash, + specifier_description, + sizeof_specifier, + Lisp_Specifier); +#else /* not NEW_GC */ DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("specifier", specifier, 1, /*dumpable-flag*/ mark_specifier, print_specifier, @@ -446,6 +453,7 @@ specifier_description, sizeof_specifier, Lisp_Specifier); +#endif /* not NEW_GC */ /************************************************************************/ /* Creating specifiers */
--- a/src/symbols.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/symbols.c Mon Feb 27 16:29:29 2006 +0000 @@ -3252,7 +3252,7 @@ Lisp_Object Qnull_pointer; #endif -#ifndef MC_ALLOC +#ifndef NEW_GC /* some losing systems can't have static vars at function scope... */ static const struct symbol_value_magic guts_of_unbound_marker = { /* struct symbol_value_magic */ @@ -3270,7 +3270,7 @@ 0, /* value */ SYMVAL_UNBOUND_MARKER }; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void init_symbols_once_early (void) @@ -3302,7 +3302,7 @@ { /* Required to get around a GCC syntax error on certain architectures */ -#ifdef MC_ALLOC +#ifdef NEW_GC struct symbol_value_magic *tem = (struct symbol_value_magic *) mc_alloc (sizeof (struct symbol_value_magic)); MARK_LRECORD_AS_LISP_READONLY (tem); @@ -3315,9 +3315,9 @@ inc_lrecord_stats (sizeof (struct symbol_value_magic), (const struct lrecord_header *) tem); #endif /* ALLOC_TYPE_STATS */ -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ const struct symbol_value_magic *tem = &guts_of_unbound_marker; -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ Qunbound = wrap_symbol_value_magic (tem); } @@ -3454,7 +3454,7 @@ #endif #ifdef HAVE_SHLIB -#ifndef MC_ALLOC +#ifndef NEW_GC /* * If we are not in a pure undumped Emacs, we need to make a duplicate of * the subr. This is because the only time this function will be called @@ -3514,7 +3514,7 @@ subr = newsubr; \ } \ } while (0) -#else /* MC_ALLOC */ +#else /* NEW_GC */ /* * If we have the new allocator enabled, we do not need to make a * duplicate of the subr. The new allocator already does allocate all @@ -3552,7 +3552,7 @@ signal_ferror (Qdll_error, "Attempt to redefine %s", subr_name (subr)); \ } \ } while (0) -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ #else /* ! HAVE_SHLIB */ #define check_module_subr(subr) #endif
--- a/src/symeval.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/symeval.h Mon Feb 27 16:29:29 2006 +0000 @@ -277,7 +277,7 @@ DEFUN ("name, Fname, ...); // at top level in foo.c DEFSUBR (Fname); // in syms_of_foo(); */ -#ifdef MC_ALLOC +#ifdef NEW_GC MODULE_API void defsubr (Lisp_Subr *); #define DEFSUBR_MC_ALLOC(Fname) \ S##Fname= (struct Lisp_Subr *) mc_alloc (sizeof (struct Lisp_Subr)); \ @@ -309,7 +309,7 @@ defsubr_macro (S##Fname); \ } while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ /* To define a Lisp primitive function using a C function `Fname', do this: DEFUN ("name, Fname, ...); // at top level in foo.c DEFSUBR (Fname); // in syms_of_foo(); @@ -323,7 +323,7 @@ */ MODULE_API void defsubr_macro (Lisp_Subr *); #define DEFSUBR_MACRO(Fname) defsubr_macro (&S##Fname) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ MODULE_API void defsymbol_massage_name (Lisp_Object *location, const char *name); @@ -396,7 +396,7 @@ MODULE_API void defvar_magic (const char *symbol_name, const struct symbol_value_forward *magic); -#ifdef MC_ALLOC +#ifdef NEW_GC #define DEFVAR_SYMVAL_FWD(lname, c_location, forward_type, magic_fun) \ do \ { \ @@ -413,7 +413,7 @@ \ defvar_magic ((lname), I_hate_C); \ } while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define DEFVAR_SYMVAL_FWD(lname, c_location, forward_type, magicfun) \ do \ { \ @@ -439,7 +439,7 @@ }; \ defvar_magic ((lname), &I_hate_C); \ } while (0) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ #define DEFVAR_SYMVAL_FWD_INT(lname, c_location, forward_type, magicfun) \ do \ { \
--- a/src/symsinit.h Sun Feb 26 22:51:04 2006 +0000 +++ b/src/symsinit.h Mon Feb 27 16:29:29 2006 +0000 @@ -140,9 +140,9 @@ void syms_of_lread (void); void syms_of_macros (void); void syms_of_marker (void); -#ifdef MC_ALLOC +#ifdef NEW_GC void syms_of_mc_alloc (void); -#endif /* MC_ALLOC */ +#endif /* NEW_GC */ void syms_of_md5 (void); void syms_of_menubar (void); void syms_of_menubar_mswindows (void);
--- a/src/tests.c Sun Feb 26 22:51:04 2006 +0000 +++ b/src/tests.c Mon Feb 27 16:29:29 2006 +0000 @@ -479,7 +479,7 @@ -#ifdef MC_ALLOC +#ifdef NEW_GC #define TESTS_DEFSUBR(Fname) do { \ DEFSUBR_MC_ALLOC (Fname); \ defsubr (S##Fname); \ @@ -487,14 +487,14 @@ Fcons (intern (subr_name (S##Fname)), \ Vtest_function_list); \ } while (0) -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ #define TESTS_DEFSUBR(Fname) do { \ DEFSUBR (Fname); \ Vtest_function_list = \ Fcons (intern (subr_name (&S##Fname)), \ Vtest_function_list); \ } while (0) -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ void syms_of_tests (void)
--- a/src/xemacs.def.in.in Sun Feb 26 22:51:04 2006 +0000 +++ b/src/xemacs.def.in.in Mon Feb 27 16:29:29 2006 +0000 @@ -9,7 +9,7 @@ EXPORTS /* Exported functions */ acons -#ifdef MC_ALLOC +#ifdef NEW_GC alloc_lrecord /* alloc_lrecord_type */ lrecord_subr /* DEFSUBR */ lrecord_symbol_value_forward /* DEFVAR_SYMVAL_FWD */ @@ -17,9 +17,9 @@ mcpro_1 /* mcpro */ #endif mc_alloc /* DEFSUBR */ -#else /* not MC_ALLOC */ +#else /* not NEW_GC */ alloc_automanaged_lcrecord /* old_alloc_lcrecord_type */ -#endif /* not MC_ALLOC */ +#endif /* not NEW_GC */ apply1 #ifdef USE_ASSERTIONS assert_failed /* abort(), assert(), etc. */