2010-05-19 Jb Evain <jbevain@novell.com>
[mcs.git] / mcs / TODO
blob1abb0382b7bdc02b935afae54b8f06a9774130fe
1 ===========================================
3 * Value Parameter
5         I believe that `Value Parameter' might have been introduced
6         after C# 1.0, also notice than in the treatment of Value Parameter
7         the parameters are defined in four categories:
9         Section 9.3 in the latest spec.
12 Large project:
13 --------------
15 New
16 ---
18         It would be nice to optimize the case of:
20                 Method (new ValueType ())
22         So that no temporary is created, and we only use a newobj call
23         that remains on the stack, as opposed to ldloca, initobj, ldloc
24         call.
26 NEW NOTES:
27 ----------
29         ImplicitStandardConversionExists and ImplicitStandardConversion
30         should always be the same, but there are a few diverging lines that
31         must be studied:
33                         if (expr_type == target_type && !(expr is NullLiteral))
34                                 return expr;
36         vs:
38                         if (expr_type == target_type)
39                                 return true;
41 ****************************************************************************************
42
43 *   The information on the rest of this file is mostly outdated, and its kept here for
44 *   historical reasons
46 ****************************************************************************************
48 Error Reporting:
49 ----------------
51         * Make yyerror show a nice syntax error, instead of the current mess.
53 Optimization ideas
54 ------------------
56         Currently when we build a type cache, it contains private members,
57         internal members, and internal protected members;   We should trim
58         these out, as it shows up on the profile.
60         We create too many Arraylists;  When we know the size, we should create
61         an array;
63         During parsing we use arraylists to accumulate data, like this:
65                 thing:
66                 
67                 thing_list
68                         : thing { $$ =new ArrayList (); $$.Add ($1); }
69                         | thing_list thing { ArrayList a = $1; a.Add ($2); $$ = a; }
71         We probably could start using "Pairs" there:
73                 thing_list
74                         : thing { $$ = new Pair ($1, null); }
75                         | thing_list thing { Pair p = $1; $$ = new Pair ($2, $1); }
78 EmitContext.ResolveTypeTree
79 ---------------------------
81         We should investigate its usage.  The problem is that by default
82         this will be set when calling FindType, that triggers a more expensive
83         lookup.
85         I believe we should pass the current EmitContext (which has this turned off
86         by default) to ResolveType/REsolveTypeExpr and then have the routines that
87         need ResolveType to pass null as the emit context.
89 DeclareLocal audit
90 ------------------
92         DeclareLocal is used in various statements.  The audit should be done
93         in two steps:
95                 * Identify all the declare locals.
97                 * Identify its uses.
99                 * Find if we can make wrapper functions for all of them.
101         Then we can move DeclareLocal into a helper class.
103         This is required to fix foreach in iterators.
105 Ideas:
106 ------
108         Instead of the hack that *knows* about System.Object not having any children classes,
109         we should just make it simple for a probe to know that there is no need for it.
111 Dead Code Elimination bugs:
112 ---------------------------
114         I should also resolve all the children expressions in Switch, Fixed, Using.
116 Major tasks:
117 ------------
118         Properties and 17.6.3: Finish it.
120 readonly variables and ref/out
121         
122 BUGS
123 ----
125 * Break/Continue statements
127         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
128         they are logically outside the scope of the loop.
130 * Break/continue part 2.
132         They should transfer control to the finally block if inside a try/catch
133         block.
136 > // CSC sets beforefieldinit
137 > class X {
138 >   // .cctor will be generated by compiler
139 >   public static readonly object O = new System.Object ();
140 >   public static void Main () {}
141 > }
144 PENDING TASKS
145 -------------
147 * Merge test 89 and test-34
149 * Code cleanup
151         The information when registering a method in InternalParameters
152         is duplicated, you can always get the types from the InternalParameters
154 * Emit modreq for volatiles
156         Handle modreq from public apis.
158 * Merge tree.cs, rootcontext.cs
160 OPTIMIZATIONS
161 -------------
163 * User Defined Conversions is doing way too many calls to do union sets that are not needed
165 * Add test case for destructors
167 * Places that use `Ldelema' are basically places where I will be
168   initializing a value type.  I could apply an optimization to 
169   disable the implicit local temporary from being created (by using
170   the method in New).
172 * Dropping TypeContainer as an argument to EmitContext
174         My theory is that I can get rid of the TypeBuilder completely from
175         the EmitContext, and have typecasts where it is used (from
176         DeclSpace to where it matters).  
178         The only pending problem is that the code that implements Aliases
179         is on TypeContainer, and probably should go in DeclSpace.
181 * Tests
183         Write tests for the various reference conversions.  We have
184         test for all the numeric conversions.
186 * Optimizations: variable allocation.
188         When local variables of a type are required, we should request
189         the variable and later release it when we are done, so that
190         the same local variable slot can be reused later on.
192 * Add a cache for the various GetArrayMethod operations.
194 * MakeUnionSet Callers
196         If the types are the same, there is no need to compute the unionset,
197         we can just use the list from one of the types.
199 * Factor the lookup code for class declarations an interfaces
200   (interface.cs:GetInterfaceByName)
202 RECOMMENDATIONS
203 ---------------
205 * Use of lexer.Location in the parser
207         Currently we do:
209         TOKEN nt TERMINAL nt TERMINAL nt3 {
210                 $$ = new Blah ($2, $4, $6, lexer.Location);
211         }
213         This is bad, because the lexer.Location is for the last item in `nt3'
215         We need to change that to use this pattern:
217         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
218                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
219         }
221         Notice how numbering of the arguments changes as the
222         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.