diff options
| author | Dmitry Antipov | 2012-07-09 07:15:10 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-07-09 07:15:10 +0400 |
| commit | f1f924b61976585c693f1f18445889ae891e2211 (patch) | |
| tree | 98d0cc09ad8c7cd18b54a0e4abbcf2e67b0116c8 /src | |
| parent | b50e51120687a7c82046e9b24b28f9576f8c273b (diff) | |
| download | emacs-f1f924b61976585c693f1f18445889ae891e2211.tar.gz emacs-f1f924b61976585c693f1f18445889ae891e2211.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/marker.c | 52 |
2 files changed, 37 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 95c8ce2cb51..1375bbe78d9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2012-07-09 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Move marker debugging code under MARKER_DEBUG. | ||
| 4 | * marker.c (MARKER_DEBUG): Move marker debugging code under | ||
| 5 | #ifdef MARKER_DEBUG because byte_char_debug_check is too slow | ||
| 6 | for bootstrap with --enable-checking (~3x slowdown reported | ||
| 7 | by Juanma Barranquero <lekktu@gmail.com>). | ||
| 8 | (verify_bytepos): Move under #ifdef MARKER_DEBUG. | ||
| 9 | |||
| 1 | 2012-07-08 Paul Eggert <eggert@cs.ucla.edu> | 10 | 2012-07-08 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 11 | ||
| 3 | * systime.h (EMACS_SUB_TIME): Clarify behavior with unsigned time_t. | 12 | * systime.h (EMACS_SUB_TIME): Clarify behavior with unsigned time_t. |
diff --git a/src/marker.c b/src/marker.c index ba98a78f0e4..72f48a2d7b9 100644 --- a/src/marker.c +++ b/src/marker.c | |||
| @@ -31,9 +31,14 @@ static ptrdiff_t cached_bytepos; | |||
| 31 | static struct buffer *cached_buffer; | 31 | static struct buffer *cached_buffer; |
| 32 | static int cached_modiff; | 32 | static int cached_modiff; |
| 33 | 33 | ||
| 34 | #ifdef ENABLE_CHECKING | 34 | /* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased |
| 35 | bootstrap time when byte_char_debug_check is enabled; so this | ||
| 36 | is never turned on by --enable-checking configure option. */ | ||
| 37 | |||
| 38 | #ifdef MARKER_DEBUG | ||
| 35 | 39 | ||
| 36 | extern int count_markers (struct buffer *) EXTERNALLY_VISIBLE; | 40 | extern int count_markers (struct buffer *) EXTERNALLY_VISIBLE; |
| 41 | extern ptrdiff_t verify_bytepos (ptrdiff_t charpos) EXTERNALLY_VISIBLE; | ||
| 37 | 42 | ||
| 38 | static void | 43 | static void |
| 39 | byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) | 44 | 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 | abort (); | 62 | abort (); |
| 58 | } | 63 | } |
| 59 | 64 | ||
| 60 | #else /* not ENABLE_CHECKING */ | 65 | #else /* not MARKER_DEBUG */ |
| 61 | 66 | ||
| 62 | #define byte_char_debug_check(b,charpos,bytepos) do { } while (0) | 67 | #define byte_char_debug_check(b,charpos,bytepos) do { } while (0) |
| 63 | 68 | ||
| 64 | #endif /* ENABLE_CHECKING */ | 69 | #endif /* MARKER_DEBUG */ |
| 65 | 70 | ||
| 66 | void | 71 | void |
| 67 | clear_charpos_cache (struct buffer *b) | 72 | clear_charpos_cache (struct buffer *b) |
| @@ -237,25 +242,6 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos) | |||
| 237 | 242 | ||
| 238 | #undef CONSIDER | 243 | #undef CONSIDER |
| 239 | 244 | ||
| 240 | /* Used for debugging: recompute the bytepos corresponding to CHARPOS | ||
| 241 | in the simplest, most reliable way. */ | ||
| 242 | |||
| 243 | extern ptrdiff_t verify_bytepos (ptrdiff_t charpos) EXTERNALLY_VISIBLE; | ||
| 244 | ptrdiff_t | ||
| 245 | verify_bytepos (ptrdiff_t charpos) | ||
| 246 | { | ||
| 247 | ptrdiff_t below = 1; | ||
| 248 | ptrdiff_t below_byte = 1; | ||
| 249 | |||
| 250 | while (below != charpos) | ||
| 251 | { | ||
| 252 | below++; | ||
| 253 | BUF_INC_POS (current_buffer, below_byte); | ||
| 254 | } | ||
| 255 | |||
| 256 | return below_byte; | ||
| 257 | } | ||
| 258 | |||
| 259 | /* buf_bytepos_to_charpos returns the char position corresponding to | 245 | /* buf_bytepos_to_charpos returns the char position corresponding to |
| 260 | BYTEPOS. */ | 246 | BYTEPOS. */ |
| 261 | 247 | ||
| @@ -781,7 +767,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at, | |||
| 781 | return Qnil; | 767 | return Qnil; |
| 782 | } | 768 | } |
| 783 | 769 | ||
| 784 | #ifdef ENABLE_CHECKING | 770 | #ifdef MARKER_DEBUG |
| 785 | 771 | ||
| 786 | /* For debugging -- count the markers in buffer BUF. */ | 772 | /* For debugging -- count the markers in buffer BUF. */ |
| 787 | 773 | ||
| @@ -797,7 +783,25 @@ count_markers (struct buffer *buf) | |||
| 797 | return total; | 783 | return total; |
| 798 | } | 784 | } |
| 799 | 785 | ||
| 800 | #endif /* ENABLE_CHECKING */ | 786 | /* For debugging -- recompute the bytepos corresponding |
| 787 | to CHARPOS in the simplest, most reliable way. */ | ||
| 788 | |||
| 789 | ptrdiff_t | ||
| 790 | verify_bytepos (ptrdiff_t charpos) | ||
| 791 | { | ||
| 792 | ptrdiff_t below = 1; | ||
| 793 | ptrdiff_t below_byte = 1; | ||
| 794 | |||
| 795 | while (below != charpos) | ||
| 796 | { | ||
| 797 | below++; | ||
| 798 | BUF_INC_POS (current_buffer, below_byte); | ||
| 799 | } | ||
| 800 | |||
| 801 | return below_byte; | ||
| 802 | } | ||
| 803 | |||
| 804 | #endif /* MARKER_DEBUG */ | ||
| 801 | 805 | ||
| 802 | void | 806 | void |
| 803 | syms_of_marker (void) | 807 | syms_of_marker (void) |