FSF: Original version; a long time ago.
Mly: Significantly rewritten to use new 3-bit tags and
- nicely abstracted object definitions, for 19.8.
+ nicely abstracted object definitions, for 19.8.
JWZ: Improved code to keep track of purespace usage and
- issue nice purespace and GC stats.
+ issue nice purespace and GC stats.
Ben Wing: Cleaned up frob-block lrecord code, added error-checking
- and various changes for Mule, for 19.12.
- Added bit vectors for 19.13.
+ and various changes for Mule, for 19.12.
+ Added bit vectors for 19.13.
Added lcrecord lists for 19.14.
slb: Lots of work on the purification and dump time code.
- Synched Doug Lea malloc support from Emacs 20.2.
+ Synched Doug Lea malloc support from Emacs 20.2.
og: Killed the purespace. Portable dumper (moved to dumper.c)
*/
#include "ui/window.h"
#include "ui/console-stream.h"
+#include <ent/ent.h>
+#include <ent/ent-float.h>
+
#ifdef DOUG_LEA_MALLOC
#include <malloc.h>
#endif
#endif /* ERROR_CHECK_MALLOC */
if ( str ) {
int len = strlen(str)+1; /* for stupid terminating 0 */
-
+
void *val = xmalloc(len);
if (val == 0)
return 0;
}
#endif /* !BDWGC */
-#if !defined HAVE_STRDUP
+#if !defined HAVE_STRDUP
/* will be a problem I think */
char *strdup(const char *s)
{
void refill_memory_reserve(void);
void refill_memory_reserve(void)
{
- if (breathing_space == 0)
- breathing_space = (char *)malloc(0xFFFF - MALLOC_OVERHEAD);
+ if (breathing_space == NULL) {
+ breathing_space = malloc(0xFFFF - MALLOC_OVERHEAD);
+ }
}
#endif /* !HAVE_MMAP || DOUG_LEA_MALLOC */
/************************************************************************/
/* Float allocation */
/************************************************************************/
+/* used by many of the allocators below */
+#include "ent/ent.h"
#ifdef HAVE_FPFLOAT
#include <math.h>
return make_indef(POS_INFINITY);
else if (ENT_FLOAT_NINF_P(float_value))
return make_indef(NEG_INFINITY);
- else if (ENT_FLOAT_NAN_P(float_value))
+ else if (ENT_FLOAT_NAN_P(float_value))
return make_indef(NOT_A_NUMBER);
ALLOCATE_FIXED_TYPE(float, Lisp_Float, f);
make_bigz (long bigz_value)
{
Lisp_Bigz *b;
-
+
ALLOCATE_FIXED_TYPE(bigz, Lisp_Bigz, b);
bigz_register_finaliser(b);
/*** Big complex numbers with correct rounding ***/
#if defined HAVE_MPC && defined WITH_MPC || \
defined HAVE_PSEUC && defined WITH_PSEUC
+#include <ent/ent-mpc.h>
DECLARE_FIXED_TYPE_ALLOC(bigc, Lisp_Bigc);
#define MINIMUM_ALLOWED_FIXED_TYPE_CELLS_bigc 250
#ifdef EF_USE_COMPRE
s->compre = Qnil;
#endif
- set_string_data(s, (Bufbyte*)contents);
+ set_string_data(s, contents);
set_string_length(s, length);
XSETSTRING(val, s);
4) Calling free_managed_lcrecord() is just like kissing the
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 allocate_managed_lcrecord()
+ contents of something produced by allocate_managed_lcrecord()
are undefined, just like for alloc_lcrecord().
-- the mark method for the lcrecord's type will *NEVER* be called
- on freed lcrecords.
+ on freed lcrecords.
-- the finalize method for the lcrecord's type will be called
- at the time that free_managed_lcrecord() is called.
+ at the time that free_managed_lcrecord() is called.
lcrecord lists do not work in bdwgc mode. -hrop
\f
/* Free all unmarked records */
#if !defined HAVE_BDWGC || !defined EF_USE_BDWGC
-static void
+static void
sweep_lcrecords_1(struct lcrecord_header *volatile*prev, int *used)
{
int num_used = 0;
{
#define UNMARK_bigq(ptr) UNMARK_RECORD_HEADER(&((ptr)->lheader))
#define ADDITIONAL_FREE_bigq(ptr) bigq_fini(ptr->data)
-
+
SWEEP_FIXED_TYPE_BLOCK(bigq, Lisp_Bigq);
}
#endif /* HAVE_MPQ */
{
#define UNMARK_bigf(ptr) UNMARK_RECORD_HEADER(&((ptr)->lheader))
#define ADDITIONAL_FREE_bigf(ptr) bigf_fini(ptr->data)
-
+
SWEEP_FIXED_TYPE_BLOCK(bigf, Lisp_Bigf);
}
#endif /* HAVE_MPF */
{
#define UNMARK_bigfr(ptr) UNMARK_RECORD_HEADER(&((ptr)->lheader))
#define ADDITIONAL_FREE_bigfr(ptr) bigfr_fini(ptr->data)
-
+
SWEEP_FIXED_TYPE_BLOCK(bigfr, Lisp_Bigfr);
}
#endif /* HAVE_MPFR */
{
#define UNMARK_bigg(ptr) UNMARK_RECORD_HEADER(&((ptr)->lheader))
#define ADDITIONAL_FREE_bigg(ptr) bigg_fini(ptr->data)
-
+
SWEEP_FIXED_TYPE_BLOCK(bigg, Lisp_Bigg);
}
#endif /* HAVE_PSEUG */
{
#define UNMARK_bigc(ptr) UNMARK_RECORD_HEADER(&((ptr)->lheader))
#define ADDITIONAL_FREE_bigc(ptr) bigc_fini(ptr->data)
-
+
SWEEP_FIXED_TYPE_BLOCK(bigc, Lisp_Bigc);
}
#endif /* HAVE_MPC */
{
#define UNMARK_quatern(ptr) UNMARK_RECORD_HEADER(&((ptr)->lheader))
#define ADDITIONAL_FREE_quatern(ptr) quatern_fini(ptr->data)
-
+
SWEEP_FIXED_TYPE_BLOCK(quatern, Lisp_Quatern);
}
#endif /* HAVE_QUATERN */
/* Put all unmarked bignums on free list */
sweep_bigzs();
#endif /* HAVE_MPZ */
-
+
#if defined HAVE_MPQ && defined WITH_GMP
/* Put all unmarked ratios on free list */
sweep_bigqs();
#endif /* HAVE_MPQ */
-
+
#if defined HAVE_MPF && defined WITH_GMP
/* Put all unmarked bigfloats on free list */
sweep_bigfs();
unbind_to(speccount, Qnil);
if (!breathing_space) {
- breathing_space = malloc(4096 - MALLOC_OVERHEAD);
+ breathing_space = malloc(0xFFFF - MALLOC_OVERHEAD);
}
UNGCPRO;
/* Okay, simple pluralization check for
`symbol-value-varalias' */
if (name[len - 1] == 's')
- sz = snprintf(buf, sizeof(buf), "%ses-freed", name);
+ sz = snprintf(buf, sizeof(buf), "%ses-freed", name);
else
sz = snprintf(buf, sizeof(buf), "%ss-freed", name);
assert(sz >=0 && (size_t)sz < sizeof(buf));
2. When using the new allocator (gmalloc.c):
-- blocks are always allocated in chunks of powers of two up
- to 4096 bytes. Larger blocks are allocated in chunks of
+ to 4096 bytes. Larger blocks are allocated in chunks of
an integral multiple of 4096 bytes. The minimum block
- size is 2*sizeof (void *), or 16 bytes if SUNOS_LOCALTIME_BUG
+ size is 2*sizeof (void *), or 16 bytes if SUNOS_LOCALTIME_BUG
is defined. There is no per-block overhead, but there
is an overhead of 3*sizeof (size_t) for each 4096 bytes
allocated.
void reinit_alloc_once_early(void)
{
gc_generation_number[0] = 0;
- breathing_space = 0;
+ breathing_space = NULL;
XSETINT(all_bit_vectors, 0); /* Qzero may not be set yet. */
XSETINT(Vgc_message, 0);
#if !defined HAVE_BDWGC || !defined EF_USE_BDWGC