aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Spelling fixes.Paul Eggert2012-04-221-1/+1
|
* Fix GC_MALLOC_CHECK debugging output on 64-bit hosts.Paul Eggert2012-04-221-1/+1
| | | | | * alloc.c (emacs_blocked_malloc) [GC_MALLOC_CHECK]: Do not assume ptrdiff_t is the same width as 'int'.
* * alloc.c: Handle unusual debugging option combinations.Paul Eggert2012-04-221-10/+11
| | | | | | | | | | (GC_CHECK_MARKED_OBJECTS): Undef if ! GC_MARK_STACK, since the two debugging options are incompatible. (GC_MALLOC_CHECK): Similarly, undef if GC_CHECK_MARKED_OBJECTS is defined. (mem_init, mem_insert, mem_insert_fixup): Define if GC_MARK_STACK || GC_MALLOC_CHECK. (NEED_MEM_INSERT): Remove; no longer needed.
* * alloc.c: Remove one incorrect comment and fix another.Paul Eggert2012-04-151-4/+1
|
* Fix minor alloc.c problems found by static checking.Paul Eggert2012-04-151-1/+15
| | | | | | | | | | * alloc.c (_malloc_internal, _free_internal) [!DOUG_LEA_MALLOC]: New extern decls, to avoid calling undeclared functions. (dont_register_blocks): Define if ((!SYSTEM_MALLOC && !SYNC_INPUT) && GC_MALLOC_CHECK), not if ((GC_MARK_STACK || defined GC_MALLOC_CHECK) && GC_MALLOC_CHECK), to match when it's used. (NEED_MEM_INSERT): New macro. (mem_insert, mem_insert_fixup) [!NEED_MEM_INSERT]: Remove; unused.
* * alloc.c (which_symbols): Fix alignment issue / type clash.Paul Eggert2012-04-151-2/+3
|
* Simplify enforcement of object address alignmentAndreas Schwab2012-04-151-25/+49
| | | | | | | | | | | | | * lisp.h (struct Lisp_Symbol): Remove explicit padding. (struct Lisp_Misc_Any): Likewise. (struct Lisp_Free): Likewise. * alloc.c (union aligned_Lisp_Symbol): Define. (SYMBOL_BLOCK_SIZE, struct symbol_block): Use union aligned_Lisp_Symbol instead of struct Lisp_Symbol. (union aligned_Lisp_Misc): Define. (MARKER_BLOCK_SIZE, struct marker_block): Use union aligned_Lisp_Misc instead of union Lisp_Misc. (Fmake_symbol, allocate_misc, gc_sweep): Adjust
* * src/alloc.c (lisp_align_malloc): Remove unneeded prototype.Stefan Monnier2012-04-101-7/+7
|
* Remove * characters from the front of variable docstrings.Chong Yidong2012-04-091-2/+2
|
* Avoid unnecessary pointer scanning in garbage collection (Bug#10780).Paul Eggert2012-04-071-25/+28
| | | | | | | | * alloc.c (POINTERS_MIGHT_HIDE_IN_OBJECTS): New macro. (mark_memory): Mark Lisp_Objects only if pointers might hide in objects, as mark_maybe_pointer will catch them otherwise. (GC_LISP_OBJECT_ALIGNMENT): Remove; no longer needed. * s/gnu-linux.h (GC_LISP_OBJECT_ALIGNMENT) [__mc68000__]: Likewise.
* lispref/internals.texi Memory Usage tiny changeGlenn Morris2012-03-021-1/+3
| | | | | | * doc/lispref/internals.texi: (Memory Usage): Copyedit. * src/alloc.c (misc-objects-consed): Doc fix.
* lispref/internals.texi Pure Storage updatesGlenn Morris2012-03-021-4/+6
| | | | | * doc/lispref/internals.texi: (Pure Storage): Small changes. * src/alloc.c (Fgarbage_collect): Doc fix.
* * alloc.c (mark_memory): Conditionalize recent fix on USE_USB_TAG.Paul Eggert2012-02-251-0/+2
|
* Generalize fix for crash due to non-contiguous EMACS_INT (Bug#10780).Paul Eggert2012-02-251-1/+26
| | | | | | | | | | Suggested by Stefan Monnier in <http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00692.html>. * alloc.c (widen_to_Lisp_Object): New static function. (mark_memory): Also mark Lisp_Objects by fetching pointer words and widening them to Lisp_Objects. This would work even if USE_LSB_TAG is defined and wide integers are used, which might happen in a future version of Emacs.
* Add 2012 to FSF copyright years for Emacs filesGlenn Morris2012-01-051-1/+1
|
* Spelling fixes.Paul Eggert2011-12-111-1/+1
|
* Merge from trunk.Paul Eggert2011-11-191-2/+2
|\
| * Fix typos.Juanma Barranquero2011-11-151-1/+1
| |
| * Spelling fixes.Paul Eggert2011-11-141-1/+1
| |
* | Standardize on VIRT_ADDR_VARIES behavior; otherwise, valgrindPaul Eggert2011-11-101-7/+1
|/ | | | | | | | | | | | | | | | | | does not work on some platforms. Problem reported by Andreas Schwab in <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00081.html>. * puresize.h (pure, PURE_P): Always behave as if VIRT_ADDR_VARIES is set, removing the need for VIRT_ADDRESS_VARIES. (PURE_P): Use a more-efficient implementation that needs just one comparison, not two: on x86-64 with GCC 4.6.2, this cut down the number of instructions from 6 (xorl, cmpq, jge, xorl, cmpq, setge) to 4 (xorl, subq, cmpq, setbe). * alloc.c (pure): Always extern now, since that's the VIRT_ADDR_VARIES behavior. (PURE_POINTER_P): Use a single comparison, not two, for consistency with the new puresize.h. * lisp.h (PNTR_COMPARISON_TYPE): Remove; no longer needed. * m/ibms390.h, m/intel386.h, m/template.h, s/cygwin.h, s/hpux10-20.h: Remove VIRT_ADDR_VARIES no longer needed.
* * alloc.c (DEADP): New macro, for porting to GNU/Hurd (Bug#9926).Paul Eggert2011-11-061-1/+6
| | | | | | This is also needed for porting to any host where GC_MARK_STACK is not GC_MAKE_GCPROS_NOOPS. (which_symbols): Use it.
* * alloc.c (which_symbols): Declare EXTERNALLY_VISIBLE,Paul Eggert2011-10-291-1/+2
| | | | | so that this new function doesn't get optimized away by a whole-program optimizer. Make the 2nd arg EMACS_INT, not int.
* Fix the `xbytecode' user-defined command in .gdbinit.Eli Zaretskii2011-10-291-0/+49
| | | | | | | src/.gdbinit (xprintbytestr): New command. (xwhichsymbols): Renamed from `which'; all callers changed. (xbytecode): Print the byte-code string as well. src/alloc.c (which_symbols): New function.
* * alloc.c (Fgc_status): Do not access beyond zombies arrayDmitry Antipov2011-10-111-2/+2
| | | | | boundary if nzombies > MAX_ZOMBIES. * alloc.c (dump_zombies): Add missing format specifier.
* * alloc.c: Add comment.Paul Eggert2011-10-071-0/+5
|
* Fix alignment-related core dump during GC.Paul Eggert2011-10-071-20/+17
| | | | | | | | | | | | | | * configure.in (GC_LISP_OBJECT_ALIGNMENT): Remove. This is now done by src/alloc.c. * src/alloc.c (GC_LISP_OBJECT_ALIGNMENT): Use offsetof, not __alignof__ or sizeof. __alignof__ gives the wrong answer on Fedora x86-64 with GCC 4.6.1 when configured with CC='gcc -m32' --with-wide-int; this makes Emacs dump core during garbage collection on rare occasions. sizeof is obviously inferior to offsetof here, so stick with offsetof. (GC_POINTER_ALIGNMENT): New macro. (mark_memory): Omit 3rd (offset) arg; caller changed. Don't assume EMACS_INT alignment is the same as pointer alignment.
* Remove dependency on glibc malloc internals.Paul Eggert2011-09-301-2/+45
| | | | | | | | | | | | | | | * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): Move back here from lisp.h, but with their new implementations. (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) (XMALLOC_OVERRUN_SIZE_SIZE): Move these new lisp.h macros here. * charset.c (charset_table_init): New static var. (syms_of_charset): Use it instead of xmalloc. This removes a dependency on glibc malloc internals. See Eli Zaretskii's comment in <http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00815.html>. * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): Move back to alloc.c. (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) (XMALLOC_OVERRUN_SIZE_SIZE): Move to alloc.c.
* Port --enable-checking=all to Fedora 14 x86.Paul Eggert2011-09-291-32/+15
| | | | | | | | | | | | | | | | | | | * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): Move to lisp.h. (xmalloc_put_size, xmalloc_get_size, overrun_check_malloc) (overrun_check_realloc, overrun_check_free): Use XMALLOC_OVERRUN_SIZE_SIZE, not sizeof (size_t). That way, xmalloc returns a properly-aligned pointer even if XMALLOC_OVERRUN_CHECK is defined. The old debugging code happened to align OK on typical 64-bit hosts, but not on Fedora 14 x86. * charset.c (syms_of_charset): Take XMALLOC_OVERRUN_CHECK_OVERHEAD into account when calculating the initial malloc maximum. * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): Move here from alloc.c, so that charset.c can use it too. Properly align; the old code wasn't right for common 32-bit hosts when configured with --enable-checking=all. (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) (XMALLOC_OVERRUN_SIZE_SIZE): New macros.
* Whitespace changes.Juanma Barranquero2011-09-091-11/+11
|
* Merge from trunk.Paul Eggert2011-08-041-8/+10
|\
| * Check for pthread and use it if found.Jan Djärv2011-08-041-8/+10
| | | | | | | | | | | | | | | | | | | | | | * configure.in (HAVE_PTHREAD): Add check for -lpthread. (HAVE_GTK_AND_PTHREAD): Remove. * src/Makefile.in (LIB_PTHREAD): New variable. (LIBES): Add LIB_PTHREAD (Bug#9216). * src/alloc.c, src/emacs.c, src/gmalloc.c, src/gtkutil.c, src/keyboard.c, src/syssignal.h: Rename HAVE_GTK_AND_PTHREAD to HAVE_PTHREAD (Bug#9216).
* | Adjust in response to jan.h.d's comments.Paul Eggert2011-08-041-0/+88
|/ | | | See, for example <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#26>.
* * alloc.c (memory_full) [!SYNC_INPUT]: Fix signal-related race.Paul Eggert2011-07-281-1/+5
| | | | | Without this fix, if a signal arrives just after memory fills up, 'malloc' might be invoked reentrantly.
* Merge from trunk.Paul Eggert2011-07-191-5/+5
|\
| * * alloc.c (valid_pointer_p): Use pipe, not open.Paul Eggert2011-07-181-5/+5
| | | | | | | | This fixes some permissions issues when debugging.
* | * alloc.c (__malloc_size_t): Remove.Paul Eggert2011-07-141-9/+4
| | | | | | | | | | All uses replaced by size_t. See Andreas Schwab's note <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9079#8>.
* | Merge from trunk.Paul Eggert2011-07-121-1/+1
|\ \ | |/
| * * alloc.c (gc_sweep): Don't read past end of array.Paul Eggert2011-07-121-1/+1
| | | | | | | | | | In theory, the old code could also have corrupted Emacs internals, though it'd be very unlikely.
* | Merge from trunk.Paul Eggert2011-07-101-1/+1
|\ \ | |/
| * ProtoizeAndreas Schwab2011-07-101-1/+1
| | | | | | | | | | | | * src/alloc.c (reset_malloc_hooks): Protoize. * src/cm.c (losecursor): Likewise. * src/ralloc.c (r_alloc_check): Likewise.
* | * alloc.c: Integer signedness and overflow fixes.Paul Eggert2011-07-071-58/+78
|/ | | | | | | | | | | | | | | | | | | | | | | | | Do not impose an arbitrary 32-bit limit on malloc sizes when debugging. (__malloc_size_t): Default to size_t, not to int. (pure_size, pure_bytes_used_before_overflow, stack_copy_size) (Fgarbage_collect, mark_object_loop_halt, mark_object): Prefer ptrdiff_t to size_t when either would do, as we prefer signed integers. (XMALLOC_OVERRUN_CHECK_OVERHEAD): New macro. (xmalloc_overrun_check_header, xmalloc_overrun_check_trailer): Now const. Initialize with values that are in range even if char is signed. (XMALLOC_PUT_SIZE, XMALLOC_GET_SIZE): Remove, replacing with ... (xmalloc_put_size, xmalloc_get_size): New functions. All uses changed. These functions do the right thing with sizes > 2**32. (check_depth): Now ptrdiff_t, not int. (overrun_check_malloc, overrun_check_realloc, overrun_check_free): Adjust to new way of storing sizes. Check for size overflow bugs in rest of code. (STRING_BYTES_MAX): Adjust to new overheads. The old code was slightly wrong anyway, as it missed one instance of XMALLOC_OVERRUN_CHECK_OVERHEAD. (refill_memory_reserve): Omit needless cast to size_t. (mark_object_loop_halt): Mark as externally visible.
* Remove more assumptions re struct layout (Bug#8884).Paul Eggert2011-07-061-1/+2
|
* Move DEFSYM to lisp.h and use everywhere.Juanma Barranquero2011-06-241-7/+3
|
* * alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.Paul Eggert2011-06-181-5/+7
|
* * alloc.c: Check that resized vectors' lengths fit in fixnums.Paul Eggert2011-06-141-10/+15
| | | | | | | | (header_size, word_size): New constants. (allocate_vectorlike): Don't check size overflow here. (allocate_vector): Check it here instead, since this is the only caller of allocate_vectorlike that could cause overflow. Check that the new vector's length is representable as a fixnum.
* Variadic C functions now count arguments with ptrdiff_t.Paul Eggert2011-06-141-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | This partly undoes my 2011-03-30 change, which replaced int with size_t. Back then I didn't know that the Emacs coding style prefers signed int. Also, in the meantime I found a few more instances where arguments were being counted with int, which may truncate counts on 64-bit machines, or EMACS_INT, which may be unnecessarily wide. * lisp.h (struct Lisp_Subr.function.aMANY) (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): Arg counts are now ptrdiff_t, not size_t. All variadic functions and their callers changed accordingly. (struct gcpro.nvars): Now size_t, not size_t. All uses changed. * bytecode.c (exec_byte_code): Check maxdepth for overflow, to avoid potential buffer overrun. Don't assume arg counts fit in 'int'. * callint.c (Fcall_interactively): Check arg count for overflow, to avoid potential buffer overrun. Use signed char, not 'int', for 'varies' array, so that we needn't bother to check its size calculation for overflow. * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args. * eval.c (apply_lambda): * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length. (struct textprop_rec.argnum): Now ptrdiff_t, not int. All uses changed. (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
* * lisp.h (SAFE_ALLOCA_LISP): Check for integer overflow.Paul Eggert2011-06-081-2/+2
| | | | | | | | | (struct Lisp_Save_Value): Use ptrdiff_t, not int, for 'integer' member. * alloc.c (make_save_value): Integer argument is now of type ptrdiff_t, not int. (mark_object): Use ptrdiff_t, not int. * lisp.h (pD): New macro. * print.c (print_object): Use it.
* * alloc.c (allocate_pseudovector): Don't use EMACS_INT when int would do.Paul Eggert2011-06-081-1/+1
|
* * alloc.c (inhibit_garbage_collection): Set gc_cons_threshold to max value.Paul Eggert2011-06-081-2/+1
| | | | | Previously, this ceilinged at INT_MAX, but that doesn't work on 64-bit machines.
* * alloc.c (nzombies, ngcs, max_live, max_zombies): Now EMACS_INT, not 'int'.Paul Eggert2011-06-081-5/+5
|