summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-01-09 20:11:40 +0000
committerGerd Moellmann <gerd@gnu.org>2001-01-09 20:11:40 +0000
commit35f464a7581f0aaaa2c7c4a7fa4e5a548d0e0ed4 (patch)
treed2c2dc02fcc4b81f44111f98d0b87fb4a24ee822
parent676a72518a2d168ba02311922e6d5cf8f3504f76 (diff)
downloademacs-35f464a7581f0aaaa2c7c4a7fa4e5a548d0e0ed4.tar.gz
(STRING_BYTES) [GC_CHECK_STRING_BYTES]: Call
function string_bytes. (GC_CHECK_STRING_BYTES): Moved here from alloc.c.
-rw-r--r--src/ChangeLog14
-rw-r--r--src/lisp.h17
2 files changed, 31 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7a36b02cd67..0021ec4298b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,19 @@
2001-01-09 Gerd Moellmann <gerd@gnu.org>
+ * lisp.h (STRING_BYTES) [GC_CHECK_STRING_BYTES]: Call
+ function string_bytes.
+ (GC_CHECK_STRING_BYTES): Moved here from alloc.c.
+
+ * alloc.c (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.
+
* alloc.c (Fgarbage_collect): Use a record_unwind_protect to
ensure that pop_message is called.
diff --git a/src/lisp.h b/src/lisp.h
index f2096a5f616..b1951ea4365 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -26,6 +26,12 @@ Boston, MA 02111-1307, USA. */
#define P_(proto) ()
#endif
+/* Define this temporarily to hunt a bug. If defined, the size of
+ strings is redundantly recorded in sdata structures so that it can
+ be compared to the sizes recorded in Lisp strings. */
+
+#define GC_CHECK_STRING_BYTES 1
+
/* These are default choices for the types to use. */
#ifdef _LP64
@@ -620,9 +626,20 @@ struct Lisp_Cons
(XSTRING (STR)->size_byte >= 0)
/* Return the length in bytes of STR. */
+
+#ifdef GC_CHECK_STRING_BYTES
+
+struct Lisp_String;
+extern int string_bytes P_ ((struct Lisp_String *));
+#define STRING_BYTES(S) string_bytes ((S))
+
+#else /* not GC_CHECK_STRING_BYTES */
+
#define STRING_BYTES(STR) \
((STR)->size_byte < 0 ? (STR)->size : (STR)->size_byte)
+#endif /* not GC_CHECK_STRING_BYTES */
+
/* Set the length in bytes of STR. */
#define SET_STRING_BYTES(STR, SIZE) ((STR)->size_byte = (SIZE))