diff options
-rw-r--r-- | runtime/doc/repeat.txt | 7 | ||||
-rw-r--r-- | src/Make_ming.mak | 6 | ||||
-rw-r--r-- | src/ex_cmds2.c | 54 | ||||
-rw-r--r-- | src/feature.h | 6 | ||||
-rw-r--r-- | src/fileio.c | 13 | ||||
-rw-r--r-- | src/globals.h | 6 | ||||
-rw-r--r-- | src/os_unix.c | 1 | ||||
-rw-r--r-- | src/quickfix.c | 5 | ||||
-rw-r--r-- | src/regexp.c | 57 | ||||
-rw-r--r-- | src/version.h | 4 |
10 files changed, 141 insertions, 18 deletions
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index b165bf123..57221023f 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.0aa. Last change: 2005 Feb 26 +*repeat.txt* For Vim version 7.0aa. Last change: 2005 Feb 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -572,7 +572,8 @@ It is only included when Vim was compiled with "huge" features. This only profiles the script itself, not the functions defined in it. When the [!] is added then all functions defined in the script - will also be profiled. + will also be profiled. But only if the script is loaded after + this command. You must always start with a ":profile start fname" command. The resulting @@ -632,5 +633,7 @@ mind there are various things that may clobber the results: : delfunc MyFunc :endif < +- Profiling may give weird results on multi-processor systems, when sleep + mode kicks in or the processor frequency is reduced to save power. vim:tw=78:ts=8:ft=help:norl: diff --git a/src/Make_ming.mak b/src/Make_ming.mak index 47b1910a1..7cbceb859 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -254,14 +254,14 @@ endif CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall ifdef GETTEXT -DEFINES +=-DHAVE_GETTEXT -DHAVE_LOCALE_H +DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H GETTEXTINCLUDE = $(GETTEXT)/include GETTEXTLIB = $(INTLPATH) ifeq (yes, $(GETTEXT)) -DEFINES +=-DDYNAMIC_GETTEXT +DEFINES += -DDYNAMIC_GETTEXT else ifdef DYNAMIC_GETTEXT -DEFINES +=-D$(DYNAMIC_GETTEXT) +DEFINES += -D$(DYNAMIC_GETTEXT) ifdef GETTEXT_DYNAMIC DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\" endif diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index f1b8d2a87..0761a6998 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -26,7 +26,7 @@ static void cmd_source __ARGS((char_u *fname, exarg_T *eap)); #ifdef FEAT_EVAL -/* Growarray to store the names of sourced scripts. +/* Growarray to store info about already sourced scripts. * For Unix also store the dev/ino, so that we don't have to stat() each * script when going through the list. */ typedef struct scriptitem_S @@ -38,7 +38,7 @@ typedef struct scriptitem_S # endif # ifdef FEAT_PROFILE int sn_prof_on; /* TRUE when script is/was profiled */ - int sn_pr_force; /* forceit: profile defined functions */ + int sn_pr_force; /* forceit: profile functions in this script */ proftime_T sn_pr_child; /* time set when going into first child */ int sn_pr_nest; /* nesting for sn_pr_child */ /* profiling the script as a whole */ @@ -802,8 +802,12 @@ static proftime_T prof_wait_time; profile_zero(tm) proftime_T *tm; { +# ifdef WIN3264 + tm->QuadPart = 0; +# else tm->tv_usec = 0; tm->tv_sec = 0; +# endif } /* @@ -813,7 +817,11 @@ profile_zero(tm) profile_start(tm) proftime_T *tm; { +# ifdef WIN3264 + QueryPerformanceCounter(tm); +# else gettimeofday(tm, NULL); +# endif } /* @@ -825,6 +833,10 @@ profile_end(tm) { proftime_T now; +# ifdef WIN3264 + QueryPerformanceCounter(&now); + tm->QuadPart = now.QuadPart - tm->QuadPart; +# else gettimeofday(&now, NULL); tm->tv_usec = now.tv_usec - tm->tv_usec; tm->tv_sec = now.tv_sec - tm->tv_sec; @@ -833,6 +845,7 @@ profile_end(tm) tm->tv_usec += 1000000; --tm->tv_sec; } +# endif } /* @@ -842,6 +855,9 @@ profile_end(tm) profile_sub(tm, tm2) proftime_T *tm, *tm2; { +# ifdef WIN3264 + tm->QuadPart -= tm2->QuadPart; +# else tm->tv_usec -= tm2->tv_usec; tm->tv_sec -= tm2->tv_sec; if (tm->tv_usec < 0) @@ -849,6 +865,7 @@ profile_sub(tm, tm2) tm->tv_usec += 1000000; --tm->tv_sec; } +# endif } /* @@ -858,6 +875,9 @@ profile_sub(tm, tm2) profile_add(tm, tm2) proftime_T *tm, *tm2; { +# ifdef WIN3264 + tm->QuadPart += tm2->QuadPart; +# else tm->tv_usec += tm2->tv_usec; tm->tv_sec += tm2->tv_sec; if (tm->tv_usec >= 1000000) @@ -865,6 +885,7 @@ profile_add(tm, tm2) tm->tv_usec -= 1000000; ++tm->tv_sec; } +# endif } /* @@ -897,7 +918,27 @@ profile_sub_wait(tm, tma) profile_equal(tm1, tm2) proftime_T *tm1, *tm2; { +# ifdef WIN3264 + return (tm1->QuadPart == tm2->QuadPart); +# else return (tm1->tv_usec == tm2->tv_usec && tm1->tv_sec == tm2->tv_sec); +# endif +} + +/* + * Return <0, 0 or >0 if "tm1" < "tm2", "tm1" == "tm2" or "tm1" > "tm2" + */ + int +profile_cmp(tm1, tm2) + proftime_T *tm1, *tm2; +{ +# ifdef WIN3264 + return (int)(tm2->QuadPart - tm1->QuadPart); +# else + if (tm1->tv_sec == tm2->tv_sec) + return tm2->tv_usec - tm1->tv_usec; + return tm2->tv_sec - tm1->tv_sec; +# endif } /* @@ -910,7 +951,14 @@ profile_msg(tm) { static char buf[50]; +# ifdef WIN3264 + LARGE_INTEGER fr; + + QueryPerformanceFrequency(&fr); + sprintf(buf, "%10.6lf", (double)tm->QuadPart / (double)fr.QuadPart); +# else sprintf(buf, "%3ld.%06ld", (long)tm->tv_sec, (long)tm->tv_usec); +#endif return buf; } @@ -962,8 +1010,8 @@ profile_dump() EMSG2(_(e_notopen), profile_fname); else { - func_dump_profile(fd); script_dump_profile(fd); + func_dump_profile(fd); fclose(fd); } } diff --git a/src/feature.h b/src/feature.h index 3173901b2..fa874ed7a 100644 --- a/src/feature.h +++ b/src/feature.h @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=0 sw=8: +/* vi:set ts=8 sts=4 sw=4: * * VIM - Vi IMproved by Bram Moolenaar * @@ -382,7 +382,9 @@ /* * +profile Profiling for functions and scripts. */ -#if defined(FEAT_HUGE) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +#if defined(FEAT_HUGE) \ + && ((defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)) \ + || defined(WIN3264)) # define FEAT_PROFILE #endif diff --git a/src/fileio.c b/src/fileio.c index 328431a07..c3aef90a1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1333,10 +1333,19 @@ retry: * If there is conversion error or not enough room try using * another conversion. */ - if ((iconv(iconv_fd, (void *)&fromp, &from_size, &top, &to_size) + while ((iconv(iconv_fd, (void *)&fromp, &from_size, + &top, &to_size) == (size_t)-1 && ICONV_ERRNO != ICONV_EINVAL) || from_size > CONV_RESTLEN) - goto rewind_retry; + { + if (!keep_dest_enc) + goto rewind_retry; + /* Ignore a byte and try again. */ + ++fromp; + --from_size; + *top++ = '?'; + --to_size; + } if (from_size > 0) { diff --git a/src/globals.h b/src/globals.h index fdfb1f570..445b453fc 100644 --- a/src/globals.h +++ b/src/globals.h @@ -656,10 +656,10 @@ EXTERN JMP_BUF x_jump_env; * Used to protect areas where we could crash. */ EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */ -#ifdef SIGHASARG +# ifdef SIGHASARG EXTERN int lc_signal; /* catched signal number, 0 when no was signal catched; used for mch_libcall() */ -#endif +# endif EXTERN int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */ #endif @@ -1412,7 +1412,7 @@ EXTERN char_u e_nbreadonly[] INIT(=N_("E744: NetBeans does not allow changes in #if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) || defined(PROTO) EXTERN char_u e_intern2[] INIT(=N_("E685: Internal error: %s")); #endif -#if defined(HAVE_SETJMP_H) || defined(HAVE_TRY_EXCEPT) +#if defined(HAVE_SETJMP_H) || defined(HAVE_TRY_EXCEPT) || defined(__MINGW32__) EXTERN char_u e_complex[] INIT(=N_("E361: Crash intercepted; regexp too complex?")); #endif EXTERN char_u e_outofstack[] INIT(=N_("E363: pattern caused out-of-stack error")); diff --git a/src/os_unix.c b/src/os_unix.c index 945092f15..c64a39e02 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3830,6 +3830,7 @@ mch_call_shell(cmd, options) size_t l; /* child */ + close(fromshell_fd); for (;;) { l = STRLEN(p + written); diff --git a/src/quickfix.c b/src/quickfix.c index 38f7d95d0..8d76e2861 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2514,7 +2514,7 @@ jumpend: { /* The buffer is still loaded, the Filetype autocommands * need to be done now, in that buffer. And then the - * modelines (again). */ + * modelines need to be done (again). */ aucmd_prepbuf(&aco, buf); apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, buf->b_fname, TRUE, buf); @@ -2632,6 +2632,9 @@ load_dummy_buffer(fname) if (newbuf == NULL) return NULL; + /* Init the options. */ + buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP); + #ifdef FEAT_AUTOCMD /* set curwin/curbuf to buf and save a few things */ aucmd_prepbuf(&aco, newbuf); diff --git a/src/regexp.c b/src/regexp.c index 6f15824df..bf5f7afd1 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -3182,6 +3182,36 @@ vim_regexec_multi(rmp, win, buf, lnum, col) return r; } +#if 0 /* this does not appear to work... */ +# ifdef __MINGW32__ +# define MINGW_TRY +# endif +#endif + +#ifdef MINGW_TRY +/* + * Special assembly code for MingW to simulate __try / __except. + * Does not work with the optimizer! + */ +# include <excpt.h> + +static void *ESP_save; /* used as _ESP below */ +static void *EBP_save; /* used as _EBP below */ + +__attribute__ ((cdecl)) + EXCEPTION_DISPOSITION + _except_regexec_handler( + struct _EXCEPTION_RECORD *ExceptionRecord, + void *EstablisherFrame, + struct _CONTEXT *ContextRecord, + void *DispatcherContext) +{ + __asm__ __volatile__ ( + "jmp regexec_reentry"); + return 0; /* Function does not return */ +} +#endif + /* * Match a regexp against a string ("line" points to the string) or multiple * lines ("line" is NULL, use reg_getline()). @@ -3301,6 +3331,17 @@ vim_regexec_both(line, col) goto theend; } +#ifdef MINGW_TRY + /* Ugly assembly code that is necessary to simulate "__try". */ + __asm__ __volatile__ ( + "movl %esp, _ESP_save" "\n\t" + "movl %ebp, _EBP_save"); + + __asm__ __volatile__ ( + "pushl $__except_regexec_handler" "\n\t" + "pushl %fs:0" "\n\t" + "mov %esp, %fs:0"); +#endif #ifdef HAVE_TRY_EXCEPT __try { @@ -3426,6 +3467,22 @@ inner_end: retval = 0L; } #endif +#ifdef MINGW_TRY + __asm__ __volatile__ ( + "jmp regexec_pop" "\n" + "regexec_reentry:" "\n\t" + "movl _ESP_save, %esp" "\n\t" + "movl _EBP_save, %ebp"); + + EMSG(_(e_complex)); + retval = 0L; + + __asm__ __volatile__ ( + "regexec_pop:" "\n\t" + "mov (%esp), %eax" "\n\t" + "mov %eax, %fs:0" "\n\t" + "add $8, %esp"); +#endif theend: /* Didn't find a match. */ diff --git a/src/version.h b/src/version.h index febf243a6..9451a0e9f 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 26)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 26, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 28)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 28, compiled " |