In ilasm/tests:
[mcs.git] / mcs / TODO
blob62b8394c257d6944fbb76c8ad616166d345167a2
1 Iterators
2 =========
5         Ok, solved part of the problem, but not the second.
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.
11 * Anonymous Methods
12 ===================
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.
21 ===========================================
23 * Value Parameter
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:
29         Section 9.3 in the latest spec.
32 * Review
33 --------
35         Reference type equality operators (15.9.6) introduced
36         operator == (C x, C y) where C is a reference type.
38         Our compiler used:
40         operator == (object a, object b)
42         Review our implementation.
44 New
45 ---
47         It would be nice to optimize the case of:
49                 Method (new ValueType ())
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.
55 NEW NOTES:
56 ----------
58         ImplicitStandardConversionExists and ImplicitStandardConversion
59         should always be the same, but there are a few diverging lines that
60         must be studied:
62                         if (expr_type == target_type && !(expr is NullLiteral))
63                                 return expr;
65         vs:
67                         if (expr_type == target_type)
68                                 return true;
71 Null Type
72 ---------
74         Need to introduce the NullType concept into the compiler, to address a 
75         few small buglets and remove the hardcoded values for NullLiteral.
77         NullLiteral will be the only expression that has the NullType as its type.
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.
82 ****************************************************************************************
83
84 *   The information on the rest of this file is mostly outdated, and its kept here for
85 *   historical reasons
87 ****************************************************************************************
89 Error Reporting:
90 ----------------
92         * Make yyerror show a nice syntax error, instead of the current mess.
94 Iterators
95 ---------
96         * Reset should throw not implemented now.
98 Optimization ideas
99 ------------------
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.
105         We create too many Arraylists;  When we know the size, we should create
106         an array;
108         During parsing we use arraylists to accumulate data, like this:
110                 thing:
111                 
112                 thing_list
113                         : thing { $$ =new ArrayList (); $$.Add ($1); }
114                         | thing_list thing { ArrayList a = $1; a.Add ($2); $$ = a; }
116         We probably could start using "Pairs" there:
118                 thing_list
119                         : thing { $$ = new Pair ($1, null); }
120                         | thing_list thing { Pair p = $1; $$ = new Pair ($2, $1); }
123 EmitContext.ResolveTypeTree
124 ---------------------------
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.
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.
134 DeclareLocal audit
135 ------------------
137         DeclareLocal is used in various statements.  The audit should be done
138         in two steps:
140                 * Identify all the declare locals.
142                 * Identify its uses.
144                 * Find if we can make wrapper functions for all of them.
146         Then we can move DeclareLocal into a helper class.
148         This is required to fix foreach in iterators.
150 Large project:
151 --------------
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.     
158         Martin has some some of this work with his TypeHandle code
159         that we could use for this.
161 Ideas:
162 ------
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.
167 Dead Code Elimination bugs:
168 ---------------------------
170         I should also resolve all the children expressions in Switch, Fixed, Using.
172 Major tasks:
173 ------------
174         Properties and 17.6.3: Finish it.
176 readonly variables and ref/out
177         
178 BUGS
179 ----
181 * Break/Continue statements
183         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
184         they are logically outside the scope of the loop.
186 * Break/continue part 2.
188         They should transfer control to the finally block if inside a try/catch
189         block.
191 * Method Registration and error CS111
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.
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 > }
207 PENDING TASKS
208 -------------
210 * Merge test 89 and test-34
212 * Code cleanup
214         The information when registering a method in InternalParameters
215         is duplicated, you can always get the types from the InternalParameters
217 * Emit modreq for volatiles
219         Handle modreq from public apis.
221 * Merge tree.cs, rootcontext.cs
223 OPTIMIZATIONS
224 -------------
226 * User Defined Conversions is doing way too many calls to do union sets that are not needed
228 * Add test case for destructors
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).
235 * Dropping TypeContainer as an argument to EmitContext
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).  
241         The only pending problem is that the code that implements Aliases
242         is on TypeContainer, and probably should go in DeclSpace.
244 * Tests
246         Write tests for the various reference conversions.  We have
247         test for all the numeric conversions.
249 * Optimizations: variable allocation.
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.
255 * Add a cache for the various GetArrayMethod operations.
257 * MakeUnionSet Callers
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.
262 * Factor the lookup code for class declarations an interfaces
263   (interface.cs:GetInterfaceByName)
265 RECOMMENDATIONS
266 ---------------
268 * Use of lexer.Location in the parser
270         Currently we do:
272         TOKEN nt TERMINAL nt TERMINAL nt3 {
273                 $$ = new Blah ($2, $4, $6, lexer.Location);
274         }
276         This is bad, because the lexer.Location is for the last item in `nt3'
278         We need to change that to use this pattern:
280         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
281                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
282         }
284         Notice how numbering of the arguments changes as the
285         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.