|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.609
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.609
|
|
|
22c937 |
Problem: For complicated list and dict use the garbage collector can run
|
|
|
22c937 |
out of stack space.
|
|
|
22c937 |
Solution: Use a stack of dicts and lists to be marked, thus making it
|
|
|
22c937 |
iterative instead of recursive. (Ben Fritz)
|
|
|
22c937 |
Files: src/eval.c, src/if_lua.c, src/if_py_both.h, src/if_python.c,
|
|
|
22c937 |
src/if_python3.c, src/proto/eval.pro, src/proto/if_lua.pro,
|
|
|
22c937 |
src/proto/if_python.pro, src/proto/if_python3.pro, src/structs.h
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.608/src/eval.c 2015-01-27 15:18:55.152333309 +0100
|
|
|
22c937 |
--- src/eval.c 2015-02-03 12:41:59.468525906 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 93,99 ****
|
|
|
22c937 |
char_u *ll_newkey; /* New key for Dict in alloc. mem or NULL. */
|
|
|
22c937 |
} lval_T;
|
|
|
22c937 |
|
|
|
22c937 |
-
|
|
|
22c937 |
static char *e_letunexp = N_("E18: Unexpected characters in :let");
|
|
|
22c937 |
static char *e_listidx = N_("E684: list index out of range: %ld");
|
|
|
22c937 |
static char *e_undefvar = N_("E121: Undefined variable: %s");
|
|
|
22c937 |
--- 93,98 ----
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 6811,6816 ****
|
|
|
22c937 |
--- 6810,6816 ----
|
|
|
22c937 |
garbage_collect()
|
|
|
22c937 |
{
|
|
|
22c937 |
int copyID;
|
|
|
22c937 |
+ int abort = FALSE;
|
|
|
22c937 |
buf_T *buf;
|
|
|
22c937 |
win_T *wp;
|
|
|
22c937 |
int i;
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 6841,6922 ****
|
|
|
22c937 |
* the item is referenced elsewhere the funccal must not be freed. */
|
|
|
22c937 |
for (fc = previous_funccal; fc != NULL; fc = fc->caller)
|
|
|
22c937 |
{
|
|
|
22c937 |
! set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID + 1);
|
|
|
22c937 |
! set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID + 1);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/* script-local variables */
|
|
|
22c937 |
for (i = 1; i <= ga_scripts.ga_len; ++i)
|
|
|
22c937 |
! set_ref_in_ht(&SCRIPT_VARS(i), copyID);
|
|
|
22c937 |
|
|
|
22c937 |
/* buffer-local variables */
|
|
|
22c937 |
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
|
22c937 |
! set_ref_in_item(&buf->b_bufvar.di_tv, copyID);
|
|
|
22c937 |
|
|
|
22c937 |
/* window-local variables */
|
|
|
22c937 |
FOR_ALL_TAB_WINDOWS(tp, wp)
|
|
|
22c937 |
! set_ref_in_item(&wp->w_winvar.di_tv, copyID);
|
|
|
22c937 |
#ifdef FEAT_AUTOCMD
|
|
|
22c937 |
if (aucmd_win != NULL)
|
|
|
22c937 |
! set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_WINDOWS
|
|
|
22c937 |
/* tabpage-local variables */
|
|
|
22c937 |
for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
|
|
|
22c937 |
! set_ref_in_item(&tp->tp_winvar.di_tv, copyID);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
/* global variables */
|
|
|
22c937 |
! set_ref_in_ht(&globvarht, copyID);
|
|
|
22c937 |
|
|
|
22c937 |
/* function-local variables */
|
|
|
22c937 |
for (fc = current_funccal; fc != NULL; fc = fc->caller)
|
|
|
22c937 |
{
|
|
|
22c937 |
! set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID);
|
|
|
22c937 |
! set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/* v: vars */
|
|
|
22c937 |
! set_ref_in_ht(&vimvarht, copyID);
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_LUA
|
|
|
22c937 |
! set_ref_in_lua(copyID);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_PYTHON
|
|
|
22c937 |
! set_ref_in_python(copyID);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_PYTHON3
|
|
|
22c937 |
! set_ref_in_python3(copyID);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
! /*
|
|
|
22c937 |
! * 2. Free lists and dictionaries that are not referenced.
|
|
|
22c937 |
! */
|
|
|
22c937 |
! did_free = free_unref_items(copyID);
|
|
|
22c937 |
!
|
|
|
22c937 |
! /*
|
|
|
22c937 |
! * 3. Check if any funccal can be freed now.
|
|
|
22c937 |
! */
|
|
|
22c937 |
! for (pfc = &previous_funccal; *pfc != NULL; )
|
|
|
22c937 |
{
|
|
|
22c937 |
! if (can_free_funccal(*pfc, copyID))
|
|
|
22c937 |
{
|
|
|
22c937 |
! fc = *pfc;
|
|
|
22c937 |
! *pfc = fc->caller;
|
|
|
22c937 |
! free_funccal(fc, TRUE);
|
|
|
22c937 |
! did_free = TRUE;
|
|
|
22c937 |
! did_free_funccal = TRUE;
|
|
|
22c937 |
}
|
|
|
22c937 |
! else
|
|
|
22c937 |
! pfc = &(*pfc)->caller;
|
|
|
22c937 |
}
|
|
|
22c937 |
- if (did_free_funccal)
|
|
|
22c937 |
- /* When a funccal was freed some more items might be garbage
|
|
|
22c937 |
- * collected, so run again. */
|
|
|
22c937 |
- (void)garbage_collect();
|
|
|
22c937 |
|
|
|
22c937 |
return did_free;
|
|
|
22c937 |
}
|
|
|
22c937 |
--- 6841,6935 ----
|
|
|
22c937 |
* the item is referenced elsewhere the funccal must not be freed. */
|
|
|
22c937 |
for (fc = previous_funccal; fc != NULL; fc = fc->caller)
|
|
|
22c937 |
{
|
|
|
22c937 |
! abort = abort || set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID + 1,
|
|
|
22c937 |
! NULL);
|
|
|
22c937 |
! abort = abort || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID + 1,
|
|
|
22c937 |
! NULL);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/* script-local variables */
|
|
|
22c937 |
for (i = 1; i <= ga_scripts.ga_len; ++i)
|
|
|
22c937 |
! abort = abort || set_ref_in_ht(&SCRIPT_VARS(i), copyID, NULL);
|
|
|
22c937 |
|
|
|
22c937 |
/* buffer-local variables */
|
|
|
22c937 |
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
|
|
22c937 |
! abort = abort || set_ref_in_item(&buf->b_bufvar.di_tv, copyID,
|
|
|
22c937 |
! NULL, NULL);
|
|
|
22c937 |
|
|
|
22c937 |
/* window-local variables */
|
|
|
22c937 |
FOR_ALL_TAB_WINDOWS(tp, wp)
|
|
|
22c937 |
! abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID,
|
|
|
22c937 |
! NULL, NULL);
|
|
|
22c937 |
#ifdef FEAT_AUTOCMD
|
|
|
22c937 |
if (aucmd_win != NULL)
|
|
|
22c937 |
! abort = abort || set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID,
|
|
|
22c937 |
! NULL, NULL);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_WINDOWS
|
|
|
22c937 |
/* tabpage-local variables */
|
|
|
22c937 |
for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
|
|
|
22c937 |
! abort = abort || set_ref_in_item(&tp->tp_winvar.di_tv, copyID,
|
|
|
22c937 |
! NULL, NULL);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
/* global variables */
|
|
|
22c937 |
! abort = abort || set_ref_in_ht(&globvarht, copyID, NULL);
|
|
|
22c937 |
|
|
|
22c937 |
/* function-local variables */
|
|
|
22c937 |
for (fc = current_funccal; fc != NULL; fc = fc->caller)
|
|
|
22c937 |
{
|
|
|
22c937 |
! abort = abort || set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID, NULL);
|
|
|
22c937 |
! abort = abort || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID, NULL);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/* v: vars */
|
|
|
22c937 |
! abort = abort || set_ref_in_ht(&vimvarht, copyID, NULL);
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_LUA
|
|
|
22c937 |
! abort = abort || set_ref_in_lua(copyID);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_PYTHON
|
|
|
22c937 |
! abort = abort || set_ref_in_python(copyID);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_PYTHON3
|
|
|
22c937 |
! abort = abort || set_ref_in_python3(copyID);
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
! if (!abort)
|
|
|
22c937 |
{
|
|
|
22c937 |
! /*
|
|
|
22c937 |
! * 2. Free lists and dictionaries that are not referenced.
|
|
|
22c937 |
! */
|
|
|
22c937 |
! did_free = free_unref_items(copyID);
|
|
|
22c937 |
!
|
|
|
22c937 |
! /*
|
|
|
22c937 |
! * 3. Check if any funccal can be freed now.
|
|
|
22c937 |
! */
|
|
|
22c937 |
! for (pfc = &previous_funccal; *pfc != NULL; )
|
|
|
22c937 |
{
|
|
|
22c937 |
! if (can_free_funccal(*pfc, copyID))
|
|
|
22c937 |
! {
|
|
|
22c937 |
! fc = *pfc;
|
|
|
22c937 |
! *pfc = fc->caller;
|
|
|
22c937 |
! free_funccal(fc, TRUE);
|
|
|
22c937 |
! did_free = TRUE;
|
|
|
22c937 |
! did_free_funccal = TRUE;
|
|
|
22c937 |
! }
|
|
|
22c937 |
! else
|
|
|
22c937 |
! pfc = &(*pfc)->caller;
|
|
|
22c937 |
}
|
|
|
22c937 |
! if (did_free_funccal)
|
|
|
22c937 |
! /* When a funccal was freed some more items might be garbage
|
|
|
22c937 |
! * collected, so run again. */
|
|
|
22c937 |
! (void)garbage_collect();
|
|
|
22c937 |
! }
|
|
|
22c937 |
! else if (p_verbose > 0)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! verb_msg((char_u *)_("Not enough memory to set references, garbage collection aborted!"));
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
return did_free;
|
|
|
22c937 |
}
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 6976,7023 ****
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Mark all lists and dicts referenced through hashtab "ht" with "copyID".
|
|
|
22c937 |
*/
|
|
|
22c937 |
! void
|
|
|
22c937 |
! set_ref_in_ht(ht, copyID)
|
|
|
22c937 |
! hashtab_T *ht;
|
|
|
22c937 |
! int copyID;
|
|
|
22c937 |
{
|
|
|
22c937 |
int todo;
|
|
|
22c937 |
hashitem_T *hi;
|
|
|
22c937 |
|
|
|
22c937 |
! todo = (int)ht->ht_used;
|
|
|
22c937 |
! for (hi = ht->ht_array; todo > 0; ++hi)
|
|
|
22c937 |
! if (!HASHITEM_EMPTY(hi))
|
|
|
22c937 |
{
|
|
|
22c937 |
! --todo;
|
|
|
22c937 |
! set_ref_in_item(&HI2DI(hi)->di_tv, copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Mark all lists and dicts referenced through list "l" with "copyID".
|
|
|
22c937 |
*/
|
|
|
22c937 |
! void
|
|
|
22c937 |
! set_ref_in_list(l, copyID)
|
|
|
22c937 |
list_T *l;
|
|
|
22c937 |
int copyID;
|
|
|
22c937 |
{
|
|
|
22c937 |
! listitem_T *li;
|
|
|
22c937 |
|
|
|
22c937 |
! for (li = l->lv_first; li != NULL; li = li->li_next)
|
|
|
22c937 |
! set_ref_in_item(&li->li_tv, copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Mark all lists and dicts referenced through typval "tv" with "copyID".
|
|
|
22c937 |
*/
|
|
|
22c937 |
! void
|
|
|
22c937 |
! set_ref_in_item(tv, copyID)
|
|
|
22c937 |
! typval_T *tv;
|
|
|
22c937 |
! int copyID;
|
|
|
22c937 |
{
|
|
|
22c937 |
dict_T *dd;
|
|
|
22c937 |
list_T *ll;
|
|
|
22c937 |
|
|
|
22c937 |
switch (tv->v_type)
|
|
|
22c937 |
{
|
|
|
22c937 |
--- 6989,7100 ----
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Mark all lists and dicts referenced through hashtab "ht" with "copyID".
|
|
|
22c937 |
+ * "list_stack" is used to add lists to be marked. Can be NULL.
|
|
|
22c937 |
+ *
|
|
|
22c937 |
+ * Returns TRUE if setting references failed somehow.
|
|
|
22c937 |
*/
|
|
|
22c937 |
! int
|
|
|
22c937 |
! set_ref_in_ht(ht, copyID, list_stack)
|
|
|
22c937 |
! hashtab_T *ht;
|
|
|
22c937 |
! int copyID;
|
|
|
22c937 |
! list_stack_T **list_stack;
|
|
|
22c937 |
{
|
|
|
22c937 |
int todo;
|
|
|
22c937 |
+ int abort = FALSE;
|
|
|
22c937 |
hashitem_T *hi;
|
|
|
22c937 |
+ hashtab_T *cur_ht;
|
|
|
22c937 |
+ ht_stack_T *ht_stack = NULL;
|
|
|
22c937 |
+ ht_stack_T *tempitem;
|
|
|
22c937 |
|
|
|
22c937 |
! cur_ht = ht;
|
|
|
22c937 |
! for (;;)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! if (!abort)
|
|
|
22c937 |
{
|
|
|
22c937 |
! /* Mark each item in the hashtab. If the item contains a hashtab
|
|
|
22c937 |
! * it is added to ht_stack, if it contains a list it is added to
|
|
|
22c937 |
! * list_stack. */
|
|
|
22c937 |
! todo = (int)cur_ht->ht_used;
|
|
|
22c937 |
! for (hi = cur_ht->ht_array; todo > 0; ++hi)
|
|
|
22c937 |
! if (!HASHITEM_EMPTY(hi))
|
|
|
22c937 |
! {
|
|
|
22c937 |
! --todo;
|
|
|
22c937 |
! abort = abort || set_ref_in_item(&HI2DI(hi)->di_tv, copyID,
|
|
|
22c937 |
! &ht_stack, list_stack);
|
|
|
22c937 |
! }
|
|
|
22c937 |
}
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (ht_stack == NULL)
|
|
|
22c937 |
+ break;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ /* take an item from the stack */
|
|
|
22c937 |
+ cur_ht = ht_stack->ht;
|
|
|
22c937 |
+ tempitem = ht_stack;
|
|
|
22c937 |
+ ht_stack = ht_stack->prev;
|
|
|
22c937 |
+ free(tempitem);
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ return abort;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Mark all lists and dicts referenced through list "l" with "copyID".
|
|
|
22c937 |
+ * "ht_stack" is used to add hashtabs to be marked. Can be NULL.
|
|
|
22c937 |
+ *
|
|
|
22c937 |
+ * Returns TRUE if setting references failed somehow.
|
|
|
22c937 |
*/
|
|
|
22c937 |
! int
|
|
|
22c937 |
! set_ref_in_list(l, copyID, ht_stack)
|
|
|
22c937 |
list_T *l;
|
|
|
22c937 |
int copyID;
|
|
|
22c937 |
+ ht_stack_T **ht_stack;
|
|
|
22c937 |
{
|
|
|
22c937 |
! listitem_T *li;
|
|
|
22c937 |
! int abort = FALSE;
|
|
|
22c937 |
! list_T *cur_l;
|
|
|
22c937 |
! list_stack_T *list_stack = NULL;
|
|
|
22c937 |
! list_stack_T *tempitem;
|
|
|
22c937 |
!
|
|
|
22c937 |
! cur_l = l;
|
|
|
22c937 |
! for (;;)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! if (!abort)
|
|
|
22c937 |
! /* Mark each item in the list. If the item contains a hashtab
|
|
|
22c937 |
! * it is added to ht_stack, if it contains a list it is added to
|
|
|
22c937 |
! * list_stack. */
|
|
|
22c937 |
! for (li = cur_l->lv_first; !abort && li != NULL; li = li->li_next)
|
|
|
22c937 |
! abort = abort || set_ref_in_item(&li->li_tv, copyID,
|
|
|
22c937 |
! ht_stack, &list_stack);
|
|
|
22c937 |
! if (list_stack == NULL)
|
|
|
22c937 |
! break;
|
|
|
22c937 |
!
|
|
|
22c937 |
! /* take an item from the stack */
|
|
|
22c937 |
! cur_l = list_stack->list;
|
|
|
22c937 |
! tempitem = list_stack;
|
|
|
22c937 |
! list_stack = list_stack->prev;
|
|
|
22c937 |
! free(tempitem);
|
|
|
22c937 |
! }
|
|
|
22c937 |
|
|
|
22c937 |
! return abort;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Mark all lists and dicts referenced through typval "tv" with "copyID".
|
|
|
22c937 |
+ * "list_stack" is used to add lists to be marked. Can be NULL.
|
|
|
22c937 |
+ * "ht_stack" is used to add hashtabs to be marked. Can be NULL.
|
|
|
22c937 |
+ *
|
|
|
22c937 |
+ * Returns TRUE if setting references failed somehow.
|
|
|
22c937 |
*/
|
|
|
22c937 |
! int
|
|
|
22c937 |
! set_ref_in_item(tv, copyID, ht_stack, list_stack)
|
|
|
22c937 |
! typval_T *tv;
|
|
|
22c937 |
! int copyID;
|
|
|
22c937 |
! ht_stack_T **ht_stack;
|
|
|
22c937 |
! list_stack_T **list_stack;
|
|
|
22c937 |
{
|
|
|
22c937 |
dict_T *dd;
|
|
|
22c937 |
list_T *ll;
|
|
|
22c937 |
+ int abort = FALSE;
|
|
|
22c937 |
|
|
|
22c937 |
switch (tv->v_type)
|
|
|
22c937 |
{
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 7027,7033 ****
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Didn't see this dict yet. */
|
|
|
22c937 |
dd->dv_copyID = copyID;
|
|
|
22c937 |
! set_ref_in_ht(&dd->dv_hashtab, copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
break;
|
|
|
22c937 |
|
|
|
22c937 |
--- 7104,7126 ----
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Didn't see this dict yet. */
|
|
|
22c937 |
dd->dv_copyID = copyID;
|
|
|
22c937 |
! if (ht_stack == NULL)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! abort = set_ref_in_ht(&dd->dv_hashtab, copyID, list_stack);
|
|
|
22c937 |
! }
|
|
|
22c937 |
! else
|
|
|
22c937 |
! {
|
|
|
22c937 |
! ht_stack_T *newitem = (ht_stack_T*)malloc(
|
|
|
22c937 |
! sizeof(ht_stack_T));
|
|
|
22c937 |
! if (newitem == NULL)
|
|
|
22c937 |
! abort = TRUE;
|
|
|
22c937 |
! else
|
|
|
22c937 |
! {
|
|
|
22c937 |
! newitem->ht = &dd->dv_hashtab;
|
|
|
22c937 |
! newitem->prev = *ht_stack;
|
|
|
22c937 |
! *ht_stack = newitem;
|
|
|
22c937 |
! }
|
|
|
22c937 |
! }
|
|
|
22c937 |
}
|
|
|
22c937 |
break;
|
|
|
22c937 |
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 7037,7047 ****
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Didn't see this list yet. */
|
|
|
22c937 |
ll->lv_copyID = copyID;
|
|
|
22c937 |
! set_ref_in_list(ll, copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
break;
|
|
|
22c937 |
}
|
|
|
22c937 |
! return;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
--- 7130,7156 ----
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Didn't see this list yet. */
|
|
|
22c937 |
ll->lv_copyID = copyID;
|
|
|
22c937 |
! if (list_stack == NULL)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! abort = set_ref_in_list(ll, copyID, ht_stack);
|
|
|
22c937 |
! }
|
|
|
22c937 |
! else
|
|
|
22c937 |
! {
|
|
|
22c937 |
! list_stack_T *newitem = (list_stack_T*)malloc(
|
|
|
22c937 |
! sizeof(list_stack_T));
|
|
|
22c937 |
! if (newitem == NULL)
|
|
|
22c937 |
! abort = TRUE;
|
|
|
22c937 |
! else
|
|
|
22c937 |
! {
|
|
|
22c937 |
! newitem->list = ll;
|
|
|
22c937 |
! newitem->prev = *list_stack;
|
|
|
22c937 |
! *list_stack = newitem;
|
|
|
22c937 |
! }
|
|
|
22c937 |
! }
|
|
|
22c937 |
}
|
|
|
22c937 |
break;
|
|
|
22c937 |
}
|
|
|
22c937 |
! return abort;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
*** ../vim-7.4.608/src/if_lua.c 2014-05-07 17:31:32.473182497 +0200
|
|
|
22c937 |
--- src/if_lua.c 2015-02-03 12:45:41.978204997 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1523,1534 ****
|
|
|
22c937 |
static int
|
|
|
22c937 |
luaV_setref (lua_State *L)
|
|
|
22c937 |
{
|
|
|
22c937 |
! int copyID = lua_tointeger(L, 1);
|
|
|
22c937 |
! typval_T tv;
|
|
|
22c937 |
luaV_getfield(L, LUAVIM_LIST);
|
|
|
22c937 |
luaV_getfield(L, LUAVIM_DICT);
|
|
|
22c937 |
lua_pushnil(L);
|
|
|
22c937 |
! while (lua_next(L, lua_upvalueindex(1)) != 0) /* traverse cache table */
|
|
|
22c937 |
{
|
|
|
22c937 |
lua_getmetatable(L, -1);
|
|
|
22c937 |
if (lua_rawequal(L, -1, 2)) /* list? */
|
|
|
22c937 |
--- 1523,1536 ----
|
|
|
22c937 |
static int
|
|
|
22c937 |
luaV_setref (lua_State *L)
|
|
|
22c937 |
{
|
|
|
22c937 |
! int copyID = lua_tointeger(L, 1);
|
|
|
22c937 |
! int abort = FALSE;
|
|
|
22c937 |
! typval_T tv;
|
|
|
22c937 |
!
|
|
|
22c937 |
luaV_getfield(L, LUAVIM_LIST);
|
|
|
22c937 |
luaV_getfield(L, LUAVIM_DICT);
|
|
|
22c937 |
lua_pushnil(L);
|
|
|
22c937 |
! while (!abort && lua_next(L, lua_upvalueindex(1)) != 0) /* traverse cache table */
|
|
|
22c937 |
{
|
|
|
22c937 |
lua_getmetatable(L, -1);
|
|
|
22c937 |
if (lua_rawequal(L, -1, 2)) /* list? */
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1542,1550 ****
|
|
|
22c937 |
tv.vval.v_dict = (dict_T *) lua_touserdata(L, 4); /* key */
|
|
|
22c937 |
}
|
|
|
22c937 |
lua_pop(L, 2); /* metatable and value */
|
|
|
22c937 |
! set_ref_in_item(&tv, copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
! return 0;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
static int
|
|
|
22c937 |
--- 1544,1552 ----
|
|
|
22c937 |
tv.vval.v_dict = (dict_T *) lua_touserdata(L, 4); /* key */
|
|
|
22c937 |
}
|
|
|
22c937 |
lua_pop(L, 2); /* metatable and value */
|
|
|
22c937 |
! abort = set_ref_in_item(&tv, copyID, NULL, NULL);
|
|
|
22c937 |
}
|
|
|
22c937 |
! lua_pushinteger(L, abort);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
static int
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1770,1782 ****
|
|
|
22c937 |
lua_call(L, 3, 0);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
! void
|
|
|
22c937 |
set_ref_in_lua (int copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
! if (!lua_isopen()) return;
|
|
|
22c937 |
! luaV_getfield(L, LUAVIM_SETREF);
|
|
|
22c937 |
! lua_pushinteger(L, copyID);
|
|
|
22c937 |
! lua_call(L, 1, 0);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
#endif
|
|
|
22c937 |
--- 1772,1794 ----
|
|
|
22c937 |
lua_call(L, 3, 0);
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
! int
|
|
|
22c937 |
set_ref_in_lua (int copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
! int aborted = 0;
|
|
|
22c937 |
!
|
|
|
22c937 |
! if (lua_isopen())
|
|
|
22c937 |
! {
|
|
|
22c937 |
! luaV_getfield(L, LUAVIM_SETREF);
|
|
|
22c937 |
! /* call the function with 1 arg, getting 1 result back */
|
|
|
22c937 |
! lua_pushinteger(L, copyID);
|
|
|
22c937 |
! lua_call(L, 1, 1);
|
|
|
22c937 |
! /* get the result */
|
|
|
22c937 |
! aborted = lua_tointeger(L, -1);
|
|
|
22c937 |
! /* pop result off the stack */
|
|
|
22c937 |
! lua_pop(L, 1);
|
|
|
22c937 |
! }
|
|
|
22c937 |
! return aborted;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
#endif
|
|
|
22c937 |
*** ../vim-7.4.608/src/if_py_both.h 2014-12-17 14:45:56.095854545 +0100
|
|
|
22c937 |
--- src/if_py_both.h 2015-02-03 12:46:46.629530177 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 5502,5535 ****
|
|
|
22c937 |
PyErr_Clear();
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
! static void
|
|
|
22c937 |
set_ref_in_py(const int copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
pylinkedlist_T *cur;
|
|
|
22c937 |
dict_T *dd;
|
|
|
22c937 |
list_T *ll;
|
|
|
22c937 |
|
|
|
22c937 |
if (lastdict != NULL)
|
|
|
22c937 |
! for(cur = lastdict ; cur != NULL ; cur = cur->pll_prev)
|
|
|
22c937 |
{
|
|
|
22c937 |
dd = ((DictionaryObject *) (cur->pll_obj))->dict;
|
|
|
22c937 |
if (dd->dv_copyID != copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
dd->dv_copyID = copyID;
|
|
|
22c937 |
! set_ref_in_ht(&dd->dv_hashtab, copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
if (lastlist != NULL)
|
|
|
22c937 |
! for(cur = lastlist ; cur != NULL ; cur = cur->pll_prev)
|
|
|
22c937 |
{
|
|
|
22c937 |
ll = ((ListObject *) (cur->pll_obj))->list;
|
|
|
22c937 |
if (ll->lv_copyID != copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
ll->lv_copyID = copyID;
|
|
|
22c937 |
! set_ref_in_list(ll, copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
static int
|
|
|
22c937 |
--- 5502,5542 ----
|
|
|
22c937 |
PyErr_Clear();
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
! static int
|
|
|
22c937 |
set_ref_in_py(const int copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
pylinkedlist_T *cur;
|
|
|
22c937 |
dict_T *dd;
|
|
|
22c937 |
list_T *ll;
|
|
|
22c937 |
+ int abort = FALSE;
|
|
|
22c937 |
|
|
|
22c937 |
if (lastdict != NULL)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! for(cur = lastdict ; !abort && cur != NULL ; cur = cur->pll_prev)
|
|
|
22c937 |
{
|
|
|
22c937 |
dd = ((DictionaryObject *) (cur->pll_obj))->dict;
|
|
|
22c937 |
if (dd->dv_copyID != copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
dd->dv_copyID = copyID;
|
|
|
22c937 |
! abort = abort || set_ref_in_ht(&dd->dv_hashtab, copyID, NULL);
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
+ }
|
|
|
22c937 |
|
|
|
22c937 |
if (lastlist != NULL)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! for(cur = lastlist ; !abort && cur != NULL ; cur = cur->pll_prev)
|
|
|
22c937 |
{
|
|
|
22c937 |
ll = ((ListObject *) (cur->pll_obj))->list;
|
|
|
22c937 |
if (ll->lv_copyID != copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
ll->lv_copyID = copyID;
|
|
|
22c937 |
! abort = abort || set_ref_in_list(ll, copyID, NULL);
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ return abort;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
static int
|
|
|
22c937 |
*** ../vim-7.4.608/src/if_python.c 2014-07-23 16:56:56.587876204 +0200
|
|
|
22c937 |
--- src/if_python.c 2015-02-03 12:05:13.471422753 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1567,1574 ****
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif /* Python 1.4 */
|
|
|
22c937 |
|
|
|
22c937 |
! void
|
|
|
22c937 |
set_ref_in_python (int copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
! set_ref_in_py(copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
--- 1567,1574 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif /* Python 1.4 */
|
|
|
22c937 |
|
|
|
22c937 |
! int
|
|
|
22c937 |
set_ref_in_python (int copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
! return set_ref_in_py(copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
*** ../vim-7.4.608/src/if_python3.c 2014-03-30 16:11:37.180530823 +0200
|
|
|
22c937 |
--- src/if_python3.c 2015-02-03 12:05:13.471422753 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1649,1656 ****
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
! void
|
|
|
22c937 |
set_ref_in_python3 (int copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
! set_ref_in_py(copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
--- 1649,1656 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
! int
|
|
|
22c937 |
set_ref_in_python3 (int copyID)
|
|
|
22c937 |
{
|
|
|
22c937 |
! int set_ref_in_py(copyID);
|
|
|
22c937 |
}
|
|
|
22c937 |
*** ../vim-7.4.608/src/proto/eval.pro 2014-12-17 14:36:10.363090985 +0100
|
|
|
22c937 |
--- src/proto/eval.pro 2015-02-03 12:47:58.472780049 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 62,70 ****
|
|
|
22c937 |
void list_insert __ARGS((list_T *l, listitem_T *ni, listitem_T *item));
|
|
|
22c937 |
void vimlist_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2));
|
|
|
22c937 |
int garbage_collect __ARGS((void));
|
|
|
22c937 |
! void set_ref_in_ht __ARGS((hashtab_T *ht, int copyID));
|
|
|
22c937 |
! void set_ref_in_list __ARGS((list_T *l, int copyID));
|
|
|
22c937 |
! void set_ref_in_item __ARGS((typval_T *tv, int copyID));
|
|
|
22c937 |
dict_T *dict_alloc __ARGS((void));
|
|
|
22c937 |
void dict_unref __ARGS((dict_T *d));
|
|
|
22c937 |
void dict_free __ARGS((dict_T *d, int recurse));
|
|
|
22c937 |
--- 62,70 ----
|
|
|
22c937 |
void list_insert __ARGS((list_T *l, listitem_T *ni, listitem_T *item));
|
|
|
22c937 |
void vimlist_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2));
|
|
|
22c937 |
int garbage_collect __ARGS((void));
|
|
|
22c937 |
! int set_ref_in_ht __ARGS((hashtab_T *ht, int copyID, list_stack_T **list_stack));
|
|
|
22c937 |
! int set_ref_in_list __ARGS((list_T *l, int copyID, ht_stack_T **ht_stack));
|
|
|
22c937 |
! int set_ref_in_item __ARGS((typval_T *tv, int copyID, ht_stack_T **ht_stack, list_stack_T **list_stack));
|
|
|
22c937 |
dict_T *dict_alloc __ARGS((void));
|
|
|
22c937 |
void dict_unref __ARGS((dict_T *d));
|
|
|
22c937 |
void dict_free __ARGS((dict_T *d, int recurse));
|
|
|
22c937 |
*** ../vim-7.4.608/src/proto/if_lua.pro 2012-04-05 16:41:35.000000000 +0200
|
|
|
22c937 |
--- src/proto/if_lua.pro 2015-02-03 12:05:13.475422711 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 7,11 ****
|
|
|
22c937 |
void lua_buffer_free __ARGS((buf_T *buf));
|
|
|
22c937 |
void lua_window_free __ARGS((win_T *win));
|
|
|
22c937 |
void do_luaeval __ARGS((char_u *str, typval_T *arg, typval_T *rettv));
|
|
|
22c937 |
! void set_ref_in_lua __ARGS((int copyID));
|
|
|
22c937 |
/* vim: set ft=c : */
|
|
|
22c937 |
--- 7,11 ----
|
|
|
22c937 |
void lua_buffer_free __ARGS((buf_T *buf));
|
|
|
22c937 |
void lua_window_free __ARGS((win_T *win));
|
|
|
22c937 |
void do_luaeval __ARGS((char_u *str, typval_T *arg, typval_T *rettv));
|
|
|
22c937 |
! int set_ref_in_lua __ARGS((int copyID));
|
|
|
22c937 |
/* vim: set ft=c : */
|
|
|
22c937 |
*** ../vim-7.4.608/src/proto/if_python.pro 2013-08-10 13:37:15.000000000 +0200
|
|
|
22c937 |
--- src/proto/if_python.pro 2015-02-03 12:48:02.936733431 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 9,13 ****
|
|
|
22c937 |
void python_window_free __ARGS((win_T *win));
|
|
|
22c937 |
void python_tabpage_free __ARGS((tabpage_T *tab));
|
|
|
22c937 |
void do_pyeval __ARGS((char_u *str, typval_T *rettv));
|
|
|
22c937 |
! void set_ref_in_python __ARGS((int copyID));
|
|
|
22c937 |
/* vim: set ft=c : */
|
|
|
22c937 |
--- 9,13 ----
|
|
|
22c937 |
void python_window_free __ARGS((win_T *win));
|
|
|
22c937 |
void python_tabpage_free __ARGS((tabpage_T *tab));
|
|
|
22c937 |
void do_pyeval __ARGS((char_u *str, typval_T *rettv));
|
|
|
22c937 |
! int set_ref_in_python __ARGS((int copyID));
|
|
|
22c937 |
/* vim: set ft=c : */
|
|
|
22c937 |
*** ../vim-7.4.608/src/proto/if_python3.pro 2013-08-10 13:37:16.000000000 +0200
|
|
|
22c937 |
--- src/proto/if_python3.pro 2015-02-03 12:48:03.292729714 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 9,13 ****
|
|
|
22c937 |
void python3_window_free __ARGS((win_T *win));
|
|
|
22c937 |
void python3_tabpage_free __ARGS((tabpage_T *tab));
|
|
|
22c937 |
void do_py3eval __ARGS((char_u *str, typval_T *rettv));
|
|
|
22c937 |
! void set_ref_in_python3 __ARGS((int copyID));
|
|
|
22c937 |
/* vim: set ft=c : */
|
|
|
22c937 |
--- 9,13 ----
|
|
|
22c937 |
void python3_window_free __ARGS((win_T *win));
|
|
|
22c937 |
void python3_tabpage_free __ARGS((tabpage_T *tab));
|
|
|
22c937 |
void do_py3eval __ARGS((char_u *str, typval_T *rettv));
|
|
|
22c937 |
! int set_ref_in_python3 __ARGS((int copyID));
|
|
|
22c937 |
/* vim: set ft=c : */
|
|
|
22c937 |
*** ../vim-7.4.608/src/structs.h 2015-01-14 12:44:38.407422077 +0100
|
|
|
22c937 |
--- src/structs.h 2015-02-03 12:05:13.475422711 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1223,1228 ****
|
|
|
22c937 |
--- 1223,1242 ----
|
|
|
22c937 |
dict_T *dv_used_prev; /* previous dict in used dicts list */
|
|
|
22c937 |
};
|
|
|
22c937 |
|
|
|
22c937 |
+ /* structure used for explicit stack while garbage collecting hash tables */
|
|
|
22c937 |
+ typedef struct ht_stack_S
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ hashtab_T *ht;
|
|
|
22c937 |
+ struct ht_stack_S *prev;
|
|
|
22c937 |
+ } ht_stack_T;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ /* structure used for explicit stack while garbage collecting lists */
|
|
|
22c937 |
+ typedef struct list_stack_S
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ list_T *list;
|
|
|
22c937 |
+ struct list_stack_S *prev;
|
|
|
22c937 |
+ } list_stack_T;
|
|
|
22c937 |
+
|
|
|
22c937 |
/* values for b_syn_spell: what to do with toplevel text */
|
|
|
22c937 |
#define SYNSPL_DEFAULT 0 /* spell check if @Spell not defined */
|
|
|
22c937 |
#define SYNSPL_TOP 1 /* spell check toplevel text */
|
|
|
22c937 |
*** ../vim-7.4.608/src/version.c 2015-01-27 22:52:10.713524965 +0100
|
|
|
22c937 |
--- src/version.c 2015-02-03 12:09:19.324876918 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 743,744 ****
|
|
|
22c937 |
--- 743,746 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 609,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
hundred-and-one symptoms of being an internet addict:
|
|
|
22c937 |
167. You have more than 200 websites bookmarked.
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|