aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorJoakim Verona2012-03-06 09:23:09 +0100
committerJoakim Verona2012-03-06 09:23:09 +0100
commit28485daaf752ff5264ed2f6a32ec15588beaa929 (patch)
treea480205aa664c61b1d212833144c0a2d44f7ac01 /src/alloc.c
parente8e42079e76ca6255bbd53312994ba8e1b3b0ee8 (diff)
parent2e86d8576c668e149cc100f3222bcf19b38019dc (diff)
downloademacs-28485daaf752ff5264ed2f6a32ec15588beaa929.tar.gz
emacs-28485daaf752ff5264ed2f6a32ec15588beaa929.zip
upstream
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 044e750413b..f85661415cd 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1,6 +1,7 @@
1/* Storage allocation and gc for GNU Emacs Lisp interpreter. 1/* Storage allocation and gc for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2012 2
3 Free Software Foundation, Inc. 3Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2012
4 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -1582,6 +1583,21 @@ make_number (EMACS_INT n)
1582} 1583}
1583#endif 1584#endif
1584 1585
1586/* Convert the pointer-sized word P to EMACS_INT while preserving its
1587 type and ptr fields. */
1588static Lisp_Object
1589widen_to_Lisp_Object (void *p)
1590{
1591 intptr_t i = (intptr_t) p;
1592#ifdef USE_LISP_UNION_TYPE
1593 Lisp_Object obj;
1594 obj.i = i;
1595 return obj;
1596#else
1597 return i;
1598#endif
1599}
1600
1585/*********************************************************************** 1601/***********************************************************************
1586 String Allocation 1602 String Allocation
1587 ***********************************************************************/ 1603 ***********************************************************************/
@@ -4293,7 +4309,19 @@ mark_memory (void *start, void *end)
4293 4309
4294 for (pp = start; (void *) pp < end; pp++) 4310 for (pp = start; (void *) pp < end; pp++)
4295 for (i = 0; i < sizeof *pp; i += GC_POINTER_ALIGNMENT) 4311 for (i = 0; i < sizeof *pp; i += GC_POINTER_ALIGNMENT)
4296 mark_maybe_pointer (*(void **) ((char *) pp + i)); 4312 {
4313 void *w = *(void **) ((char *) pp + i);
4314 mark_maybe_pointer (w);
4315
4316#ifdef USE_LSB_TAG
4317 /* A host where a Lisp_Object is wider than a pointer might
4318 allocate a Lisp_Object in non-adjacent halves. If
4319 USE_LSB_TAG, the bottom half is not a valid pointer, so
4320 widen it to to a Lisp_Object and check it that way. */
4321 if (sizeof w < sizeof (Lisp_Object))
4322 mark_maybe_object (widen_to_Lisp_Object (w));
4323#endif
4324 }
4297} 4325}
4298 4326
4299/* setjmp will work with GCC unless NON_SAVING_SETJMP is defined in 4327/* setjmp will work with GCC unless NON_SAVING_SETJMP is defined in
@@ -4983,11 +5011,12 @@ Garbage collection happens automatically if you cons more than
4983`gc-cons-threshold' bytes of Lisp data since previous garbage collection. 5011`gc-cons-threshold' bytes of Lisp data since previous garbage collection.
4984`garbage-collect' normally returns a list with info on amount of space in use: 5012`garbage-collect' normally returns a list with info on amount of space in use:
4985 ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS) 5013 ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)
4986 (USED-MARKERS . FREE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS 5014 (USED-MISCS . FREE-MISCS) USED-STRING-CHARS USED-VECTOR-SLOTS
4987 (USED-FLOATS . FREE-FLOATS) (USED-INTERVALS . FREE-INTERVALS) 5015 (USED-FLOATS . FREE-FLOATS) (USED-INTERVALS . FREE-INTERVALS)
4988 (USED-STRINGS . FREE-STRINGS)) 5016 (USED-STRINGS . FREE-STRINGS))
4989However, if there was overflow in pure space, `garbage-collect' 5017However, if there was overflow in pure space, `garbage-collect'
4990returns nil, because real GC can't be done. */) 5018returns nil, because real GC can't be done.
5019See Info node `(elisp)Garbage Collection'. */)
4991 (void) 5020 (void)
4992{ 5021{
4993 register struct specbinding *bind; 5022 register struct specbinding *bind;
@@ -6417,7 +6446,9 @@ If this portion is smaller than `gc-cons-threshold', this is ignored. */);
6417 doc: /* Number of string characters that have been consed so far. */); 6446 doc: /* Number of string characters that have been consed so far. */);
6418 6447
6419 DEFVAR_INT ("misc-objects-consed", misc_objects_consed, 6448 DEFVAR_INT ("misc-objects-consed", misc_objects_consed,
6420 doc: /* Number of miscellaneous objects that have been consed so far. */); 6449 doc: /* Number of miscellaneous objects that have been consed so far.
6450These include markers and overlays, plus certain objects not visible
6451to users. */);
6421 6452
6422 DEFVAR_INT ("intervals-consed", intervals_consed, 6453 DEFVAR_INT ("intervals-consed", intervals_consed,
6423 doc: /* Number of intervals that have been consed so far. */); 6454 doc: /* Number of intervals that have been consed so far. */);