NOTE: This patch has been committed.
modules/ChangeLog addition:
2005-10-25 Ben Wing <ben(a)xemacs.org>
* postgresql/postgresql.c (allocate_pgconn):
* postgresql/postgresql.c (allocate_pgresult):
* postgresql/postgresql.h (struct Lisp_PGconn):
* postgresql/postgresql.h (struct Lisp_PGresult):
MC-Alloc refactoring.
2005-10-25 Ben Wing <ben(a)xemacs.org>
* ldap/eldap.c (allocate_ldap):
* ldap/eldap.h (struct Lisp_LDAP):
MC-Alloc refactoring.
src/ChangeLog addition:
2005-10-25 Ben Wing <ben(a)xemacs.org>
* alloc.c:
* alloc.c (old_basic_alloc_lcrecord):
* alloc.c (very_old_free_lcrecord):
* alloc.c (disksave_object_finalization_1):
* alloc.c (copy_lisp_object):
* alloc.c (make_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (old_free_lcrecord):
* alloc.c (GC_CHECK_NOT_FREE):
* alloc.c (tick_lcrecord_stats):
* alloc.c (sweep_lcrecords_1):
* buffer.c (compute_buffer_usage):
* buffer.c (DEFVAR_BUFFER_LOCAL_1):
* console.c (DEFVAR_CONSOLE_LOCAL_1):
* emacs.c:
* emacs.c (main_1):
* file-coding.c (allocate_coding_system):
* lrecord.h:
* lrecord.h (struct old_lcrecord_header):
* lrecord.h (struct free_lcrecord_header):
* lrecord.h (struct lrecord_implementation):
* lrecord.h (struct lcrecord_list):
* lrecord.h (old_alloc_lcrecord_type):
* lrecord.h (old_copy_sized_lcrecord):
* lrecord.h (old_zero_lcrecord):
* lstream.c (Lstream_new):
* mule-charset.c (compute_charset_usage):
* print.c (debug_p4):
* scrollbar-gtk.c (gtk_compute_scrollbar_instance_usage):
* scrollbar-msw.c (mswindows_compute_scrollbar_instance_usage):
* scrollbar-x.c (x_compute_scrollbar_instance_usage):
* scrollbar.c (compute_scrollbar_instance_usage):
* symbols.c (guts_of_unbound_marker):
* symeval.h (DEFVAR_SYMVAL_FWD):
* unicode.c (compute_from_unicode_table_size_1):
* unicode.c (compute_to_unicode_table_size_1):
* window.c (compute_window_mirror_usage):
* window.c (compute_window_usage):
* xemacs.def.in.in:
rename `struct lcrecord_header' to `struct old_lcrecord_header';
likewise for `old_basic_alloc_lcrecord', `old_free_lcrecord',
`old_zero_lcrecord', `old_zero_sized_lcrecord', `old_copy_lcrecord',
`old_copy_sized_lcrecord', `old_alloc_lcrecord_type'. Created new
LISPOBJ_STORAGE_SIZE() used only on objects created through allocation
of Lisp-Object memory instead of basic xmalloc()/xfree(). This is
distinguished from malloced_storage_size(), for non-Lisp-Objects.
The definition of LISPOBJ_STORAGE_SIZE() can reduce down to
malloced_storage_size() when not MC-ALLOC, but with MC-ALLOC it's
a different function.
The whole point other than cleaning up the use of LISPOBJ_STORAGE_SIZE
is to make it harder to accidentally use the old kind (lowercase) of
function in new code, since you get a compile error.
latest source patch:
Diff command: bash -ci "cvs-diff --show-c-function -no-changelog "
Files affected: src/xemacs.def.in.in src/window.c src/unicode.c src/symeval.h
src/symbols.c src/scrollbar.c src/scrollbar-x.c src/scrollbar-msw.c src/scrollbar-gtk.c
src/print.c src/mule-charset.c src/lstream.c src/lrecord.h src/file-coding.c src/emacs.c
src/console.c src/buffer.c src/alloc.c modules/postgresql/postgresql.h
modules/postgresql/postgresql.c modules/ldap/eldap.h modules/ldap/eldap.c
cvs server: Diffing .
cvs server: Diffing dynodump
cvs server: Diffing dynodump/i386
cvs server: Diffing dynodump/ppc
cvs server: Diffing dynodump/sparc
cvs server: Diffing etc
cvs server: Diffing etc/custom
cvs server: Diffing etc/custom/example-themes
cvs server: Diffing etc/eos
cvs server: Diffing etc/idd
cvs server: Diffing etc/photos
cvs server: Diffing etc/sparcworks
cvs server: Diffing etc/tests
cvs server: Diffing etc/tests/external-widget
cvs server: Diffing etc/toolbar
cvs server: Diffing etc/unicode
cvs server: Diffing etc/unicode/ibm
cvs server: Diffing etc/unicode/mule-ucs
cvs server: Diffing etc/unicode/other
cvs server: Diffing etc/unicode/unicode-consortium
cvs server: Diffing info
cvs server: Diffing lib-src
cvs server: Diffing lisp
cvs server: Diffing lisp/mule
cvs server: Diffing lisp/term
cvs server: Diffing lock
cvs server: Diffing lwlib
cvs server: Diffing man
cvs server: Diffing man/internals
cvs server: Diffing man/lispref
cvs server: Diffing man/new-users-guide
cvs server: Diffing man/xemacs
cvs server: Diffing modules
cvs server: Diffing modules/base64
cvs server: Diffing modules/canna
cvs server: Diffing modules/common
cvs server: Diffing modules/ldap
Index: modules/ldap/eldap.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/modules/ldap/eldap.c,v
retrieving revision 1.13
diff -u -p -r1.13 eldap.c
--- modules/ldap/eldap.c 2005/04/08 23:10:55 1.13
+++ modules/ldap/eldap.c 2005/10/25 07:31:43
@@ -141,11 +141,7 @@ print_ldap (Lisp_Object obj, Lisp_Object
static Lisp_LDAP *
allocate_ldap (void)
{
-#ifdef MC_ALLOC
- Lisp_LDAP *ldap = alloc_lrecord_type (Lisp_LDAP, &lrecord_ldap);
-#else /* not MC_ALLOC */
- Lisp_LDAP *ldap = alloc_lcrecord_type (Lisp_LDAP, &lrecord_ldap);
-#endif /* not MC_ALLOC */
+ Lisp_LDAP *ldap = ALLOC_LCRECORD_TYPE (Lisp_LDAP, &lrecord_ldap);
ldap->ld = NULL;
ldap->host = Qnil;
Index: modules/ldap/eldap.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/modules/ldap/eldap.h,v
retrieving revision 1.3
diff -u -p -r1.3 eldap.h
--- modules/ldap/eldap.h 2005/04/08 23:10:55 1.3
+++ modules/ldap/eldap.h 2005/10/25 07:31:43
@@ -31,13 +31,7 @@ Boston, MA 02111-1307, USA. */
struct Lisp_LDAP
{
-#ifdef MC_ALLOC
- /* lrecord header */
- struct lrecord_header header;
-#else /* not MC_ALLOC */
- /* lcrecord header */
- struct lcrecord_header header;
-#endif /* not MC_ALLOC */
+ struct LCRECORD_HEADER header;
/* The LDAP connection handle used by the LDAP API */
LDAP *ld;
/* Name of the host we connected to */
cvs server: Diffing modules/postgresql
Index: modules/postgresql/postgresql.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/modules/postgresql/postgresql.c,v
retrieving revision 1.7
diff -u -p -r1.7 postgresql.c
--- modules/postgresql/postgresql.c 2005/04/08 23:11:00 1.7
+++ modules/postgresql/postgresql.c 2005/10/25 07:31:43
@@ -238,21 +238,11 @@ static Lisp_PGconn *
allocate_pgconn (void)
{
#ifdef RUNNING_XEMACS_21_1
-#ifdef MC_ALLOC
- Lisp_PGconn *pgconn = alloc_lrecord_type (Lisp_PGconn,
- lrecord_pgconn);
-#else /* not MC_ALLOC */
- Lisp_PGconn *pgconn = alloc_lcrecord_type (Lisp_PGconn,
+ Lisp_PGconn *pgconn = ALLOC_LCRECORD_TYPE (Lisp_PGconn,
lrecord_pgconn);
-#endif /* not MC_ALLOC */
#else
-#ifdef MC_ALLOC
- Lisp_PGconn *pgconn = alloc_lrecord_type (Lisp_PGconn,
- &lrecord_pgconn);
-#else /* not MC_ALLOC */
- Lisp_PGconn *pgconn = alloc_lcrecord_type (Lisp_PGconn,
+ Lisp_PGconn *pgconn = ALLOC_LCRECORD_TYPE (Lisp_PGconn,
&lrecord_pgconn);
-#endif /* not MC_ALLOC */
#endif
pgconn->pgconn = (PGconn *)NULL;
return pgconn;
@@ -373,21 +363,11 @@ static Lisp_PGresult *
allocate_pgresult (void)
{
#ifdef RUNNING_XEMACS_21_1
-#ifdef MC_ALLOC
- Lisp_PGresult *pgresult = alloc_lrecord_type (Lisp_PGresult,
- lrecord_pgresult);
-#else /* not MC_ALLOC */
- Lisp_PGresult *pgresult = alloc_lcrecord_type (Lisp_PGresult,
+ Lisp_PGresult *pgresult = ALLOC_LCRECORD_TYPE (Lisp_PGresult,
lrecord_pgresult);
-#endif /* not MC_ALLOC */
#else
-#ifdef MC_ALLOC
- Lisp_PGresult *pgresult = alloc_lrecord_type (Lisp_PGresult,
- &lrecord_pgresult);
-#else /* not MC_ALLOC */
- Lisp_PGresult *pgresult = alloc_lcrecord_type (Lisp_PGresult,
+ Lisp_PGresult *pgresult = ALLOC_LCRECORD_TYPE (Lisp_PGresult,
&lrecord_pgresult);
-#endif /* not MC_ALLOC */
#endif
pgresult->pgresult = (PGresult *)NULL;
return pgresult;
Index: modules/postgresql/postgresql.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/modules/postgresql/postgresql.h,v
retrieving revision 1.2
diff -u -p -r1.2 postgresql.h
--- modules/postgresql/postgresql.h 2005/04/08 23:11:00 1.2
+++ modules/postgresql/postgresql.h 2005/10/25 07:31:43
@@ -28,11 +28,7 @@ xemacs-patches.
*/
struct Lisp_PGconn
{
-#ifdef MC_ALLOC
- struct lrecord_header header;
-#else /* not MC_ALLOC */
- struct lcrecord_header header;
-#endif /* not MC_ALLOC */
+ struct LCRECORD_HEADER header;
PGconn *pgconn;
};
typedef struct Lisp_PGconn Lisp_PGconn;
@@ -52,11 +48,7 @@ DECLARE_LRECORD (pgconn, Lisp_PGconn);
*/
struct Lisp_PGresult
{
-#ifdef MC_ALLOC
- struct lrecord_header header;
-#else /* not MC_ALLOC */
- struct lcrecord_header header;
-#endif /* not MC_ALLOC */
+ struct LCRECORD_HEADER header;
PGresult *pgresult;
};
typedef struct Lisp_PGresult Lisp_PGresult;
cvs server: Diffing modules/sample
cvs server: Diffing modules/sample/external
cvs server: Diffing modules/sample/internal
cvs server: Diffing modules/zlib
cvs server: Diffing netinstall
cvs server: Diffing nt
cvs server: Diffing nt/installer
cvs server: Diffing nt/installer/Wise
cvs server: Diffing src
Index: src/alloc.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/alloc.c,v
retrieving revision 1.117
diff -u -p -r1.117 alloc.c
--- src/alloc.c 2005/10/24 10:07:33 1.117
+++ src/alloc.c 2005/10/25 07:31:45
@@ -587,7 +587,7 @@ dec_lrecord_stats (Bytecount size_includ
/* 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 lcrecord_header *all_lcrecords;
+static struct old_lcrecord_header *all_lcrecords;
#endif /* not MC_ALLOC */
#ifdef MC_ALLOC
@@ -653,10 +653,10 @@ free_lrecord (Lisp_Object lrecord)
specified size. See lrecord.h. */
void *
-basic_alloc_lcrecord (Bytecount size,
- const struct lrecord_implementation *implementation)
+old_basic_alloc_lcrecord (Bytecount size,
+ const struct lrecord_implementation *implementation)
{
- struct lcrecord_header *lcheader;
+ struct old_lcrecord_header *lcheader;
type_checking_assert
((implementation->static_size == 0 ?
@@ -667,7 +667,7 @@ basic_alloc_lcrecord (Bytecount size,
&&
(! (implementation->hash == NULL && implementation->equal != NULL)));
- lcheader = (struct lcrecord_header *) allocate_lisp_storage (size);
+ lcheader = (struct old_lcrecord_header *) allocate_lisp_storage (size);
set_lheader_implementation (&lcheader->lheader, implementation);
lcheader->next = all_lcrecords;
#if 1 /* mly prefers to see small ID numbers */
@@ -689,7 +689,7 @@ basic_alloc_lcrecord (Bytecount size,
* Otherwise, just let the GC do its job -- that's what it's there for
*/
void
-very_old_free_lcrecord (struct lcrecord_header *lcrecord)
+very_old_free_lcrecord (struct old_lcrecord_header *lcrecord)
{
if (all_lcrecords == lcrecord)
{
@@ -697,10 +697,10 @@ very_old_free_lcrecord (struct lcrecord_
}
else
{
- struct lrecord_header *header = all_lcrecords;
+ struct old_lcrecord_header *header = all_lcrecords;
for (;;)
{
- struct lrecord_header *next = header->next;
+ struct old_lcrecord_header *next = header->next;
if (next == lcrecord)
{
header->next = lrecord->next;
@@ -727,7 +727,7 @@ disksave_object_finalization_1 (void)
#ifdef MC_ALLOC
mc_finalize_for_disksave ();
#else /* not MC_ALLOC */
- struct lcrecord_header *header;
+ struct old_lcrecord_header *header;
for (header = all_lcrecords; header; header = header->next)
{
@@ -760,9 +760,11 @@ copy_lisp_object (Lisp_Object dst, Lisp_
(char *) XRECORD_LHEADER (src) + sizeof (struct lrecord_header),
size - sizeof (struct lrecord_header));
else
- memcpy ((char *) XRECORD_LHEADER (dst) + sizeof (struct lcrecord_header),
- (char *) XRECORD_LHEADER (src) + sizeof (struct lcrecord_header),
- size - sizeof (struct lcrecord_header));
+ memcpy ((char *) XRECORD_LHEADER (dst) +
+ sizeof (struct old_lcrecord_header),
+ (char *) XRECORD_LHEADER (src) +
+ sizeof (struct old_lcrecord_header),
+ size - sizeof (struct old_lcrecord_header));
#endif /* not MC_ALLOC */
}
@@ -2887,7 +2889,7 @@ make_string_nocopy (const Ibyte *content
/************************************************************************/
/* Lcrecord lists are used to manage the allocation of particular
- sorts of lcrecords, to avoid calling basic_alloc_lcrecord() (and thus
+ sorts of lcrecords, to avoid calling BASIC_ALLOC_LCRECORD() (and thus
malloc() and garbage-collection junk) as much as possible.
It is similar to the Blocktype class.
@@ -2959,11 +2961,11 @@ Lisp_Object
make_lcrecord_list (Elemcount size,
const struct lrecord_implementation *implementation)
{
- /* Don't use alloc_lcrecord_type() avoid infinite recursion
+ /* Don't use old_alloc_lcrecord_type() avoid infinite recursion
allocating this, */
struct lcrecord_list *p = (struct lcrecord_list *)
- basic_alloc_lcrecord (sizeof (struct lcrecord_list),
- &lrecord_lcrecord_list);
+ old_basic_alloc_lcrecord (sizeof (struct lcrecord_list),
+ &lrecord_lcrecord_list);
p->implementation = implementation;
p->size = size;
@@ -3005,12 +3007,12 @@ alloc_managed_lcrecord (Lisp_Object lcre
free_header->lcheader.free = 0;
/* Put back the correct type, as we set it to lrecord_type_free. */
lheader->type = list->implementation->lrecord_type_index;
- zero_sized_lcrecord (free_header, list->size);
+ old_zero_sized_lcrecord (free_header, list->size);
return val;
}
else
- return wrap_pointer_1 (basic_alloc_lcrecord (list->size,
- list->implementation));
+ return wrap_pointer_1 (old_basic_alloc_lcrecord (list->size,
+ list->implementation));
}
/* "Free" a Lisp object LCRECORD by placing it on its associated free list
@@ -3081,7 +3083,7 @@ alloc_automanaged_lcrecord (Bytecount si
}
void
-free_lcrecord (Lisp_Object rec)
+old_free_lcrecord (Lisp_Object rec)
{
int type = XRECORD_LHEADER (rec)->type;
@@ -3617,7 +3619,7 @@ lispdesc_block_size_1 (const void *obj,
#define GC_CHECK_NOT_FREE(lheader) \
gc_checking_assert (! LRECORD_FREE_P (lheader)); \
gc_checking_assert (LHEADER_IMPLEMENTATION (lheader)->basic_p || \
- ! ((struct lcrecord_header *) lheader)->free)
+ ! ((struct old_lcrecord_header *) lheader)->free)
#endif /* MC_ALLOC */
#ifdef USE_KKCC
@@ -4148,7 +4150,7 @@ tick_lcrecord_stats (const struct lrecor
{
int type_index = h->type;
- if (((struct lcrecord_header *) h)->free)
+ if (((struct old_lcrecord_header *) h)->free)
{
gc_checking_assert (!free_p);
lcrecord_stats[type_index].instances_on_free_list++;
@@ -4175,9 +4177,9 @@ tick_lcrecord_stats (const struct lrecor
#ifndef MC_ALLOC
/* Free all unmarked records */
static void
-sweep_lcrecords_1 (struct lcrecord_header **prev, int *used)
+sweep_lcrecords_1 (struct old_lcrecord_header **prev, int *used)
{
- struct lcrecord_header *header;
+ struct old_lcrecord_header *header;
int num_used = 0;
/* int total_size = 0; */
@@ -4222,11 +4224,11 @@ sweep_lcrecords_1 (struct lcrecord_heade
}
else
{
- struct lcrecord_header *next = header->next;
+ struct old_lcrecord_header *next = header->next;
*prev = next;
tick_lcrecord_stats (h, 1);
/* used to call finalizer right here. */
- xfree (header, struct lcrecord_header *);
+ xfree (header, struct old_lcrecord_header *);
header = next;
}
}
Index: src/buffer.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/buffer.c,v
retrieving revision 1.72
diff -u -p -r1.72 buffer.c
--- src/buffer.c 2005/10/24 10:07:33 1.72
+++ src/buffer.c 2005/10/25 07:31:46
@@ -1757,7 +1757,7 @@ compute_buffer_usage (struct buffer *b,
struct overhead_stats *ovstats)
{
xzero (*stats);
- stats->other += MALLOCED_STORAGE_SIZE (b, sizeof (*b), ovstats);
+ stats->other += LISPOBJ_STORAGE_SIZE (b, sizeof (*b), ovstats);
stats->text += compute_buffer_text_usage (b, ovstats);
stats->markers += compute_buffer_marker_usage (b, ovstats);
stats->extents += compute_buffer_extent_usage (b, ovstats);
@@ -2146,7 +2146,7 @@ do { \
static const struct symbol_value_forward I_hate_C = \
{ /* struct symbol_value_forward */ \
{ /* struct symbol_value_magic */ \
- { /* struct lcrecord_header */ \
+ { /* struct old_lcrecord_header */ \
{ /* struct lrecord_header */ \
lrecord_type_symbol_value_forward, /* lrecord_type_index */ \
1, /* mark bit */ \
Index: src/console.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/console.c,v
retrieving revision 1.42
diff -u -p -r1.42 console.c
--- src/console.c 2005/10/24 10:07:34 1.42
+++ src/console.c 2005/10/25 07:31:46
@@ -1341,7 +1341,7 @@ do { \
static const struct symbol_value_forward I_hate_C = \
{ /* struct symbol_value_forward */ \
{ /* struct symbol_value_magic */ \
- { /* struct lcrecord_header */ \
+ { /* struct old_lcrecord_header */ \
{ /* struct lrecord_header */ \
lrecord_type_symbol_value_forward, /* lrecord_type_index */ \
1, /* mark bit */ \
Index: src/emacs.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/emacs.c,v
retrieving revision 1.159
diff -u -p -r1.159 emacs.c
--- src/emacs.c 2005/10/14 01:22:00 1.159
+++ src/emacs.c 2005/10/25 07:31:48
@@ -2,7 +2,7 @@
Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994
Free Software Foundation, Inc.
Copyright (C) 1995 Sun Microsystems, Inc.
- Copyright (C) 2000, 2001, 2002, 2003, 2004 Ben Wing.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Ben Wing.
This file is part of XEmacs.
@@ -1973,7 +1973,8 @@ main_1 (int argc, Wexttext **argv, Wextt
- make_int()
- make_char()
- make_extent()
- - basic_alloc_lcrecord()
+ - BASIC_ALLOC_LCRECORD()
+ - ALLOC_LCRECORD_TYPE()
- Fcons()
- listN()
- make_lcrecord_list()
Index: src/file-coding.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/file-coding.c,v
retrieving revision 1.47
diff -u -p -r1.47 file-coding.c
--- src/file-coding.c 2005/10/24 10:07:36 1.47
+++ src/file-coding.c 2005/10/25 07:31:49
@@ -698,13 +698,8 @@ allocate_coding_system (struct coding_sy
{
Bytecount total_size = offsetof (Lisp_Coding_System, data) + data_size;
Lisp_Coding_System *codesys =
-#ifdef MC_ALLOC
- (Lisp_Coding_System *) alloc_lrecord (total_size,
- &lrecord_coding_system);
-#else /* not MC_ALLOC */
- (Lisp_Coding_System *) basic_alloc_lcrecord (total_size,
+ (Lisp_Coding_System *) BASIC_ALLOC_LCRECORD (total_size,
&lrecord_coding_system);
-#endif /* not MC_ALLOC */
codesys->methods = codesys_meths;
#define MARKED_SLOT(x) codesys->x = Qnil;
Index: src/lrecord.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/lrecord.h,v
retrieving revision 1.40
diff -u -p -r1.40 lrecord.h
--- src/lrecord.h 2005/10/24 10:07:38 1.40
+++ src/lrecord.h 2005/10/25 07:31:49
@@ -67,9 +67,9 @@ Boston, MA 02111-1307, USA. */
Lcrecords are used for less common sorts of objects that don't do
their own allocation. Each such object is malloc()ed individually,
and the objects are chained together through a `next' pointer.
- Lcrecords have a `struct lcrecord_header' at the top, which
+ Lcrecords have a `struct old_lcrecord_header' at the top, which
contains a `struct lrecord_header' and a `next' pointer, and are
- allocated using alloc_lcrecord_type() or its variants.
+ allocated using old_alloc_lcrecord_type() or its variants.
Creating a new lcrecord type is fairly easy; just follow the
lead of some existing type (e.g. hash tables). Note that you
@@ -81,6 +81,27 @@ Boston, MA 02111-1307, USA. */
*/
#endif /* not MC_ALLOC */
+#ifdef MC_ALLOC
+#define ALLOC_LCRECORD_TYPE alloc_lrecord_type
+#define COPY_SIZED_LCRECORD copy_sized_lrecord
+#define COPY_LCRECORD copy_lrecord
+#define LISPOBJ_STORAGE_SIZE(ptr, size, stats) \
+ mc_alloced_storage_size (size, stats)
+#define ZERO_LCRECORD zero_lrecord
+#define LCRECORD_HEADER lrecord_header
+#define BASIC_ALLOC_LCRECORD alloc_lrecord
+#define FREE_LCRECORD free_lrecord
+#else
+#define ALLOC_LCRECORD_TYPE old_alloc_lcrecord_type
+#define COPY_SIZED_LCRECORD old_copy_sized_lcrecord
+#define COPY_LCRECORD old_copy_lcrecord
+#define LISPOBJ_STORAGE_SIZE malloced_storage_size
+#define ZERO_LCRECORD old_zero_lcrecord
+#define LCRECORD_HEADER old_lcrecord_header
+#define BASIC_ALLOC_LCRECORD old_basic_alloc_lcrecord
+#define FREE_LCRECORD old_free_lcrecord
+#endif
+
BEGIN_C_DECLS
struct lrecord_header
@@ -145,13 +166,13 @@ int lrecord_type_index (const struct lre
#endif /* not MC_ALLOC */
#ifndef MC_ALLOC
-struct lcrecord_header
+struct old_lcrecord_header
{
struct lrecord_header lheader;
/* The `next' field is normally used to chain all lcrecords together
so that the GC can find (and free) all of them.
- `basic_alloc_lcrecord' threads lcrecords together.
+ `old_basic_alloc_lcrecord' threads lcrecords together.
The `next' field may be used for other purposes as long as some
other mechanism is provided for letting the GC do its work.
@@ -159,7 +180,7 @@ struct lcrecord_header
For example, the event and marker object types allocate members
out of memory chunks, and are able to find all unmarked members
by sweeping through the elements of the list of chunks. */
- struct lcrecord_header *next;
+ struct old_lcrecord_header *next;
/* The `uid' field is just for debugging/printing convenience.
Having this slot doesn't hurt us much spacewise, since an
@@ -179,7 +200,7 @@ struct lcrecord_header
/* Used for lcrecords in an lcrecord-list. */
struct free_lcrecord_header
{
- struct lcrecord_header lcheader;
+ struct old_lcrecord_header lcheader;
Lisp_Object chain;
};
#endif /* not MC_ALLOC */
@@ -344,7 +365,8 @@ struct lrecord_implementation
/* Only one of `static_size' and `size_in_bytes_method' is non-0. */
#else /* not MC_ALLOC */
/* Only one of `static_size' and `size_in_bytes_method' is non-0.
- If both are 0, this type is not instantiable by basic_alloc_lcrecord(). */
+ If both are 0, this type is not instantiable by
+ old_basic_alloc_lcrecord(). */
#endif /* not MC_ALLOC */
Bytecount static_size;
Bytecount (*size_in_bytes_method) (const void *header);
@@ -354,7 +376,7 @@ struct lrecord_implementation
#ifndef MC_ALLOC
/* A "basic" lrecord is any lrecord that's not an lcrecord, i.e.
- one that does not have an lcrecord_header at the front and which
+ 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 */
@@ -1496,7 +1518,7 @@ extern Lisp_Object Q##c_name##p
struct lcrecord_list
{
- struct lcrecord_header header;
+ struct LCRECORD_HEADER header;
Lisp_Object free;
Elemcount size;
const struct lrecord_implementation *implementation;
@@ -1517,7 +1539,7 @@ DECLARE_LRECORD (lcrecord_list, struct l
lrecords. lcrecords themselves are divided into three types: (1)
auto-managed, (2) hand-managed, and (3) unmanaged. "Managed" refers to
using a special object called an lcrecord-list to keep track of freed
- lcrecords, which can freed with free_lcrecord() or the like and later be
+ lcrecords, which can freed with FREE_LCRECORD() or the like and later be
recycled when a new lcrecord is required, rather than requiring new
malloc(). Thus, allocation of lcrecords can be very
cheap. (Technically, the lcrecord-list manager could divide up large
@@ -1531,9 +1553,9 @@ DECLARE_LRECORD (lcrecord_list, struct l
in particular dictate the various types of management:
-- "Auto-managed" means that you just go ahead and allocate the lcrecord
- whenever you want, using alloc_lcrecord_type(), and the appropriate
+ whenever you want, using old_alloc_lcrecord_type(), and the appropriate
lcrecord-list manager is automatically created. To free, you just call
- "free_lcrecord()" and the appropriate lcrecord-list manager is
+ "FREE_LCRECORD()" and the appropriate lcrecord-list manager is
automatically located and called. The limitation here of course is that
all your objects are of the same size. (#### Eventually we should have a
more sophisticated system that tracks the sizes seen and creates one
@@ -1554,7 +1576,7 @@ DECLARE_LRECORD (lcrecord_list, struct l
to hand-manage them, or (b) the objects you create are always or almost
always Lisp-visible, and thus there's no point in freeing them (and it
wouldn't be safe to do so). You just create them with
- basic_alloc_lcrecord(), and that's it.
+ BASIC_ALLOC_LCRECORD(), and that's it.
--ben
@@ -1567,9 +1589,9 @@ DECLARE_LRECORD (lcrecord_list, struct l
1) Create an lcrecord-list object using make_lcrecord_list(). This is
often done at initialization. Remember to staticpro_nodump() this
object! The arguments to make_lcrecord_list() are the same as would be
- passed to basic_alloc_lcrecord().
+ passed to BASIC_ALLOC_LCRECORD().
- 2) Instead of calling basic_alloc_lcrecord(), call alloc_managed_lcrecord()
+ 2) Instead of calling BASIC_ALLOC_LCRECORD(), call alloc_managed_lcrecord()
and pass the lcrecord-list earlier created.
3) When done with the lcrecord, call free_managed_lcrecord(). The
@@ -1580,7 +1602,7 @@ DECLARE_LRECORD (lcrecord_list, struct l
lcrecord goodbye as if it were garbage-collected. This means:
-- the contents of the freed lcrecord are undefined, and the
contents of something produced by alloc_managed_lcrecord()
- are undefined, just like for basic_alloc_lcrecord().
+ are undefined, just like for BASIC_ALLOC_LCRECORD().
-- the mark method for the lcrecord's type will *NEVER* be called
on freed lcrecords.
-- the finalize method for the lcrecord's type will be called
@@ -1588,8 +1610,8 @@ DECLARE_LRECORD (lcrecord_list, struct l
*/
/* UNMANAGED MODEL: */
-void *basic_alloc_lcrecord (Bytecount size,
- const struct lrecord_implementation *);
+void *old_basic_alloc_lcrecord (Bytecount size,
+ const struct lrecord_implementation *);
/* HAND-MANAGED MODEL: */
Lisp_Object make_lcrecord_list (Elemcount size,
@@ -1603,27 +1625,28 @@ MODULE_API void *
alloc_automanaged_lcrecord (Bytecount size,
const struct lrecord_implementation *);
-#define alloc_lcrecord_type(type, lrecord_implementation) \
+#define old_alloc_lcrecord_type(type, lrecord_implementation) \
((type *) alloc_automanaged_lcrecord (sizeof (type), lrecord_implementation))
-void free_lcrecord (Lisp_Object rec);
+void old_free_lcrecord (Lisp_Object rec);
/* Copy the data from one lcrecord structure into another, but don't
overwrite the header information. */
-#define copy_sized_lcrecord(dst, src, size) \
- memcpy ((Rawbyte *) (dst) + sizeof (struct lcrecord_header), \
- (Rawbyte *) (src) + sizeof (struct lcrecord_header), \
- (size) - sizeof (struct lcrecord_header))
-
-#define copy_lcrecord(dst, src) copy_sized_lcrecord (dst, src, sizeof (*(dst)))
-
-#define zero_sized_lcrecord(lcr, size) \
- memset ((Rawbyte *) (lcr) + sizeof (struct lcrecord_header), 0, \
- (size) - sizeof (struct lcrecord_header))
+#define old_copy_sized_lcrecord(dst, src, size) \
+ memcpy ((Rawbyte *) (dst) + sizeof (struct old_lcrecord_header), \
+ (Rawbyte *) (src) + sizeof (struct old_lcrecord_header), \
+ (size) - sizeof (struct old_lcrecord_header))
+
+#define old_copy_lcrecord(dst, src) \
+ old_copy_sized_lcrecord (dst, src, sizeof (*(dst)))
+
+#define old_zero_sized_lcrecord(lcr, size) \
+ memset ((Rawbyte *) (lcr) + sizeof (struct old_lcrecord_header), 0, \
+ (size) - sizeof (struct old_lcrecord_header))
-#define zero_lcrecord(lcr) zero_sized_lcrecord (lcr, sizeof (*(lcr)))
+#define old_zero_lcrecord(lcr) old_zero_sized_lcrecord (lcr, sizeof (*(lcr)))
#else /* MC_ALLOC */
@@ -1693,27 +1716,6 @@ lisp_object_size (Lisp_Object o)
{
return detagged_lisp_object_size (XRECORD_LHEADER (o));
}
-
-#ifdef MC_ALLOC
-#define ALLOC_LCRECORD_TYPE alloc_lrecord_type
-#define COPY_SIZED_LCRECORD copy_sized_lrecord
-#define COPY_LCRECORD copy_lrecord
-#define MALLOCED_STORAGE_SIZE(ptr, size, stats) \
- mc_alloced_storage_size (size, stats)
-#define ZERO_LCRECORD zero_lrecord
-#define LCRECORD_HEADER lrecord_header
-#define BASIC_ALLOC_LCRECORD alloc_lrecord
-#define FREE_LCRECORD free_lrecord
-#else
-#define ALLOC_LCRECORD_TYPE alloc_lcrecord_type
-#define COPY_SIZED_LCRECORD copy_sized_lcrecord
-#define COPY_LCRECORD copy_lcrecord
-#define MALLOCED_STORAGE_SIZE malloced_storage_size
-#define ZERO_LCRECORD zero_lcrecord
-#define LCRECORD_HEADER lcrecord_header
-#define BASIC_ALLOC_LCRECORD basic_alloc_lcrecord
-#define FREE_LCRECORD free_lcrecord
-#endif
/************************************************************************/
Index: src/lstream.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/lstream.c,v
retrieving revision 1.35
diff -u -p -r1.35 lstream.c
--- src/lstream.c 2005/10/24 10:07:38 1.35
+++ src/lstream.c 2005/10/25 07:31:50
@@ -220,7 +220,6 @@ Lstream_new (const Lstream_implementatio
}
p = XLSTREAM (alloc_managed_lcrecord (Vlstream_free_list[i]));
-#define COPY_SIZED_LCRECORD copy_sized_lcrecord
#endif /* not MC_ALLOC */
/* Zero it out, except the header. */
memset ((char *) p + sizeof (p->header), '\0',
Index: src/mule-charset.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-charset.c,v
retrieving revision 1.44
diff -u -p -r1.44 mule-charset.c
--- src/mule-charset.c 2005/10/24 10:07:39 1.44
+++ src/mule-charset.c 2005/10/25 07:31:50
@@ -880,7 +880,7 @@ compute_charset_usage (Lisp_Object chars
{
struct Lisp_Charset *c = XCHARSET (charset);
xzero (*stats);
- stats->other += MALLOCED_STORAGE_SIZE (c, sizeof (*c), ovstats);
+ stats->other += LISPOBJ_STORAGE_SIZE (c, sizeof (*c), ovstats);
stats->from_unicode += compute_from_unicode_table_size (charset, ovstats);
stats->to_unicode += compute_to_unicode_table_size (charset, ovstats);
}
Index: src/print.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/print.c,v
retrieving revision 1.55
diff -u -p -r1.55 print.c
--- src/print.c 2005/10/24 10:07:39 1.55
+++ src/print.c 2005/10/25 07:31:51
@@ -2219,7 +2219,7 @@ debug_p4 (Lisp_Object obj)
LHEADER_IMPLEMENTATION (header)->name,
LHEADER_IMPLEMENTATION (header)->basic_p ?
(EMACS_INT) header :
- ((struct lcrecord_header *) header)->uid);
+ ((struct old_lcrecord_header *) header)->uid);
#endif /* not MC_ALLOC */
}
Index: src/scrollbar-gtk.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/scrollbar-gtk.c,v
retrieving revision 1.18
diff -u -p -r1.18 scrollbar-gtk.c
--- src/scrollbar-gtk.c 2005/10/24 10:07:40 1.18
+++ src/scrollbar-gtk.c 2005/10/25 07:31:51
@@ -484,7 +484,7 @@ gtk_compute_scrollbar_instance_usage (st
struct gtk_scrollbar_data *data =
(struct gtk_scrollbar_data *) inst->scrollbar_data;
- total += MALLOCED_STORAGE_SIZE (data, sizeof (*data), ovstats);
+ total += malloced_storage_size (data, sizeof (*data), ovstats);
inst = inst->next;
}
Index: src/scrollbar-msw.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/scrollbar-msw.c,v
retrieving revision 1.30
diff -u -p -r1.30 scrollbar-msw.c
--- src/scrollbar-msw.c 2005/10/24 10:07:40 1.30
+++ src/scrollbar-msw.c 2005/10/25 07:31:51
@@ -433,7 +433,7 @@ mswindows_compute_scrollbar_instance_usa
struct mswindows_scrollbar_data *data =
(struct mswindows_scrollbar_data *) inst->scrollbar_data;
- total += MALLOCED_STORAGE_SIZE (data, sizeof (*data), ovstats);
+ total += malloced_storage_size (data, sizeof (*data), ovstats);
inst = inst->next;
}
Index: src/scrollbar-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/scrollbar-x.c,v
retrieving revision 1.30
diff -u -p -r1.30 scrollbar-x.c
--- src/scrollbar-x.c 2005/10/24 10:07:40 1.30
+++ src/scrollbar-x.c 2005/10/25 07:31:51
@@ -703,8 +703,8 @@ x_compute_scrollbar_instance_usage (stru
struct x_scrollbar_data *data =
(struct x_scrollbar_data *) inst->scrollbar_data;
- total += MALLOCED_STORAGE_SIZE (data, sizeof (*data), ovstats);
- total += MALLOCED_STORAGE_SIZE (data->name, 1 + strlen (data->name),
+ total += malloced_storage_size (data, sizeof (*data), ovstats);
+ total += malloced_storage_size (data->name, 1 + strlen (data->name),
ovstats);
inst = inst->next;
}
Index: src/scrollbar.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/scrollbar.c,v
retrieving revision 1.35
diff -u -p -r1.35 scrollbar.c
--- src/scrollbar.c 2005/10/24 10:07:40 1.35
+++ src/scrollbar.c 2005/10/25 07:31:51
@@ -272,7 +272,7 @@ compute_scrollbar_instance_usage (struct
while (inst)
{
- total += MALLOCED_STORAGE_SIZE (inst, sizeof (*inst), ovstats);
+ total += LISPOBJ_STORAGE_SIZE (inst, sizeof (*inst), ovstats);
inst = inst->next;
}
Index: src/symbols.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/symbols.c,v
retrieving revision 1.53
diff -u -p -r1.53 symbols.c
--- src/symbols.c 2005/10/24 10:07:41 1.53
+++ src/symbols.c 2005/10/25 07:31:52
@@ -3256,7 +3256,7 @@ Lisp_Object Qnull_pointer;
/* 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 */
- { /* struct lcrecord_header */
+ { /* struct old_lcrecord_header */
{ /* struct lrecord_header */
lrecord_type_symbol_value_forward, /* lrecord_type_index */
1, /* mark bit */
Index: src/symeval.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/symeval.h,v
retrieving revision 1.15
diff -u -p -r1.15 symeval.h
--- src/symeval.h 2005/10/24 10:07:41 1.15
+++ src/symeval.h 2005/10/25 07:31:52
@@ -420,7 +420,7 @@ do \
static const struct symbol_value_forward I_hate_C = \
{ /* struct symbol_value_forward */ \
{ /* struct symbol_value_magic */ \
- { /* struct lcrecord_header */ \
+ { /* struct old_lcrecord_header */ \
{ /* struct lrecord_header */ \
lrecord_type_symbol_value_forward, /* lrecord_type_index */ \
1, /* mark bit */ \
Index: src/unicode.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/unicode.c,v
retrieving revision 1.29
diff -u -p -r1.29 unicode.c
--- src/unicode.c 2005/10/24 10:07:42 1.29
+++ src/unicode.c 2005/10/25 07:31:53
@@ -548,7 +548,7 @@ compute_from_unicode_table_size_1 (void
}
}
- size += MALLOCED_STORAGE_SIZE (table,
+ size += malloced_storage_size (table,
256 * (level == 1 ? sizeof (short) :
sizeof (void *)),
stats);
@@ -573,7 +573,7 @@ compute_to_unicode_table_size_1 (void *t
}
}
- size += MALLOCED_STORAGE_SIZE (table,
+ size += malloced_storage_size (table,
96 * (level == 1 ? sizeof (int) :
sizeof (void *)),
stats);
Index: src/window.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/window.c,v
retrieving revision 1.86
diff -u -p -r1.86 window.c
--- src/window.c 2005/10/24 10:07:42 1.86
+++ src/window.c 2005/10/25 07:31:54
@@ -5096,8 +5096,7 @@ compute_window_mirror_usage (struct wind
{
if (!mir)
return;
- stats->other += MALLOCED_STORAGE_SIZE (mir, sizeof (struct window_mirror),
- ovstats);
+ stats->other += LISPOBJ_STORAGE_SIZE (mir, sizeof (*mir), ovstats);
#ifdef HAVE_SCROLLBARS
{
struct device *d = XDEVICE (FRAME_DEVICE (mir->frame));
@@ -5121,7 +5120,7 @@ compute_window_usage (struct window *w,
struct overhead_stats *ovstats)
{
xzero (*stats);
- stats->other += MALLOCED_STORAGE_SIZE (w, sizeof (struct window), ovstats);
+ stats->other += LISPOBJ_STORAGE_SIZE (w, sizeof (*w), ovstats);
stats->face += compute_face_cachel_usage (w->face_cachels, ovstats);
stats->glyph += compute_glyph_cachel_usage (w->glyph_cachels, ovstats);
stats->line_start +=
Index: src/xemacs.def.in.in
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/xemacs.def.in.in,v
retrieving revision 1.9
diff -u -p -r1.9 xemacs.def.in.in
--- src/xemacs.def.in.in 2005/05/15 16:38:14 1.9
+++ src/xemacs.def.in.in 2005/10/25 07:31:55
@@ -18,7 +18,7 @@ mcpro_1 /* mcpro */
#endif
mc_alloc /* DEFSUBR */
#else /* not MC_ALLOC */
-alloc_automanaged_lcrecord /* alloc_lcrecord_type */
+alloc_automanaged_lcrecord /* old_alloc_lcrecord_type */
#endif /* not MC_ALLOC */
apply1
#ifdef USE_ASSERTIONS
cvs server: Diffing src/m
cvs server: Diffing src/s
cvs server: Diffing tests
cvs server: Diffing tests/DLL
cvs server: Diffing tests/Dnd
cvs server: Diffing tests/autoconf
cvs server: Diffing tests/automated
cvs server: Diffing tests/gtk
cvs server: Diffing tests/mule
cvs server: Diffing tests/tooltalk