]> git.pld-linux.org Git - packages/vim.git/blob - 7.0.084
- updated to 0.7.3
[packages/vim.git] / 7.0.084
1 To: vim-dev@vim.org
2 Subject: Patch 7.0.084
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.0.084
11 Problem:    The garbage collector may do its work while some Lists or
12             Dictionaries are used internally, e.g., by ":echo" that runs into
13             the more-prompt or ":echo [garbagecollect()]".
14 Solution:   Only do garbage collection when waiting for a character at the
15             toplevel.  Let garbagecollect() set a flag that is handled at the
16             toplevel before waiting for a character.
17 Files:      src/eval.c, src/getchar.c, src/globals.h, src/main.c
18
19
20 *** ../vim-7.0.083/src/eval.c   Sun Sep  3 15:38:02 2006
21 --- src/eval.c  Tue Sep  5 11:49:38 2006
22 ***************
23 *** 6074,6079 ****
24 --- 6074,6083 ----
25       tabpage_T *tp;
26   #endif
27   
28 +     /* Only do this once. */
29 +     want_garbage_collect = FALSE;
30 +     may_garbage_collect = FALSE;
31
32       /*
33        * 1. Go through all accessible variables and mark all lists and dicts
34        *    with copyID.
35 ***************
36 *** 9636,9642 ****
37       typval_T  *argvars;
38       typval_T  *rettv;
39   {
40 !     garbage_collect();
41   }
42   
43   /*
44 --- 9640,9648 ----
45       typval_T  *argvars;
46       typval_T  *rettv;
47   {
48 !     /* This is postponed until we are back at the toplevel, because we may be
49 !      * using Lists and Dicts internally.  E.g.: ":echo [garbagecollect()]". */
50 !     want_garbage_collect = TRUE;
51   }
52   
53   /*
54 *** ../vim-7.0.083/src/getchar.c        Wed May  3 23:19:24 2006
55 --- src/getchar.c       Tue Sep  5 12:55:54 2006
56 ***************
57 *** 1451,1457 ****
58   {
59       updatescript(0);
60   #ifdef FEAT_EVAL
61 !     garbage_collect();
62   #endif
63   }
64   
65 --- 1451,1458 ----
66   {
67       updatescript(0);
68   #ifdef FEAT_EVAL
69 !     if (may_garbage_collect)
70 !       garbage_collect();
71   #endif
72   }
73   
74 ***************
75 *** 1502,1507 ****
76 --- 1503,1515 ----
77       int               i;
78   #endif
79   
80 + #ifdef FEAT_EVAL
81 +     /* Do garbage collection when garbagecollect() was called previously and
82 +      * we are now at the toplevel. */
83 +     if (may_garbage_collect && want_garbage_collect)
84 +       garbage_collect();
85 + #endif
86
87       /*
88        * If a character was put back with vungetc, it was already processed.
89        * Return it directly.
90 ***************
91 *** 1511,1523 ****
92         c = old_char;
93         old_char = -1;
94         mod_mask = old_mod_mask;
95 -       return c;
96       }
97
98 !     mod_mask = 0x0;
99 !     last_recorded_len = 0;
100 !     for (;;)                  /* this is done twice if there are modifiers */
101       {
102         if (mod_mask)           /* no mapping after modifier has been read */
103         {
104             ++no_mapping;
105 --- 1519,1531 ----
106         c = old_char;
107         old_char = -1;
108         mod_mask = old_mod_mask;
109       }
110 !     else
111       {
112 +       mod_mask = 0x0;
113 +       last_recorded_len = 0;
114 +       for (;;)                        /* this is done twice if there are modifiers */
115 +       {
116         if (mod_mask)           /* no mapping after modifier has been read */
117         {
118             ++no_mapping;
119 ***************
120 *** 1695,1702 ****
121         }
122   #endif
123   
124 !       return c;
125       }
126   }
127   
128   /*
129 --- 1703,1722 ----
130         }
131   #endif
132   
133 !       break;
134 !       }
135       }
136
137 + #ifdef FEAT_EVAL
138 +     /*
139 +      * In the main loop "may_garbage_collect" can be set to do garbage
140 +      * collection in the first next vgetc().  It's disabled after that to
141 +      * avoid internally used Lists and Dicts to be freed.
142 +      */
143 +     may_garbage_collect = FALSE;
144 + #endif
145
146 +     return c;
147   }
148   
149   /*
150 *** ../vim-7.0.083/src/globals.h        Sat Sep  2 14:52:41 2006
151 --- src/globals.h       Tue Sep  5 11:46:10 2006
152 ***************
153 *** 300,308 ****
154   #endif
155   
156   #ifdef FEAT_EVAL
157 ! EXTERN scid_T current_SID INIT(= 0);      /* ID of script being sourced or
158 !                                              was sourced to define the
159 !                                              current function. */
160   #endif
161   
162   #if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
163 --- 300,315 ----
164   #endif
165   
166   #ifdef FEAT_EVAL
167 ! /* Garbage collection can only take place when we are sure there are no Lists
168 !  * or Dictionaries being used internally.  This is flagged with
169 !  * "may_garbage_collect" when we are at the toplevel.
170 !  * "want_garbage_collect" is set by the garbagecollect() function, which means
171 !  * we do garbage collection before waiting for a char at the toplevel. */
172 ! EXTERN int    may_garbage_collect INIT(= FALSE);
173 ! EXTERN int    want_garbage_collect INIT(= FALSE);
174
175 ! /* ID of script being sourced or was sourced to define the current function. */
176 ! EXTERN scid_T current_SID INIT(= 0);
177   #endif
178   
179   #if defined(FEAT_EVAL) || defined(FEAT_SYN_HL)
180 *** ../vim-7.0.083/src/main.c   Tue Aug 29 17:28:56 2006
181 --- src/main.c  Tue Sep  5 12:33:47 2006
182 ***************
183 *** 1130,1135 ****
184 --- 1130,1145 ----
185          */
186         update_curswant();
187   
188 + #ifdef FEAT_EVAL
189 +       /*
190 +        * May perform garbage collection when waiting for a character, but
191 +        * only at the very toplevel.  Otherwise we may be using a List or
192 +        * Dict internally somewhere.
193 +        * "may_garbage_collect" is reset in vgetc() which is invoked through
194 +        * do_exmode() and normal_cmd().
195 +        */
196 +       may_garbage_collect = (!cmdwin && !noexmode);
197 + #endif
198         /*
199          * If we're invoked as ex, do a round of ex commands.
200          * Otherwise, get and execute a normal mode command.
201 *** ../vim-7.0.083/src/version.c        Sun Sep  3 16:39:51 2006
202 --- src/version.c       Tue Sep  5 12:51:28 2006
203 ***************
204 *** 668,669 ****
205 --- 668,671 ----
206   {   /* Add new patch number below this line */
207 + /**/
208 +     84,
209   /**/
210
211 -- 
212 LAUNCELOT: At last!   A call!  A cry of distress ...
213            (he draws his sword, and turns to CONCORDE)
214            Concorde!  Brave, Concorde ... you shall not have died in vain!
215 CONCORDE:  I'm not quite dead, sir ...
216                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
217
218  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
219 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
220 \\\        download, build and distribute -- http://www.A-A-P.org        ///
221  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.069058 seconds and 3 git commands to generate.