In mcs:
[mono.git] / mcs / mcs / TODO
1 Iterators
2 =========
3
4
5         Ok, solved part of the problem, but not the second.
6
7         Apparently there are 2 scopes in test-iter-05.cs that
8         are referenced, but when we call "ComputeMethodHost" in
9         iterators.cs:854 this information is not yet available.
10
11 * Anonymous Methods
12 ===================
13
14 In EmitAnonymousHelperClasses we set the "NeedThis" parameter of all
15 the roots, but this is not necessary.  We should track the
16 "HaveCapturedFields" on a per-ScopeInfo basis, and only set the
17 HaveCapturedFields on the proper roots, instead of all the roots.
18
19
20
21 ===========================================
22
23 * Value Parameter
24
25         I believe that `Value Parameter' might have been introduced
26         after C# 1.0, also notice than in the treatment of Value Parameter
27         the parameters are defined in four categories:
28
29         Section 9.3 in the latest spec.
30
31
32 * Review
33 --------
34
35         Reference type equality operators (15.9.6) introduced
36         operator == (C x, C y) where C is a reference type.
37
38         Our compiler used:
39
40         operator == (object a, object b)
41
42         Review our implementation.
43
44 New
45 ---
46
47         It would be nice to optimize the case of:
48
49                 Method (new ValueType ())
50
51         So that no temporary is created, and we only use a newobj call
52         that remains on the stack, as opposed to ldloca, initobj, ldloc
53         call.
54
55 NEW NOTES:
56 ----------
57
58         ImplicitStandardConversionExists and ImplicitStandardConversion
59         should always be the same, but there are a few diverging lines that
60         must be studied:
61
62                         if (expr_type == target_type && !(expr is NullLiteral))
63                                 return expr;
64
65         vs:
66
67                         if (expr_type == target_type)
68                                 return true;
69
70
71 Null Type
72 ---------
73
74         Need to introduce the NullType concept into the compiler, to address a 
75         few small buglets and remove the hardcoded values for NullLiteral.
76
77         NullLiteral will be the only expression that has the NullType as its type.
78
79         This is what must be used to test for Null literals, instead of `is NullLiteral',
80         and this will introduce a couple of fixes to the rules.
81
82 ****************************************************************************************
83
84 *   The information on the rest of this file is mostly outdated, and its kept here for
85 *   historical reasons
86 *
87 ****************************************************************************************
88  
89 Error Reporting:
90 ----------------
91
92         * Make yyerror show a nice syntax error, instead of the current mess.
93
94 Iterators
95 ---------
96         * Reset should throw not implemented now.
97
98 Optimization ideas
99 ------------------
100
101         Currently when we build a type cache, it contains private members,
102         internal members, and internal protected members;   We should trim
103         these out, as it shows up on the profile.
104
105         We create too many Arraylists;  When we know the size, we should create
106         an array;
107
108         During parsing we use arraylists to accumulate data, like this:
109
110                 thing:
111                 
112                 thing_list
113                         : thing { $$ =new ArrayList (); $$.Add ($1); }
114                         | thing_list thing { ArrayList a = $1; a.Add ($2); $$ = a; }
115
116         We probably could start using "Pairs" there:
117
118                 thing_list
119                         : thing { $$ = new Pair ($1, null); }
120                         | thing_list thing { Pair p = $1; $$ = new Pair ($2, $1); }
121
122
123 EmitContext.ResolveTypeTree
124 ---------------------------
125
126         We should investigate its usage.  The problem is that by default
127         this will be set when calling FindType, that triggers a more expensive
128         lookup.
129
130         I believe we should pass the current EmitContext (which has this turned off
131         by default) to ResolveType/REsolveTypeExpr and then have the routines that
132         need ResolveType to pass null as the emit context.
133
134 DeclareLocal audit
135 ------------------
136
137         DeclareLocal is used in various statements.  The audit should be done
138         in two steps:
139
140                 * Identify all the declare locals.
141
142                 * Identify its uses.
143
144                 * Find if we can make wrapper functions for all of them.
145
146         Then we can move DeclareLocal into a helper class.
147
148         This is required to fix foreach in iterators.
149
150 Large project:
151 --------------
152
153         Drop FindMembers as our API and instead extract all the data
154         out of a type the first time into our own datastructures, and
155         use that to navigate and search the type instead of the
156         callback based FindMembers.     
157
158         Martin has some some of this work with his TypeHandle code
159         that we could use for this.
160
161 Ideas:
162 ------
163
164         Instead of the hack that *knows* about System.Object not having any children classes,
165         we should just make it simple for a probe to know that there is no need for it.
166
167 Dead Code Elimination bugs:
168 ---------------------------
169
170         I should also resolve all the children expressions in Switch, Fixed, Using.
171
172 Major tasks:
173 ------------
174         Properties and 17.6.3: Finish it.
175
176 readonly variables and ref/out
177         
178 BUGS
179 ----
180
181 * Break/Continue statements
182
183         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
184         they are logically outside the scope of the loop.
185
186 * Break/continue part 2.
187
188         They should transfer control to the finally block if inside a try/catch
189         block.
190
191 * Method Registration and error CS111
192
193         The way we use the method registration to signal 111 is wrong.
194         
195         Method registration should only be used to register methodbuilders,
196         we need an alternate method of checking for duplicates.
197
198 *
199 > // CSC sets beforefieldinit
200 > class X {
201 >   // .cctor will be generated by compiler
202 >   public static readonly object O = new System.Object ();
203 >   public static void Main () {}
204 > }
205
206
207 PENDING TASKS
208 -------------
209
210 * Merge test 89 and test-34
211
212 * Code cleanup
213
214         The information when registering a method in InternalParameters
215         is duplicated, you can always get the types from the InternalParameters
216
217 * Emit modreq for volatiles
218
219         Handle modreq from public apis.
220
221 * Merge tree.cs, rootcontext.cs
222
223 OPTIMIZATIONS
224 -------------
225
226 * User Defined Conversions is doing way too many calls to do union sets that are not needed
227
228 * Add test case for destructors
229
230 * Places that use `Ldelema' are basically places where I will be
231   initializing a value type.  I could apply an optimization to 
232   disable the implicit local temporary from being created (by using
233   the method in New).
234
235 * Dropping TypeContainer as an argument to EmitContext
236
237         My theory is that I can get rid of the TypeBuilder completely from
238         the EmitContext, and have typecasts where it is used (from
239         DeclSpace to where it matters).  
240
241         The only pending problem is that the code that implements Aliases
242         is on TypeContainer, and probably should go in DeclSpace.
243
244 * Tests
245
246         Write tests for the various reference conversions.  We have
247         test for all the numeric conversions.
248
249 * Optimizations: variable allocation.
250
251         When local variables of a type are required, we should request
252         the variable and later release it when we are done, so that
253         the same local variable slot can be reused later on.
254
255 * Add a cache for the various GetArrayMethod operations.
256
257 * MakeUnionSet Callers
258
259         If the types are the same, there is no need to compute the unionset,
260         we can just use the list from one of the types.
261
262 * Factor the lookup code for class declarations an interfaces
263   (interface.cs:GetInterfaceByName)
264
265 RECOMMENDATIONS
266 ---------------
267
268 * Use of lexer.Location in the parser
269
270         Currently we do:
271
272         TOKEN nt TERMINAL nt TERMINAL nt3 {
273                 $$ = new Blah ($2, $4, $6, lexer.Location);
274         }
275
276         This is bad, because the lexer.Location is for the last item in `nt3'
277
278         We need to change that to use this pattern:
279
280         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
281                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
282         }
283
284         Notice how numbering of the arguments changes as the
285         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.
286
287