aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use a simple struct to implement compile time checks for the Lisp_Object typeAndreas Schwab2012-06-131-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.in: Rename --enable-use-lisp-union-type to --enable-check-lisp-object-type and define CHECK_LISP_OBJECT_TYPE instead of USE_LISP_UNION_TYPE. * admin/make-emacs: Rename --union-type to --check-lisp-type. Define CHECK_LISP_OBJECT_TYPE insted of USE_LISP_UNION_TYPE. * admin/CPP-DEFINES (DEBUG_LISP_OBJECT_TYPE): Renamed from USE_LISP_UNION_TYPE. * src/lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct instead of union. (XLI, XIL): Define. (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG): Use them. * src/emacs.c (gdb_use_struct): Renamed from gdb_use_union. * src/.gdbinit: Check gdb_use_struct instead of gdb_use_union. * src/alloc.c (widen_to_Lisp_Object): Removed. (mark_memory): Use XIL instead of widen_to_Lisp_Object. * src/frame.c (delete_frame): Remove outdated comment. * src/w32fns.c (Fw32_register_hot_key): Use XLI instead of checking USE_LISP_UNION_TYPE. (Fw32_unregister_hot_key): Likewise. (Fw32_toggle_lock_key): Likewise. * src/w32menu.c (add_menu_item): Likewise. (w32_menu_display_help): Use XIL instead of checking USE_LISP_UNION_TYPE. * src/w32heap.c (allocate_heap): Don't check USE_LISP_UNION_TYPE. (init_heap): Likewise. * src/w32term.c (w32_read_socket): Update comment.
* USE_LISP_UNION_TYPE + USE_LSB_TAG cleanup (Bug#11604)Paul Eggert2012-06-121-44/+21
| | | | | | | | | | | | | | | | | | | | | | | * alloc.c (make_number) [!defined make_number]: Remove, as lisp.h always defines this now. (mark_maybe_pointer): Simplify since USE_LSB_TAG is always defined now. (roundup_size): Verify that it is a power of 2. * data.c (Fmake_variable_buffer_local, Fmake_local_variable): * ftfont.c (ftfont_driver): Use LISP_INITIALLY_ZERO. * lisp.h (USE_LSB_TAG): Allow the builder to compile with -DUSE_LSB_TAG=0, to override the automatically-selected default. USE_LSB_TAG now is always defined to be either 0 or 1. All uses changed. (union Lisp_Object): Don't worry about WORDS_BIGENDIAN; the code works fine either way, and efficiency is not a concern here, as the union type is for debugging, not for production. (LISP_MAKE_RVALUE, make_number) [USE_LISP_UNION_TYPE]: Use an inline function on all platforms when using the union type, since this is simpler and 'static inline' can be used portably within Emacs now. (LISP_INITIALLY_ZERO): New macro. (XFASTINT, XSETFASTINT) [USE_LISP_UNION_TYPE]: Remove. (XSET) [USE_LISP_UNION_TYPE]: Don't overparenthesize.
* Don't purify in Fmake_byte_code.Stefan Monnier2012-06-111-19/+25
| | | | | | * src/alloc.c (make_byte_code): New function. (Fmake_byte_code): Use it. Don't purify here. * src/lread.c (read1): Use it as well to avoid extra allocation.
* Fix BLOCK_INPUT/UNBLOCK_INPUT mismatch in ↵Eli Zaretskii2012-06-081-1/+4
| | | | | | 2012-06-08T08:44:30Z!dmantipov@yandex.ru. src/alloc.c (allocate_vectorlike): Fix last change.
* Block-based vector allocation of small vectors.Dmitry Antipov2012-06-081-42/+346
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/lisp.h (struct vectorlike_header): New field `nbytes', adjust comment accordingly. * src/alloc.c (enum mem_type): New type `MEM_TYPE_VECTOR_BLOCK' to denote vector blocks. Adjust users (live_vector_p, mark_maybe_pointer, valid_lisp_object_p) accordingly. (COMMON_MULTIPLE): Move outside #if USE_LSB_TAG. (VECTOR_BLOCK_SIZE, vroundup, VECTOR_BLOCK_BYTES), (VBLOCK_BYTES_MIN, VBLOCK_BYTES_MAX, VECTOR_MAX_FREE_LIST_INDEX), (VECTOR_FREE_LIST_FLAG, ADVANCE, VINDEX, SETUP_ON_FREE_LIST), (VECTOR_SIZE, VECTOR_IN_BLOCK): New macros. (roundup_size): New constant. (struct vector_block): New data type. (vector_blocks, vector_free_lists, zero_vector): New variables. (all_vectors): Renamed to `large_vectors'. (allocate_vector_from_block, init_vectors, allocate_vector_from_block) (sweep_vectors): New functions. (allocate_vectorlike): Return `zero_vector' as the only vector of 0 items. Allocate new vector from block if vector size is less than or equal to VBLOCK_BYTES_MAX. (Fgarbage_collect): Move all vector sweeping code to sweep_vectors. (init_alloc_once): Add call to init_vectors. * doc/lispref/internals.text (Garbage Collection): Document new vector management code and vectorlike_header structure.
* * alloc.c (CONS_BLOCK_SIZE): Account for padding at the end ofAndreas Schwab2012-06-021-2/+4
| | | | cons_block.
* * alloc.c, lisp.h (make_pure_vector): Now static.Paul Eggert2012-05-301-1/+2
|
* Merge from trunk.Paul Eggert2012-05-251-42/+43
|\
| * Remove src/m/*.Paul Eggert2012-05-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.in: Remove all mention of src/m/*. (machine, machfile, M_FILE, config_machfile, and_machfile): Remove. All uses removed. (BITS_PER_CHAR, BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG) (BITS_PER_LONG_LONG): Move to src/lisp.h. * lib/makefile.w32-in: Remove dependencies on $(EMACS_ROOT)/src/m/intel386.h. * make-dist: Don't make links to src/m. * admin/CPP-DEFINES: Do not mention src/m/*.h. (BITS_PER_EMACS_INT, BITS_PER_LONG, BITS_PER_CHAR) (BITS_PER_SHORT, BITS_PER_INT): Remove. * admin/MAINTAINERS: Remove src/m/. * lib-src/makefile.w32-in: Remove dependencies on $(EMACS_ROOT)/src/m/intel386.h. * msdos/mainmake.v2 (TAGS tags): Don't look at $(CURDIR)/src/m/intel386.h. * nt/config.nt: Do not include "m/intel386.h"; file was removed. (BITS_PER_CHAR, BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG): Move to src/lisp.h. (EMACS_INT_MAX): New macro. This directory predates autoconf and is no longer needed nowadays. Move its few remaining bits of functionality to where they're needed. * src/m/README, src/m/alpha.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibmrs6000.h: * src/m/ibms390x.h, src/m/intel386.h, src/m/m68k.h, src/m/macppc.h: * src/m/sparc.h, src/m/template.h: Remove. * src/Makefile.in (M_FILE): Remove. All uses removed. * src/alloc.c (POINTERS_MIGHT_HIDE_IN_OBJECTS): * src/lisp.h (USE_LSB_TAG): * src/mem-limits.h (EXCEEDS_LISP_PTR): Use VAL_MAX, not VALBITS, in #if. * src/lisp.h (EMACS_INT_MAX): New macro, useful in #if. (EMACS_UINT): Define unconditionally now. (BITS_PER_CHAR, BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG) (BITS_PER_EMACS_INT): New constants, replacing what used to be in config.h, but not useful in #if. (GCTYPEBITS, VALBITS): Define unconditionally, since m/* files don't define them any more. (VAL_MAX): New macro. (VALMASK): Use it. * src/puresize.h (PURESIZE_RATIO): Use EMACS_INT_MAX, not BITS_PER_EMACS_INT, in #if. * src/s/aix4-2.h (BROKEN_FIONREAD, BROKEN_SIGAIO, BROKEN_SIGPTY) (BROKEN_SIGPOLL): Move here from m/ibmrs6000.h, which was removed. * src/s/gnu-linux.h (ULIMIT_BREAK_VALUE) [__i386__]: * src/s/ms-w32.h (DATA_START): Move here from removed file m/intel386.h. * src/s/gnu.h (NLIST_STRUCT): Remove undef; 'configure' does this. * src/s/irix6-5.h (_LP64): Remove; lisp.h no longer needs this.
| * Assume C89 or later.Paul Eggert2012-05-211-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.in (AC_C_PROTOTYPES, AC_C_VOLATILE, AC_C_CONST) (POINTER_TYPE, PROTOTYPES): Remove. * admin/CPP-DEFINES: Remove NULL, const. * lib-src/etags.c (static, const): Remove macros. (PTR): Remove; all uses replaced with void *. Omit needless casts. * src/alloc.c, src/buffer.c, lisp.h: Replace POINTER_TYPE with void. * alloc.c (overrun_check_malloc, overrun_check_realloc, xmalloc) (xrealloc): * buffer.c (mmap_free_1, mmap_enlarge): Omit needless casts. * editfns.c, fns.c, gmalloc.c, insdel.c, sysdep.c, termcap.c (NULL): * textprop.c, tparam.c (NULL): Remove. * ralloc.c, vm-limit.c (POINTER): Assume void * works. * regex.c (SIGN_EXTEND_CHAR): Assume signed char works. * regex.h (_RE_ARGS): Remove. All uses rewritten to use prototypes. * unexelf.c (ElfBitsW): Assume c89 preprocessor or better. * xterm.c (input_signal_count): Assume volatile works.
| * 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.
* | Merge from trunk.Paul Eggert2012-04-211-39/+75
|\ \ | |/
| * * 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
| |
* | Merge from trunk.Paul Eggert2012-04-091-32/+39
|\ \ | |/
| * 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.
* | Merge from trunk.Paul Eggert2012-03-011-1/+28
|\ \ | |/
| * * 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.
* | Merge from trunk.Paul Eggert2012-01-091-1/+1
|\ \ | |/
| * Add 2012 to FSF copyright years for Emacs filesGlenn Morris2012-01-051-1/+1
| |
* | Merge from trunk.Paul Eggert2011-12-141-1/+1
|\ \ | |/
| * Spelling fixes.Paul Eggert2011-12-111-1/+1
| |
* | Merge from trunk.Paul Eggert2011-12-101-7/+1
|\ \ | |/
| * Merge from trunk.Paul Eggert2011-11-191-2/+2
| |\
| * | 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.
* | | Merge from trunk.Paul Eggert2011-11-181-3/+8
|\ \ \ | | |/ | |/|
| * | Fix typos.Juanma Barranquero2011-11-151-1/+1
| | |
| * | Spelling fixes.Paul Eggert2011-11-141-1/+1
| |/
| * * 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.
* | Merge from trunk.Paul Eggert2011-10-291-0/+50
|\ \ | |/
| * * 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.
* | Merge from trunk.Paul Eggert2011-10-121-2/+2
|\ \ | |/
| * * 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.
* | Merge from trunk.Paul Eggert2011-10-071-0/+5
|\ \ | |/
| * * 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.
* | * alloc.c (mark_memory): Omit 3rd (offset) arg; caller changed.Paul Eggert2011-10-061-13/+16
| | | | | | | | | | Don't assume EMACS_INT alignment is the same as pointer alignment. (GC_POINTER_ALIGNMENT): New macro.
* | [ChangeLog]Paul Eggert2011-10-061-9/+3
| | | | | | | | | | | | | | | | | | * configure.in (GC_LISP_OBJECT_ALIGNMENT): Remove. This is now done by src/alloc.c. [src/ChangeLog] * alloc.c: (GC_LISP_OBJECT_ARGUMENT): Use offsetof, not __alignof__ or sizeof. __alignof__ gives the wrong answer on the x86 with GCC.
* | Merge from trunk.Paul Eggert2011-09-301-17/+26
|\ \ | |/
| * 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.