1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-25 23:10:47 -08:00
Commit graph

236 commits

Author SHA1 Message Date
Gerd Moellmann
676a72518a (CHECK_STRING_BYTES) [GC_CHECK_STRING_BYTES]: New macro.
(check_sblock, string_bytes) [GC_CHECK_STRING_BYTES]: New functions.
(check_string_bytes) [GC_CHECK_STRING_BYTES]: Add parameter ALL_P.
(allocate_string) [GC_CHECK_STRING_BYTES]: Always check strings in
the current sblock.
(mark_object) [GC_CHECK_STRING_BYTES]: Use CHECK_STRING_BYTES.
(gc_sweep) [GC_CHECK_STRING_BYTES]: Call check_string_bytes
after sweeping strings, and at the end.
(GC_CHECK_STRING_BYTES): Moved to lisp.h.
2001-01-09 20:10:50 +00:00
Gerd Moellmann
98edb5ff5f (Fgarbage_collect): Use a record_unwind_protect to
ensure that pop_message is called.
2001-01-09 13:43:43 +00:00
Stefan Monnier
2003532193 (gc_sweep): Add comment. 2000-12-07 12:00:51 +00:00
Gerd Moellmann
d285b37395 (gc_sweep): Prevent symbols read during loadup
from being freed.
2000-12-06 21:05:09 +00:00
Gerd Moellmann
96117bc7fb (Fgarbage_collect): Dox fix. Return a list as
advertized by the function documentation.
2000-12-06 14:22:15 +00:00
Kenichi Handa
d942b71c34 (Fmake_string): Use MAX_MULTIBYTE_LENGTH, instead of hard coded `4'. 2000-11-23 04:48:08 +00:00
Gerd Moellmann
e2c556b4f7 (mark_object) <frame>: Mark tool bar items differently. 2000-11-22 16:32:36 +00:00
Kenichi Handa
495a6df36d (make_string): Fix previous change. Be sure to make
unibyte string correctly.
2000-11-20 01:06:33 +00:00
Gerd Moellmann
a83fee2c56 (emacs_blocked_free) [GC_MALLOC_CHECK]: Handle freeing
null.
2000-10-23 15:03:55 +00:00
Gerd Moellmann
13c844fb71 (toplevel): Conditionalize compilation of mem_*
functions differently.
2000-10-20 19:14:07 +00:00
Jason Rumney
8b30ba1a4d Move #ifdef GC_MARK_STACK back above mem_init where it used to be. mem_z etc not defined
otherwise.
2000-10-20 18:45:17 +00:00
Gerd Moellmann
877935b1f5 (toplevel) [SYSTEM_MALLOC || DOUG_LEA_MALLOC]: Undef
GC_MALLOC_CHECK.
(toplevel) [GC_MARK_STACK || GC_MALLOC_CHECK]: Move mem_node
structure definition and related variabled to the top of the file.
Include this code when GC_MALLOC_CHECK is defined.
(lisp_malloc, lisp_free) [GC_MALLOC_CHECK]: Don't
register/unregister allocated region.
(emacs_blocked_free) [GC_MALLOC_CHECK]: Check if freeing something
which isn't allocated.
(emacs_blocked_malloc) [GC_MALLOC_CHECK]: Check if returning
something which is already in use.
(emacs_blocked_realloc) [GC_MALLOC_CHECK]: Likewise.
(mem_insert) [GC_MALLOC_CHECK]: Use _malloc_internal.
(mem_delete) [GC_MALLOC_CHECK]: Use _free_internal.
(init_alloc_once) [GC_MALLOC_CHECK]: Call mem_init.
2000-10-20 15:55:14 +00:00
Gerd Moellmann
a42943e93e (allocate_string) [GC_CHECK_STRING_BYTES]: Call
check_string_bytes only if not noninteractive, increase count to 50.
2000-10-18 11:59:20 +00:00
Gerd Moellmann
1f0b3fd207 (pure_bytes_used): Renamed from pureptr.
(ALIGN): New macro.
(pure_alloc): New function.
(make_pure_string, pure_cons, make_pure_float, make_pure_vector):
Use it.
(Fpurecopy): Use PURE_POINTER_P.
2000-10-17 19:39:17 +00:00
Gerd Moellmann
361b097f3a (mark_object) [GC_CHECK_STRING_BYTES]: Check validity of
string's size_byte.
(check_string_bytes) [GC_CHECK_STRING_BYTES]: New function.
(check_string_bytes_count) [GC_CHECK_STRING_BYTES]: New variable.
(allocate_string) [GC_CHECK_STRING_BYTES]: Call it for every 10th
string allocated.
2000-10-17 15:38:30 +00:00
Andreas Schwab
c70bbf0690 (mark_object): Remove all workarounds installed on
1993-08-08.
2000-10-10 11:10:58 +00:00
Eli Zaretskii
1efc2bb9c8 (Fgarbage_collect): Prevent compiler warning for a call
to `mark_object'.
2000-10-03 12:47:31 +00:00
Gerd Moellmann
31d929e56d (GC_CHECK_STRING_BYTES): Temporarily define, for bug
hunting.
(struct sdata) [GC_CHECK_STRING_BYTES]: Always record the string's
size in the sdata structure.
(SDATA_NBYTES, SDATA_DATA): New macros.
(SDATA_OF_STRING, SDATA_SIZE) [GC_CHECK_STRING_BYTES]: Define
differently for the different layout of the sdata structure.
(allocate_string_data) [GC_CHECK_STRING_BYTES]: Record string size
in sdata.
(sweep_strings, compact_small_strings) [GC_CHECK_STRING_BYTES]:
Check that size recorded in the string size and size recorded in
the sdata structure agree.
2000-09-26 11:12:19 +00:00
Dave Love
3e60b029bc (__malloc_size_t) [DOUG_LEA_MALLOC]: Don't redefine it.
(__malloc_size_t) [!DOUG_LEA_MALLOC]: Define unconditionally as
size_t.
(__malloc_extra_blocks): Declare as __malloc_size_t.
2000-09-25 21:09:14 +00:00
Gerd Moellmann
755a2ccd6e (mark_image): Use GC_NILP instead of NILP. 2000-09-25 18:38:44 +00:00
Gerd Moellmann
6bbd7a2959 Avoid some more compiler warnings. 2000-09-21 20:54:57 +00:00
Gerd Moellmann
f860896845 Add some comments about DOUG_LEA_MALLOC's use of mmap
and allocation of Lisp data.
2000-09-13 09:19:05 +00:00
Andrew Innes
2538fae4f8 Include keyboard.h before frame.h. 2000-08-22 22:41:00 +00:00
Dave Love
b3303f7468 (lisp_malloc): Declare with POINTER_TYPE.
[SYSTEM_MALLOC]: Make decls in malloc.h conditional on
DOUG_LEA_MALLOC.
2000-08-17 14:01:09 +00:00
Gerd Moellmann
a2407477ea (compact_small_strings): Use safe_bcopy, add an
assertion.
2000-08-15 19:24:42 +00:00
Dave Love
bf952fb644 [HAVE_UNISTD_H]: Include unistd.h; don't declare sbrk.
[!HAVE_UNISTD_H]: Use POINTER_TYPE to declare sbrk.
(lisp_free): Declare and make static.
2000-08-14 14:15:44 +00:00
Gerd Moellmann
675d513090 (lisp_malloc, lisp_free): Use size_t and POINTER_TYPE.
(xrealloc, xmalloc): Use size_t.
2000-08-02 20:15:51 +00:00
Gerd Moellmann
00c9c33c29 (allocate_string_data): Don't copy old string contents. 2000-07-19 11:05:32 +00:00
Gerd Moellmann
5c5fecb38d (allocate_string_data): If string had already data
assigned, copy old contents to new string data.
2000-07-18 14:38:20 +00:00
Dave Love
c971ff9a0b (xmalloc, xrealloc, xfree): Define using POINTER_TYPE. 2000-06-20 13:15:58 +00:00
Gerd Moellmann
4f5c137609 (mark_object) [GC_CHECK_MARKED_OBJECTS]: Check that no
bogus objects are marked.  This slows down GC by ~80 percent, but
it might be worth trying when debugging GC-related problems.
This feature requires conservative stack marking to be enabled.
2000-06-19 15:58:43 +00:00
Kenichi Handa
9eac9d597c (Fmake_byte_code): If BYTECODE-STRING is multibyte,
convert it to unibyte.
(make_string): Use parse_str_as_multibyte, not chars_in_text.
2000-05-19 23:49:35 +00:00
Ken Raeburn
cc2d8c6b3d * alloc.c (MARK_STRING, UNMARK_STRING, STRING_MARKED_P): Expand non-union-type
versions of XMARK and friends here, because XMARK and friends won't work on an
integer field if NO_UNION_TYPE is not defined.
(make_number): Define as a function if it's not defined as a macro.
2000-04-02 01:52:58 +00:00
Gerd Moellmann
dca7c6a8d2 (xstrdup): Moved here from xfaces.c.
(allocating_for_lisp): Variable removed.
(lisp_malloc): Block input around the calls to malloc and
mem_insert.
2000-03-30 09:29:22 +00:00
Ken Raeburn
e0b8c689e2 Stop assuming interval pointers and lisp objects can be distinguished by
inspection.  Beginnings of support for expensive internal consistency checks.

* config.in (ENABLE_CHECKING): Undef.

* lisp.h (struct interval): Replace "parent" field with a union of interval
pointer and Lisp_Object; add new bitfield to use as discriminant.  Change other
flag fields to bitfields.
(CHECK): New macro for consistency checking.  If ENABLE_CHECKING is defined and
the supplied test fails, print a message and abort.
(eassert): New macro.  Use CHECK to provide an assert-like facility.

* intervals.h (NULL_INTERVAL_P): Now applies only to real interval pointers;
abort if the value looks like a lisp object.
(NULL_INTERVAL_P, NULL_PARENT, HAS_PARENT, HAS_OBJECT, SET_PARENT, SET_OBJECT,
INTERVAL_PARENT, GET_INTERVAL_OBJECT, COPY_PARENT): Modify for new interval
parent definition.

* alloc.c (mark_interval_tree, MARK_INTERVAL_TREE, UNMARK_BALANCE_INTERVALS):
Update references that need an addressable lisp object in the interval
structure.
(die): New function.
(suppress_checking): New variable.

* intervals.c (interval_start_pos): Just return 0 if there's no parent object.
2000-03-29 22:14:34 +00:00
Dave Love
e9b309ac91 Include stdio.h. Test STDC_HEADERS, not __STDC__. 2000-03-28 11:10:55 +00:00
Gerd Moellmann
182ff24225 (mark_maybe_object): New function.
(mark_memory): Use it.
(SETJMP_WILL_LIKELY_WORK, SETJMP_WILL_NOT_WORK): New macros.
(setjmp_tested_p, longjmp_done): New variables.
(test_setjmp): New function.
(mark_stack) [!GC_SETJMP_WORKS]: Call test_setjmp.
(init_alloc): Initialize setjmp_tested_p and longjmp_done.
2000-03-27 19:43:47 +00:00
Ken Raeburn
439d5cb4f7 Changes towards better type safety regarding intervals, primarily
regarding the "parent" handle.  These just separate out the different
usages based on the type of parent (interval vs lisp object); later
changes will do type checking and enforcement.

	* intervals.h (NULL_INTERVAL): Cast to INTERVAL type.
	(INT_LISPLIKE): New macro.
	(NULL_INTERVAL_P): Use it.
	(INTERVAL_HAS_PARENT, INTERVAL_HAS_OBJECT, SET_INTERVAL_PARENT,
	SET_INTERVAL_OBJECT, INTERVAL_PARENT, COPY_INTERVAL_PARENT,
	GET_INTERVAL_OBJECT, INTERVAL_PARENT_OR_NULL): New macros.

	* alloc.c (make_interval, gc_sweep): Use new macros; eliminate all
	explicit references to "parent" field of struct interval and
	associated unclean type conversions.
	* intervals.c (create_root_interval, root_interval, rotate_right,
	rotate_left, balance_possible_root_interval, split_interval_right,
	split_interval_left, interval_start_pos, find_interval,
	next_interval, previous_interval, update_interval,
	adjust_intervals_for_insertion, delete_node, delete_interval,
	adjust_intervals_for_deletion, merge_interval_right,
	merge_interval_left, reproduce_tree, graft_intervals_into_buffer,
	copy_intervals_to_string): Likewise.
	* intervals.h (AM_LEFT_CHILD, AM_RIGHT_CHILD, RESET_INTERVAL):
	Likewise.
	* syntax.c (update_syntax_table): Likewise.

	* intervals.c (reproduce_tree_obj): New function, like
	reproduce_tree but takes a Lisp_Object for the parent.  Declare
	with prototype.
	(graft_intervals_into_buffer): Use it when appropriate.
	(reproduce_tree): Declare with prototype.
	(balance_possible_root_interval): Check that the parent is a lisp
	object before trying to examine its type.
2000-03-22 21:44:05 +00:00
Kenichi Handa
9170cbcc18 (mark_face_cache): Don't mark face->registry. 2000-03-21 00:36:12 +00:00
Gerd Moellmann
0b3789363d (enum mem_type): Compile unconditionally. 2000-02-17 16:15:06 +00:00
Gerd Moellmann
344000084d (mark_object): Don't mark symbol names in pure space.
(gc_sweep): Don't unmark symbol names in pure space.

(toplevel): Include setjmp.h.
(PURE_POINTER_P): New define.
(enum mem_type) [GC_MARK_STACK]: New enumeration.
(Vdead) [GC_MARK_STACK]: New variable.
(lisp_malloc): Add parameter TYPE, call mem_insert if
GC_MARK_STACK is defined.
(allocate_buffer): New function.
(lisp_free) [GC_MARK_STACK]: Call mem_delete.
(free_float) [GC_MARK_STACK]: Set type to Vdead.
(free_cons) [GC_MARK_STACK]: Set car to Vdead.
(stack_base, mem_root, mem_z) [GC_MARK_STACK]: New variables.
(MEM_NIL) [GC_MARK_STACK]: New define.
(struct mem_node) [GC_MARK_STACK]: New structure.
(mem_init, mem_find, mem_insert, mem_delete, mem_insert_fixup)
(mem_delete_fixup, mem_rotate_left, mem_rotate_right)
(live_string_p, live_cons_p, live_symbol_p, live_float_p)
(live_misc_p, live_vector_p, live_buffer_p, mark_memory)
(mark_stack) [GC_MARK_STACK]: New functions.
(Fgarbage_collect) [GC_MARK_STACK]: Call mark_stack.
(clear_marks): Removed.
(gc_sweep): Set free conses' car, free floats' type, free
symbols' function to Vdead.  Use lisp_free to free buffers.
(init_alloc_once): Initialize Vdead.
(survives_gc_p): Return non-zero for pure objects.

Add comments throughout the file.
2000-02-17 15:21:21 +00:00
Gerd Moellmann
cc94f3b24e Remove LISP_FLOAT_TYPE' and standalone'. 2000-02-17 09:45:46 +00:00
Dave Love
d71c066874 (purecopy): Doc fix. 2000-01-17 11:41:01 +00:00
Gerd Moellmann
2e471eb5f3 (Fgarbage_collect): Return number of live and free
strings.

(mark_buffer): Remove code in #if 0.
(gc_sweep): Ditto.
(UNMARK_BALANCE_INTERVALS): Give the macro statement form.
(strings_consed): New variable.
(allocate_string): Set it.
(syms_of_alloc): Add DEFVAR_INT for strings_consed.
(Fmemory_use_counts): Return strings_consed.  Use Flist.

General cleanup in comments etc.  Remove conditional
compilation for `standalone'.

(MARK_STRING, UNMARK_STRING, STRING_MARKED_P):
(GC_STRING_BYTES, GC_STRING_CHARS): New macros.
(DONT_COPY_FLAG): Removed.
(SBLOCK_SIZE, LARGE_STRING_BYTES): New macros.
(struct sdata, struct sblock): New
(struct string_block): Rewritten.
(STRINGS_IN_STRING_BLOCK): New macro.
(oldest_sblock, current_sblock, total_strings, total_free_strings)
(large_sblocks, string_blocks, string_free_list): New variables.
(NEXT_FREE_LISP_STRING, SDATA_OF_STRING, SDATA_SIZE): New macros.
(init_strings): Rewritten.
(allocate_string, allocate_string_data, compact_small_strings)
(free_large_strings, sweep_strings): New functions.
(STRING_BLOCK_SIZE, STRING_BLOCK_OUTSIZE)
(struct string_block_head, current_string_block)
(first_string_block, large_string_blocks, STRING_FULLSIZE)
(STRING_PAD): Removed.
(make_uninit_multibyte_string, make_pure_string): Rewritten.
(Fgarbage_collect): Don't set mark bit in large strings.
(mark_object): Mark strings differently.  Mark symbol names
differently.
(survives_gc_p): Test marked strings differently.
(gc_sweep): Sweep strings differently, unmark strings in
symbol names.
(compact_strings): Removed.
2000-01-04 12:25:51 +00:00
Richard M. Stallman
dbd2182a1c Comment change. 1999-12-28 03:34:56 +00:00
Kenichi Handa
c80329d154 (Fmake_string): Adjusted for the change of CHAR_STRING. 1999-12-15 00:01:44 +00:00
Gerd Moellmann
033a5fa309 (Fgarbage_collect): Call unmark_byte_stack. 1999-11-07 22:45:14 +00:00
Gerd Moellmann
01e9b9dfb9 Remove conditional compilation on USE_TEXT_PROPERTIES. 1999-11-07 15:53:30 +00:00
Gerd Moellmann
630686c871 (Fgarbage_collect): Call mark_byte_stack and
relocate_byte_pcs.
(init_alloc_once, init_alloc): Set byte_stack_list to null.
1999-11-05 21:26:42 +00:00
Ken Raeburn
7539e11fca more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine 1999-10-25 04:58:18 +00:00