web site updates
[mono.git] / mcs / mcs / TODO
1 NOTES:
2         I am trying to remove the LocalVariableReference from the code
3         but the compiler does not pass its own self-compilation.
4
5         The problem is that constructs with embedded_statements like:
6
7         foreach (int b in X)
8                 if (b ...)
9
10         The ec.CurrentBlock is not updated with the fact that `b' lives
11         in an implicit internal block, and the lookup is attempted on the
12         parent's block, hence rendering the lookup invalid.
13
14 Major tasks:
15 ------------
16
17         Pinned and volatile require type modifiers that can not be encoded
18         with Reflection.Emit.
19
20         Properties and 17.6.3: Finish it.
21
22         Implement base indexer access.
23
24 MethodGroupExpr
25
26         These guys should only appear as part of an Invocation, so we
27         probably can afford to have a special callback:
28
29                 Expression.ResolveAllowMemberGroups
30
31         This is only called by Invocation (or anyone that consumes 
32         MethodGroupExprs)
33
34         And the regular DoResolve and DoResolveLValue do emit the error
35         654 `Method referenced without argument list'.  
36
37         Otherwise, a resolution will return a MethodGroupExpr which is
38         not guaranteed to have set its `Expression.Type' to a non-null
39         value.
40
41 readonly variables and ref/out
42         
43 BUGS
44 ----
45
46 * Check for Final when overriding, if the parent is Final, then we cant
47   allow an override.
48
49 * Add test case for destructors
50
51 * Do not declare a .property on things that are just implementations, that
52   comes from the parent, just do the method.
53
54 * Currently the code path for 108/109 reporting is not being ran for methods
55   as we need to compare method signatures.  But since we retrieve the expensive
56   method arguments in the method, we probably should do 108/109 processing there.
57
58 * Emit warning on hiding members without NEW not only in members.
59
60 * Implement visibility.
61
62 * Casts need to trigger a name resolution against types only.
63
64 * Adding variables.
65
66         We do add variables in a number of places, and this is erroneous:
67
68         void a (int b)
69         {
70                 int b;
71         }
72
73         Also:
74
75         void a (int b)
76         {
77                 foreach (int b ...)
78                         ;
79         }
80
81 * Visibility
82
83         I am not reporting errors on visibility yet.
84
85 * Interface indexers
86
87         I have not figured out why the Microsoft version puts an
88         `instance' attribute, and I am not generating this `instance' attribute.
89
90         Explanation: The reason for the `instance' attribute on
91         indexers is that indexers only apply to instances
92
93 * Arrays
94
95         We need to make sure at *compile time* that the arguments in
96         the expression list of an array creation are always positive.
97
98 * Implement dead code elimination in statement.cs
99
100         It is pretty simple to implement dead code elimination in 
101         if/do/while
102
103 * Indexer bugs:
104
105         the following wont work:
106
107         x [0] = x [1] = N
108
109         if x has indexers, the value of x [N] set is set to void.  This needs to be
110         fixed.
111
112 * Array declarations
113
114         Multi-dim arrays are declared as [,] instead of [0..,0..]
115
116 * Break/Continue statements
117
118         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
119         they are logically outside the scope of the loop.
120
121 * Break/continue part 2.
122
123         They should transfer control to the finally block if inside a try/catch
124         block.
125
126 * Method Registration and error CS111
127
128         The way we use the method registration to signal 111 is wrong.
129         
130         Method registration should only be used to register methodbuilders,
131         we need an alternate method of checking for duplicates.
132
133 * We need to catch:
134
135         extern string Property {
136                 get { } 
137         }
138
139         The get there should only have a semicolon
140         
141 *
142 > // CSC sets beforefieldinit
143 > class X {
144 >   // .cctor will be generated by compiler
145 >   public static readonly object O = new System.Object ();
146 >   public static void Main () {}
147 > }
148
149
150 PENDING TASKS
151 -------------
152
153 * Constant Folding
154
155         Constant Folding does not take into account Enumerations, we should maybe
156         extract the underlying value, and constant fold on it.
157
158 * Revisit
159
160         Primary-expression, as it has now been split into 
161         non-array-creation-expression and array-creation-expression.
162                 
163 * Static flow analysis
164
165         Required to warn about reachability of code and definite
166         assignemt as well as missing returns on functions.
167
168 * Code cleanup
169
170         The information when registering a method in InternalParameters
171         is duplicated, you can always get the types from the InternalParameters
172
173 * Emit modreq for volatiles
174
175         Handle modreq from public apis.
176
177 * Emit `pinned' for pinned local variables.
178
179         Both `modreq' and pinned will require special hacks in the compiler.
180
181 * Make sure that we are pinning the right variable
182
183 * Maybe track event usage?  Currently I am not tracking these, although they
184   are fields.
185
186
187 OPTIMIZATIONS
188 -------------
189
190 * Dropping TypeContainer as an argument to EmitContext
191
192         My theory is that I can get rid of the TypeBuilder completely from
193         the EmitContext, and have typecasts where it is used (from
194         DeclSpace to where it matters).  
195
196         The only pending problem is that the code that implements Aliases
197         is on TypeContainer, and probably should go in DeclSpace.
198
199
200 * Use of local temporary in UnaryMutator
201
202         We should get rid of the Localtemporary there for some cases
203
204 * Emitcontext
205
206         Do we really need to instanciate this variable all the time?
207
208         It could be static for all we care, and just use it for making
209         sure that there are no recursive invocations on it.
210
211 * Static-ization
212
213         Since AppDomain exists, maybe we can get rid of all the stuff
214         that is part of the `compiler instance' and just use globals
215         everywhere.
216
217
218 * Constructors
219
220         Currently it calls the parent constructor before initializing fields.
221         It should do it the other way around.
222
223 * Use of EmitBranchable
224
225         Currently I use brfalse/brtrue in the code for statements, instead of
226         using the EmitBranchable function that lives in Binary
227
228 * ConvertImplicit
229
230         Currently ConvertImplicit will not catch things like:
231
232         - IntLiteral in a float context to generate a -FloatLiteral.
233         Instead it will perform an integer load followed by a conversion.
234
235 * Tests
236
237         Write tests for the various reference conversions.  We have
238         test for all the numeric conversions.
239
240 * Remove the tree dumper, cleanup `public readonly' 
241
242         And make all the stuff which is `public readonly' be private unless
243         required.
244
245 * Optimizations
246
247         In Indexers and Properties, probably support an EmitWithDup
248         That emits the code to call Get and then leaves a this pointer
249         in the stack, so that later a Store can be emitted using that
250         this pointer (consider Property++ or Indexer++)
251
252
253 * Optimizations: variable allocation.
254
255         When local variables of a type are required, we should request
256         the variable and later release it when we are done, so that
257         the same local variable slot can be reused later on.
258
259 * Add a cache for the various GetArrayMethod operations.
260
261 * Optimization:
262
263         Do not use StatementCollections, use ArrayLists of Statements,
264         and then "copy" it out to arrays.  Then reuse the existing
265         Statement structures.
266
267 * TypeManager.FindMembers:
268
269         Instead of having hundreds of builder_to_blah hash table, have
270         a single one that maps a TypeBuilder `t' to a set of classes
271         that implement an interface that supports FindMembers.
272
273 * MakeUnionSet Callers
274
275         If the types are the same, there is no need to compute the unionset,
276         we can just use the list from one of the types.
277
278 RECOMMENDATIONS
279 ---------------
280
281 * Use of lexer.Location in the parser
282
283         Currently we do:
284
285         TOKEN nt TERMINAL nt TERMINAL nt3 {
286                 $$ = new Blah ($2, $4, $6, lexer.Location);
287         }
288
289         This is bad, because the lexer.Location is for the last item in `nt3'
290
291         We need to change that to use this pattern:
292
293         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
294                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
295         }
296
297         Notice how numbering of the arguments changes as the
298         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.
299
300 * local_variable_declaration
301
302         Not sure that this grammar is correct, we might have to
303         resolve this during semantic analysis.
304
305
306 * Try/Catch
307
308         Investigate what is  the right value to return  from `Emit' in
309         there (ie, for the `all code paths return')
310         
311
312 * Optimizations
313
314         Only create one `This' instance per class, and reuse it.
315
316         Maybe keep a pool of constants/literals (zero, 1)?
317
318 ************
319 Potential bug:
320
321         We would need to decode the shortname before we lookup members?
322         
323         Maybe not.
324
325 interface I {
326         void A ();
327 }
328
329 class X : I {
330         void I.A ();
331 }
332
333 class Y : X, I {
334         void I.A () {}
335 }
336
337
338
339 *************
340