Commit f1f924b6 authored by Dmitry Antipov's avatar Dmitry Antipov

Move marker debugging code under MARKER_DEBUG.

* marker.c (MARKER_DEBUG): Move marker debugging code under
#ifdef MARKER_DEBUG because byte_char_debug_check is too slow
for bootstrap with --enable-checking (~3x slowdown reported
by Juanma Barranquero <lekktu@gmail.com>).
(verify_bytepos): Move under #ifdef MARKER_DEBUG.
parent b50e5112
2012-07-09 Dmitry Antipov <dmantipov@yandex.ru>
Move marker debugging code under MARKER_DEBUG.
* marker.c (MARKER_DEBUG): Move marker debugging code under
#ifdef MARKER_DEBUG because byte_char_debug_check is too slow
for bootstrap with --enable-checking (~3x slowdown reported
by Juanma Barranquero <lekktu@gmail.com>).
(verify_bytepos): Move under #ifdef MARKER_DEBUG.
2012-07-08 Paul Eggert <eggert@cs.ucla.edu> 2012-07-08 Paul Eggert <eggert@cs.ucla.edu>
* systime.h (EMACS_SUB_TIME): Clarify behavior with unsigned time_t. * systime.h (EMACS_SUB_TIME): Clarify behavior with unsigned time_t.
......
...@@ -31,9 +31,14 @@ static ptrdiff_t cached_bytepos; ...@@ -31,9 +31,14 @@ static ptrdiff_t cached_bytepos;
static struct buffer *cached_buffer; static struct buffer *cached_buffer;
static int cached_modiff; static int cached_modiff;
#ifdef ENABLE_CHECKING /* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased
bootstrap time when byte_char_debug_check is enabled; so this
is never turned on by --enable-checking configure option. */
#ifdef MARKER_DEBUG
extern int count_markers (struct buffer *) EXTERNALLY_VISIBLE; extern int count_markers (struct buffer *) EXTERNALLY_VISIBLE;
extern ptrdiff_t verify_bytepos (ptrdiff_t charpos) EXTERNALLY_VISIBLE;
static void static void
byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
...@@ -57,11 +62,11 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) ...@@ -57,11 +62,11 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
abort (); abort ();
} }
#else /* not ENABLE_CHECKING */ #else /* not MARKER_DEBUG */
#define byte_char_debug_check(b,charpos,bytepos) do { } while (0) #define byte_char_debug_check(b,charpos,bytepos) do { } while (0)
#endif /* ENABLE_CHECKING */ #endif /* MARKER_DEBUG */
void void
clear_charpos_cache (struct buffer *b) clear_charpos_cache (struct buffer *b)
...@@ -237,25 +242,6 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos) ...@@ -237,25 +242,6 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
#undef CONSIDER #undef CONSIDER
/* Used for debugging: recompute the bytepos corresponding to CHARPOS
in the simplest, most reliable way. */
extern ptrdiff_t verify_bytepos (ptrdiff_t charpos) EXTERNALLY_VISIBLE;
ptrdiff_t
verify_bytepos (ptrdiff_t charpos)
{
ptrdiff_t below = 1;
ptrdiff_t below_byte = 1;
while (below != charpos)
{
below++;
BUF_INC_POS (current_buffer, below_byte);
}
return below_byte;
}
/* buf_bytepos_to_charpos returns the char position corresponding to /* buf_bytepos_to_charpos returns the char position corresponding to
BYTEPOS. */ BYTEPOS. */
...@@ -781,7 +767,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at, ...@@ -781,7 +767,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at,
return Qnil; return Qnil;
} }
#ifdef ENABLE_CHECKING #ifdef MARKER_DEBUG
/* For debugging -- count the markers in buffer BUF. */ /* For debugging -- count the markers in buffer BUF. */
...@@ -797,7 +783,25 @@ count_markers (struct buffer *buf) ...@@ -797,7 +783,25 @@ count_markers (struct buffer *buf)
return total; return total;
} }
#endif /* ENABLE_CHECKING */ /* For debugging -- recompute the bytepos corresponding
to CHARPOS in the simplest, most reliable way. */
ptrdiff_t
verify_bytepos (ptrdiff_t charpos)
{
ptrdiff_t below = 1;
ptrdiff_t below_byte = 1;
while (below != charpos)
{
below++;
BUF_INC_POS (current_buffer, below_byte);
}
return below_byte;
}
#endif /* MARKER_DEBUG */
void void
syms_of_marker (void) syms_of_marker (void)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment