|
Karsten Hopp |
e9d0d9 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
e9d0d9 |
Subject: Patch 7.0.084
|
|
Karsten Hopp |
e9d0d9 |
Fcc: outbox
|
|
Karsten Hopp |
e9d0d9 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
e9d0d9 |
Mime-Version: 1.0
|
|
Karsten Hopp |
e9d0d9 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
e9d0d9 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
e9d0d9 |
------------
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
Patch 7.0.084
|
|
Karsten Hopp |
e9d0d9 |
Problem: The garbage collector may do its work while some Lists or
|
|
Karsten Hopp |
e9d0d9 |
Dictionaries are used internally, e.g., by ":echo" that runs into
|
|
Karsten Hopp |
e9d0d9 |
the more-prompt or ":echo [garbagecollect()]".
|
|
Karsten Hopp |
e9d0d9 |
Solution: Only do garbage collection when waiting for a character at the
|
|
Karsten Hopp |
e9d0d9 |
toplevel. Let garbagecollect() set a flag that is handled at the
|
|
Karsten Hopp |
e9d0d9 |
toplevel before waiting for a character.
|
|
Karsten Hopp |
e9d0d9 |
Files: src/eval.c, src/getchar.c, src/globals.h, src/main.c
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
*** ../vim-7.0.083/src/eval.c Sun Sep 3 15:38:02 2006
|
|
Karsten Hopp |
e9d0d9 |
--- src/eval.c Tue Sep 5 11:49:38 2006
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 6074,6079 ****
|
|
Karsten Hopp |
e9d0d9 |
--- 6074,6083 ----
|
|
Karsten Hopp |
e9d0d9 |
tabpage_T *tp;
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
+ /* Only do this once. */
|
|
Karsten Hopp |
e9d0d9 |
+ want_garbage_collect = FALSE;
|
|
Karsten Hopp |
e9d0d9 |
+ may_garbage_collect = FALSE;
|
|
Karsten Hopp |
e9d0d9 |
+
|
|
Karsten Hopp |
e9d0d9 |
/*
|
|
Karsten Hopp |
e9d0d9 |
* 1. Go through all accessible variables and mark all lists and dicts
|
|
Karsten Hopp |
e9d0d9 |
* with copyID.
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 9636,9642 ****
|
|
Karsten Hopp |
e9d0d9 |
typval_T *argvars;
|
|
Karsten Hopp |
e9d0d9 |
typval_T *rettv;
|
|
Karsten Hopp |
e9d0d9 |
{
|
|
Karsten Hopp |
e9d0d9 |
! garbage_collect();
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
/*
|
|
Karsten Hopp |
e9d0d9 |
--- 9640,9648 ----
|
|
Karsten Hopp |
e9d0d9 |
typval_T *argvars;
|
|
Karsten Hopp |
e9d0d9 |
typval_T *rettv;
|
|
Karsten Hopp |
e9d0d9 |
{
|
|
Karsten Hopp |
e9d0d9 |
! /* This is postponed until we are back at the toplevel, because we may be
|
|
Karsten Hopp |
e9d0d9 |
! * using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". */
|
|
Karsten Hopp |
e9d0d9 |
! want_garbage_collect = TRUE;
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
/*
|
|
Karsten Hopp |
e9d0d9 |
*** ../vim-7.0.083/src/getchar.c Wed May 3 23:19:24 2006
|
|
Karsten Hopp |
e9d0d9 |
--- src/getchar.c Tue Sep 5 12:55:54 2006
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 1451,1457 ****
|
|
Karsten Hopp |
e9d0d9 |
{
|
|
Karsten Hopp |
e9d0d9 |
updatescript(0);
|
|
Karsten Hopp |
e9d0d9 |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
e9d0d9 |
! garbage_collect();
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
--- 1451,1458 ----
|
|
Karsten Hopp |
e9d0d9 |
{
|
|
Karsten Hopp |
e9d0d9 |
updatescript(0);
|
|
Karsten Hopp |
e9d0d9 |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
e9d0d9 |
! if (may_garbage_collect)
|
|
Karsten Hopp |
e9d0d9 |
! garbage_collect();
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 1502,1507 ****
|
|
Karsten Hopp |
e9d0d9 |
--- 1503,1515 ----
|
|
Karsten Hopp |
e9d0d9 |
int i;
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
+ #ifdef FEAT_EVAL
|
|
Karsten Hopp |
e9d0d9 |
+ /* Do garbage collection when garbagecollect() was called previously and
|
|
Karsten Hopp |
e9d0d9 |
+ * we are now at the toplevel. */
|
|
Karsten Hopp |
e9d0d9 |
+ if (may_garbage_collect && want_garbage_collect)
|
|
Karsten Hopp |
e9d0d9 |
+ garbage_collect();
|
|
Karsten Hopp |
e9d0d9 |
+ #endif
|
|
Karsten Hopp |
e9d0d9 |
+
|
|
Karsten Hopp |
e9d0d9 |
/*
|
|
Karsten Hopp |
e9d0d9 |
* If a character was put back with vungetc, it was already processed.
|
|
Karsten Hopp |
e9d0d9 |
* Return it directly.
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 1511,1523 ****
|
|
Karsten Hopp |
e9d0d9 |
c = old_char;
|
|
Karsten Hopp |
e9d0d9 |
old_char = -1;
|
|
Karsten Hopp |
e9d0d9 |
mod_mask = old_mod_mask;
|
|
Karsten Hopp |
e9d0d9 |
- return c;
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
!
|
|
Karsten Hopp |
e9d0d9 |
! mod_mask = 0x0;
|
|
Karsten Hopp |
e9d0d9 |
! last_recorded_len = 0;
|
|
Karsten Hopp |
e9d0d9 |
! for (;;) /* this is done twice if there are modifiers */
|
|
Karsten Hopp |
e9d0d9 |
{
|
|
Karsten Hopp |
e9d0d9 |
if (mod_mask) /* no mapping after modifier has been read */
|
|
Karsten Hopp |
e9d0d9 |
{
|
|
Karsten Hopp |
e9d0d9 |
++no_mapping;
|
|
Karsten Hopp |
e9d0d9 |
--- 1519,1531 ----
|
|
Karsten Hopp |
e9d0d9 |
c = old_char;
|
|
Karsten Hopp |
e9d0d9 |
old_char = -1;
|
|
Karsten Hopp |
e9d0d9 |
mod_mask = old_mod_mask;
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
! else
|
|
Karsten Hopp |
e9d0d9 |
{
|
|
Karsten Hopp |
e9d0d9 |
+ mod_mask = 0x0;
|
|
Karsten Hopp |
e9d0d9 |
+ last_recorded_len = 0;
|
|
Karsten Hopp |
e9d0d9 |
+ for (;;) /* this is done twice if there are modifiers */
|
|
Karsten Hopp |
e9d0d9 |
+ {
|
|
Karsten Hopp |
e9d0d9 |
if (mod_mask) /* no mapping after modifier has been read */
|
|
Karsten Hopp |
e9d0d9 |
{
|
|
Karsten Hopp |
e9d0d9 |
++no_mapping;
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 1695,1702 ****
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
! return c;
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
/*
|
|
Karsten Hopp |
e9d0d9 |
--- 1703,1722 ----
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
! break;
|
|
Karsten Hopp |
e9d0d9 |
! }
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
+
|
|
Karsten Hopp |
e9d0d9 |
+ #ifdef FEAT_EVAL
|
|
Karsten Hopp |
e9d0d9 |
+ /*
|
|
Karsten Hopp |
e9d0d9 |
+ * In the main loop "may_garbage_collect" can be set to do garbage
|
|
Karsten Hopp |
e9d0d9 |
+ * collection in the first next vgetc(). It's disabled after that to
|
|
Karsten Hopp |
e9d0d9 |
+ * avoid internally used Lists and Dicts to be freed.
|
|
Karsten Hopp |
e9d0d9 |
+ */
|
|
Karsten Hopp |
e9d0d9 |
+ may_garbage_collect = FALSE;
|
|
Karsten Hopp |
e9d0d9 |
+ #endif
|
|
Karsten Hopp |
e9d0d9 |
+
|
|
Karsten Hopp |
e9d0d9 |
+ return c;
|
|
Karsten Hopp |
e9d0d9 |
}
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
/*
|
|
Karsten Hopp |
e9d0d9 |
*** ../vim-7.0.083/src/globals.h Sat Sep 2 14:52:41 2006
|
|
Karsten Hopp |
e9d0d9 |
--- src/globals.h Tue Sep 5 11:46:10 2006
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 300,308 ****
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
e9d0d9 |
! EXTERN scid_T current_SID INIT(= 0); /* ID of script being sourced or
|
|
Karsten Hopp |
e9d0d9 |
! was sourced to define the
|
|
Karsten Hopp |
e9d0d9 |
! current function. */
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
|
|
Karsten Hopp |
e9d0d9 |
--- 300,315 ----
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
e9d0d9 |
! /* Garbage collection can only take place when we are sure there are no Lists
|
|
Karsten Hopp |
e9d0d9 |
! * or Dictionaries being used internally. This is flagged with
|
|
Karsten Hopp |
e9d0d9 |
! * "may_garbage_collect" when we are at the toplevel.
|
|
Karsten Hopp |
e9d0d9 |
! * "want_garbage_collect" is set by the garbagecollect() function, which means
|
|
Karsten Hopp |
e9d0d9 |
! * we do garbage collection before waiting for a char at the toplevel. */
|
|
Karsten Hopp |
e9d0d9 |
! EXTERN int may_garbage_collect INIT(= FALSE);
|
|
Karsten Hopp |
e9d0d9 |
! EXTERN int want_garbage_collect INIT(= FALSE);
|
|
Karsten Hopp |
e9d0d9 |
!
|
|
Karsten Hopp |
e9d0d9 |
! /* ID of script being sourced or was sourced to define the current function. */
|
|
Karsten Hopp |
e9d0d9 |
! EXTERN scid_T current_SID INIT(= 0);
|
|
Karsten Hopp |
e9d0d9 |
#endif
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
|
|
Karsten Hopp |
e9d0d9 |
*** ../vim-7.0.083/src/main.c Tue Aug 29 17:28:56 2006
|
|
Karsten Hopp |
e9d0d9 |
--- src/main.c Tue Sep 5 12:33:47 2006
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 1130,1135 ****
|
|
Karsten Hopp |
e9d0d9 |
--- 1130,1145 ----
|
|
Karsten Hopp |
e9d0d9 |
*/
|
|
Karsten Hopp |
e9d0d9 |
update_curswant();
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
+ #ifdef FEAT_EVAL
|
|
Karsten Hopp |
e9d0d9 |
+ /*
|
|
Karsten Hopp |
e9d0d9 |
+ * May perform garbage collection when waiting for a character, but
|
|
Karsten Hopp |
e9d0d9 |
+ * only at the very toplevel. Otherwise we may be using a List or
|
|
Karsten Hopp |
e9d0d9 |
+ * Dict internally somewhere.
|
|
Karsten Hopp |
e9d0d9 |
+ * "may_garbage_collect" is reset in vgetc() which is invoked through
|
|
Karsten Hopp |
e9d0d9 |
+ * do_exmode() and normal_cmd().
|
|
Karsten Hopp |
e9d0d9 |
+ */
|
|
Karsten Hopp |
e9d0d9 |
+ may_garbage_collect = (!cmdwin && !noexmode);
|
|
Karsten Hopp |
e9d0d9 |
+ #endif
|
|
Karsten Hopp |
e9d0d9 |
/*
|
|
Karsten Hopp |
e9d0d9 |
* If we're invoked as ex, do a round of ex commands.
|
|
Karsten Hopp |
e9d0d9 |
* Otherwise, get and execute a normal mode command.
|
|
Karsten Hopp |
e9d0d9 |
*** ../vim-7.0.083/src/version.c Sun Sep 3 16:39:51 2006
|
|
Karsten Hopp |
e9d0d9 |
--- src/version.c Tue Sep 5 12:51:28 2006
|
|
Karsten Hopp |
e9d0d9 |
***************
|
|
Karsten Hopp |
e9d0d9 |
*** 668,669 ****
|
|
Karsten Hopp |
e9d0d9 |
--- 668,671 ----
|
|
Karsten Hopp |
e9d0d9 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
e9d0d9 |
+ /**/
|
|
Karsten Hopp |
e9d0d9 |
+ 84,
|
|
Karsten Hopp |
e9d0d9 |
/**/
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
--
|
|
Karsten Hopp |
e9d0d9 |
LAUNCELOT: At last! A call! A cry of distress ...
|
|
Karsten Hopp |
e9d0d9 |
(he draws his sword, and turns to CONCORDE)
|
|
Karsten Hopp |
e9d0d9 |
Concorde! Brave, Concorde ... you shall not have died in vain!
|
|
Karsten Hopp |
e9d0d9 |
CONCORDE: I'm not quite dead, sir ...
|
|
Karsten Hopp |
e9d0d9 |
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
|
|
Karsten Hopp |
e9d0d9 |
|
|
Karsten Hopp |
e9d0d9 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
e9d0d9 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
e9d0d9 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
e9d0d9 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|