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