1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-26 15:21:51 -08:00
Commit graph

355 commits

Author SHA1 Message Date
Jan Djärv
f415cacdbd * alloc.c: Add comment about the reason for (UN)BLOCK_INPUT_ALLOC. 2004-12-07 17:38:30 +00:00
Jan Djärv
aa477689e5 * gtkutil.c: Include signal.h and syssignal.h.
(xg_get_file_name): Block and unblock __SIGRTMIN if defined.

* alloc.c: If HAVE_GTK_AND_PTHREAD, include pthread.h,
new variables main_thread and alloc_mutex,
define (UN)BLOCK_INPUT_ALLOC to use alloc_mutex to protect
emacs_blocked_* calls and only do (UN)BLOCK_INPUT in the main thread.
If not HAVE_GTK_AND_PTHREAD, (UN)BLOCK_INPUT_ALLOC is the same as
(UN)BLOCK_INPUT.
(emacs_blocked_free, emacs_blocked_malloc)
(emacs_blocked_realloc): Use (UN)BLOCK_INPUT_ALLOC.
(uninterrupt_malloc): Initialize main_thread and alloc_mutex.
(reset_malloc_hooks): New function.

* lisp.h: Declare reset_malloc_hooks.

* emacs.c (Fdump_emacs): Call reset_malloc_hooks.

* keyboard.c: Conditionally include pthread.h
(handle_async_inpu, input_available_signalt): If not in the main
thread, block signal, send signal to main thread and return.
2004-12-07 08:25:43 +00:00
Kim F. Storm
bdbed94997 Add commentary for last change.
(XMALLOC_PUT_SIZE, XMALLOC_GET_SIZE): New macros to handle
sizeof(size_t) != 4.
(overrun_check_malloc, overrun_check_realloc, overrun_check_free):
Use them.  Also clear header and trailer of freed memory.
(GC_STRING_OVERRUN_COOKIE_SIZE): Rename from GC_STRING_EXTRA.
(string_overrun_cookie): Rename from string_overrun_pattern.
(GC_STRING_EXTRA): Define from GC_STRING_OVERRUN_COOKIE_SIZE.
2004-12-01 14:10:23 +00:00
Kim F. Storm
212f33f185 Add more checks for buffer overruns.
(XMALLOC_OVERRUN_CHECK_SIZE, xmalloc_overrun_check_header)
xmalloc_overrun_check_trailer, overrun_check_malloc)
overrun_check_realloc, overrun_check_free): Add.
(GC_STRING_EXTRA, string_overrun_pattern): Add.
(check_sblock, allocate_string_data, compact_small_strings):
Set and check string_overrun_pattern if GC_CHECK_STRING_OVERRUN.
(check_cons_list): Condition on GC_CHECK_CONS_LIST.
(check_string_free_list): Add.
(allocate_string, sweep_strings): Call check_string_free_list.
2004-11-30 00:30:56 +00:00
Andreas Schwab
4dec23ff0b (mark_stack): Call GC_MARK_SECONDARY_STACK if defined. 2004-11-27 22:40:50 +00:00
Richard M. Stallman
1b8950e531 Comment change. 2004-09-18 19:18:58 +00:00
Stefan Monnier
126f9c02d4 (Fgarbage_collect): Mark keyboards, gtk data, and specpdl
before doing the mark_stack_check_gcpros since they are not on the stack.
2004-09-13 21:06:31 +00:00
Richard M. Stallman
e3e56238b8 (check_cons_list): New function (contents commented out). 2004-07-25 17:35:04 +00:00
Kim F. Storm
9ea306d178 (mark_object): Only look at Lisp_Misc_Save_Value if GC_MARK_STACK. 2004-07-12 14:35:53 +00:00
Kim F. Storm
7b7990cc67 (allocate_misc): Update total_free_markers.
(free_misc): New function.
(safe_alloca_unwind, free_marker): Use it.
2004-06-24 22:02:23 +00:00
Kim F. Storm
b766f87064 (safe_alloca_unwind): Clear dogc and pointer members.
(make_save_value): Init new dogc member.
(mark_object): Mark Lisp_Save_Value pointer array if dogc is set.
2004-06-22 13:56:34 +00:00
Kim F. Storm
f61bef8be5 (safe_alloca_unwind): New function. 2004-06-21 21:51:50 +00:00
Richard M. Stallman
ae6a9bfec9 (undo_outer_limit): New variable.
(syms_of_alloc): Defvar it.
(Fgarbage_collect): Pass undo_outer_limit to truncate_undo_list.
2004-05-29 16:19:41 +00:00
Richard M. Stallman
ab349c191f (lisp_align_malloc): Check for base == 0 regardless of HAVE_POSIX_MEMALIGN.
Clean up HAVE_POSIX_MEMALIGN handling of `err'.
2004-05-29 16:10:27 +00:00
Stefan Monnier
c37adf23e8 Undo Kim's recent changes and fix the same bug differently.
(marker_blocks_pending_free): Remove.
(Fgarbage_collect): Sweep after cleaning up undo-lists.
Mark the undo lists after claning them up.
Don't free block in marker_blocks_pending_free.
(mark_buffer): Don't mark undo_list.
(gc_sweep): Sweep hash-tables and strings first.
Do free marker blocks that are empty.
2004-05-29 00:00:17 +00:00
Stefan Monnier
b40ea20a66 (struct backtrace): Remove.
(Fgarbage_collect): Use the new mark_backtrace.
2004-05-28 20:59:14 +00:00
Kim F. Storm
6b67a5180d (marker_blocks_pending_free): New var.
(gc_sweep): Store free marker blocks on that list.
(Fgarbage_collect): Free them after undo-list cleanup.
2004-05-25 11:18:07 +00:00
Richard M. Stallman
69623621a4 (Fmake_string): Doc fix. 2004-05-22 22:22:38 +00:00
Kim F. Storm
0dbaecd24a (struct backtrace): Add debug_on_exit member.
(Fgarbage_collect): Clear out buffer undo_list markers after gc_sweep.
Identify those markers as Lisp_Misc_Free objects.  Clear car and cdr of
the removed cons cells.
(mark_object): Undo previous change - disallow Lisp_Misc_Free objects.
(gc_sweep): Clear cons_blocks before sweeping strings, so we don't have
any cons cells pointing to unallocated stings.
Do not lisp_free any marker blocks, as there may still be pointers
to them from buffer undo lists at this stage of GC.
2004-05-21 23:36:10 +00:00
Stefan Monnier
74c35a48a7 (Fgarbage_collect): Do all the marking before flushing
unmarked elements of the undo list.
2004-05-18 16:22:46 +00:00
Kim F. Storm
d080618c7e (mark_object): Mark Lisp_Misc_Free cell. Fix comment. 2004-05-17 15:20:16 +00:00
Kim F. Storm
d2db1c32fa (mark_object): Ignore Lisp_Misc_Free objects.
Such objects may be freed markers which still exist on an undo list.
2004-05-17 12:08:02 +00:00
Andreas Schwab
a097329fe7 (Fmake_bool_vector): Use BOOL_VECTOR_BITS_PER_CHAR instead of
BITS_PER_CHAR for bool vectors.
2004-04-26 21:42:49 +00:00
Andreas Schwab
41b867eace (Fpurecopy): Declare size as EMACS_INT to not lose bits. 2004-01-26 11:54:36 +00:00
Stefan Monnier
831b476c5a (lisp_malloc, lisp_align_malloc) [USE_LSB_TAG]:
Don't check range of malloc address.
(pure_alloc) [USE_LSB_TAG]: Enforce alignment.
2004-01-21 03:34:32 +00:00
Stefan Monnier
d05b383acd (struct interval_block, struct string_block)
(struct symbol_block, struct marker_block, live_string_p)
(live_cons_p, live_symbol_p, live_float_p, live_misc_p):
Better preserve alignment for objects in blocks.
(FLOAT_BLOCK_SIZE): Adjust for possible alignment padding.
2004-01-14 14:35:23 +00:00
Jan Djärv
de7515d6b8 * alloc.c (allocate_vectorlike): Surround calls to mallopt with
BLOCK/UNBLOCK_INPUT.
2004-01-11 21:50:12 +00:00
Stefan Monnier
a06681266b (make_float, Fcons): Clear the markbit at init time.
(make_float, Fcons, Fmake_symbol, allocate_misc): Move the increment
of block_index outside of the macro call.
(Fgarbage_collect): Remove null code.
2003-11-18 00:39:13 +00:00
Richard M. Stallman
4532fdde32 (lisp_align_malloc): If BASE is 0, call memory_full. 2003-10-13 18:45:03 +00:00
Dave Love
ad5f3636c5 (GC_MALLOC_CHECK): Move conditional undef after lisp.h. 2003-09-19 15:50:56 +00:00
Stefan Monnier
1aad248540 (init_marker): Remove debugging code. 2003-09-11 22:41:16 +00:00
Stefan Monnier
0930c1a1c8 (init_intervals, init_symbol, init_marker): Don't preallocate anything.
(Fgarbage_collect, mark_object): Ignore the markbit.
2003-09-11 22:22:11 +00:00
Andreas Schwab
03bb6a06e1 Use long instead of int when casting ABLOCKS_BUSY to
avoid warning.
2003-09-07 19:15:51 +00:00
Miles Bader
ab5796a9f9 Add arch taglines 2003-09-01 15:45:59 +00:00
Dave Love
d748931263 (lisp_align_malloc): Change type of `aligned'. 2003-08-20 16:46:33 +00:00
Gerd Moellmann
f4446bbf6f (lisp_align_malloc): Check for memory full when
allocating ablocks, which also avoids freeing a pointer into an
ablocks structure.
2003-08-19 12:58:35 +00:00
Andreas Schwab
f29181dc5d (mark_object): Handle Lisp_Misc_Save_Value. 2003-08-08 23:14:48 +00:00
Stefan Monnier
7cdee93615 (MARK_STRING, UNMARK_STRING, STRING_MARKED_P)
(GC_STRING_CHARS, string_bytes): Use ARRAY_MARK_FLAG rather than
MARKBIT as the gcmarkbit for strings.
2003-07-21 20:03:35 +00:00
Richard M. Stallman
e74154871e (syms_of_alloc): Doc fixes. 2003-07-21 09:50:53 +00:00
Stefan Monnier
08b7c2cbf3 Use bitmaps for cons cells, as was done for floats.
(init_float, init_cons): Let the normal code allocate the first block.
(CONS_BLOCK_SIZE): Redefine based on BLOCK_BYTES and bitmap size.
(CONS_BLOCK, CONS_INDEX, CONS_MARKED_P, CONS_MARK, CONS_UNMARK): New macros.
(struct cons_block): Move conses to the beginning.  Add gcmarkbits.
(Fcons): Use lisp_align_malloc and CONS_UNMARK.
(live_cons_p): Check the pointer is not past the `conses' array.
(mark_maybe_object, mark_maybe_pointer): Use CONS_MARKED_P.
(mark_object, mark_buffer): Use CONS_MARKED_P and CONS_MARK.
(survives_gc_p): Use CONS_MARKED_P and simplify.
(gc_sweep): Use CONS_MARKED_P, CONS_UNMARK, and lisp_align_free.
2003-07-15 19:19:59 +00:00
Paul Eggert
379b98b161 (pure, staticvec): Initialize these arrays to nonzero, so that they're
not put into BSS by that optimization.
2003-07-14 05:37:52 +00:00
Stefan Monnier
19bcad1f59 (BLOCK_PADDING): Rename from ABLOCKS_PADDING. Update users.
(lisp_align_malloc): Use posix_memalign is available.
(ABLOCKS_BASE): Use HAVE_POSIX_MEMALIGN as an optimization.
(STRING_BLOCK_SIZE): Rename from STRINGS_IN_STRING_BLOCK for consistency.
Update users.
2003-07-14 02:51:08 +00:00
Stefan Monnier
f54253ec86 (mark_object): Mark the new `next' field of overlays.
(mark_buffer): Manually mark the overlays_(after|before) fields.
2003-07-09 14:53:41 +00:00
Richard M. Stallman
e1e375966e (Fgarbage_collect): Doc fix. 2003-07-07 20:39:40 +00:00
Stefan Monnier
bfe1a3f79b (live_float_p): Check that p is not past the `floats' array,
now that `floats' is not the last element of the struct any more.
2003-07-06 23:13:20 +00:00
Stefan Monnier
49723c0471 (mark_object): Change arg to only take Lisp_Object rather than *Lisp_Object.
(last_marked): Change accordingly.
(mark_interval, mark_maybe_object, mark_maybe_pointer)
(Fgarbage_collect, mark_glyph_matrix, mark_face_cache, mark_image)
(mark_buffer): Update calls to mark_object.
2003-07-06 19:35:58 +00:00
Jason Rumney
ebb8d41053 (struct ablock): Only include padding when there is some. 2003-07-06 14:55:00 +00:00
Stefan Monnier
ab6780cd2f (ALIGN): Add casts to simplify usage.
(BLOCK_ALIGN, BLOCK_BYTES, ABLOCKS_PADDING, ABLOCKS_SIZE)
(ABLOCKS_BYTES, ABLOCK_ABASE, ABLOCKS_BUSY, ABLOCKS_BASE): New macros.
(struct ablock, struct ablocks): New types.
(free_ablock): New global var.
(lisp_align_malloc, lisp_align_free): New functions.
(FLOAT_BLOCK_SIZE): Redefine in terms of BLOCK_BYTES.
(struct float_block): Reorder and add gcmarkbits.
(GETMARKBIT, SETMARKBIT, UNSETMARKBIT, FLOAT_BLOCK, FLOAT_INDEX)
(FLOAT_MARKED_P, FLOAT_MARK, FLOAT_UNMARK): New macros.
(init_float, make_float): Use lisp_align_malloc.
(free_float, live_float_p): Don't use `type' any more.
(make_float): Use FLOAT_UNMARK to access to mark bit.
(mark_maybe_object, mark_maybe_pointer, survives_gc_p):
Use FLOAT_MARKED_P to access the mark bit.
(pure_alloc): Simplify use of ALIGN.
(mark_object): Use FLOAT_MARK to access the mark bit.
(gc_sweep): Use new macros to access the float's mark bit.
(init_alloc_once): Init free_ablock.
2003-07-04 20:19:06 +00:00
Stefan Monnier
349bd9eda2 (mark_buffer): Fix missed buffer->name in last patch. 2003-06-27 22:54:26 +00:00
Stefan Monnier
3ef06d12cd (VECTOR_MARK, VECTOR_UNMARK, VECTOR_MARKED_P): New macros.
(GC_STRING_BYTES): Don't mask markbit (it's only used on `size').
(allocate_buffer): Move.
(string_bytes): Don't mask markbit of `size_byte'.
(mark_maybe_object, mark_maybe_pointer, Fgarbage_collect)
(mark_object, mark_buffer, survives_gc_p, gc_sweep):
Use the `size' field of buffers (rather than the `name' field) for
the mark bit, as is done for all other vectorlike objects.
Use the new macros to access the mark bit of vectorlike objects.
2003-06-27 21:54:38 +00:00