742c14065264b83599968d793199593c2e99ced2
[mono.git] / mcs / mcs / TODO
1 The information on this file is mostly outdated, and its kept here for
2 historical reasons
3
4 Error Reporting:
5 ----------------
6
7         * Make yyerror show a nice syntax error, instead of the current mess.
8
9 Iterators
10 ---------
11
12         * Reset should throw not implemented now.
13
14 Optimization ideas
15 ------------------
16
17         Currently when we build a type cache, it contains private members,
18         internal members, and internal protected members;   We should trim
19         these out, as it shows up on the profile.
20
21         We create too many Arraylists;  When we know the size, we should create
22         an array;
23
24         During parsing we use arraylists to accumulate data, like this:
25
26                 thing:
27                 
28                 thing_list
29                         : thing { $$ =new ArrayList (); $$.Add ($1); }
30                         | thing_list thing { ArrayList a = $1; a.Add ($2); $$ = a; }
31
32         We probably could start using "Pairs" there:
33
34                 thing_list
35                         : thing { $$ = new Pair ($1, null); }
36                         | thing_list thing { Pair p = $1; $$ = new Pair ($2, $1); }
37
38
39 EmitContext.ResolveTypeTree
40 ---------------------------
41
42         We should investigate its usage.  The problem is that by default
43         this will be set when calling FindType, that triggers a more expensive
44         lookup.
45
46         I believe we should pass the current EmitContext (which has this turned off
47         by default) to ResolveType/REsolveTypeExpr and then have the routines that
48         need ResolveType to pass null as the emit context.
49
50 DeclareLocal audit
51 ------------------
52
53         DeclareLocal is used in various statements.  The audit should be done
54         in two steps:
55
56                 * Identify all the declare locals.
57
58                 * Identify its uses.
59
60                 * Find if we can make wrapper functions for all of them.
61
62         Then we can move DeclareLocal into a helper class.
63
64         This is required to fix foreach in iterators.
65
66 Large project:
67 --------------
68
69         Drop FindMembers as our API and instead extract all the data
70         out of a type the first time into our own datastructures, and
71         use that to navigate and search the type instead of the
72         callback based FindMembers.     
73
74         Martin has some some of this work with his TypeHandle code
75         that we could use for this.
76
77 Ideas:
78 ------
79
80         Instead of the hack that *knows* about System.Object not having any children classes,
81         we should just make it simple for a probe to know that there is no need for it.
82
83 Dead Code Elimination bugs:
84 ---------------------------
85
86         I should also resolve all the children expressions in Switch, Fixed, Using.
87
88 Major tasks:
89 ------------
90         Properties and 17.6.3: Finish it.
91
92 readonly variables and ref/out
93         
94 BUGS
95 ----
96
97 * Break/Continue statements
98
99         A finally block should reset the InLoop/LoopBegin/LoopEnd, as
100         they are logically outside the scope of the loop.
101
102 * Break/continue part 2.
103
104         They should transfer control to the finally block if inside a try/catch
105         block.
106
107 * Method Registration and error CS111
108
109         The way we use the method registration to signal 111 is wrong.
110         
111         Method registration should only be used to register methodbuilders,
112         we need an alternate method of checking for duplicates.
113
114 *
115 > // CSC sets beforefieldinit
116 > class X {
117 >   // .cctor will be generated by compiler
118 >   public static readonly object O = new System.Object ();
119 >   public static void Main () {}
120 > }
121
122
123 PENDING TASKS
124 -------------
125
126 * Merge test 89 and test-34
127
128 * Code cleanup
129
130         The information when registering a method in InternalParameters
131         is duplicated, you can always get the types from the InternalParameters
132
133 * Emit modreq for volatiles
134
135         Handle modreq from public apis.
136
137 * Merge tree.cs, rootcontext.cs
138
139 OPTIMIZATIONS
140 -------------
141
142 * User Defined Conversions is doing way too many calls to do union sets that are not needed
143
144 * Add test case for destructors
145
146 * Places that use `Ldelema' are basically places where I will be
147   initializing a value type.  I could apply an optimization to 
148   disable the implicit local temporary from being created (by using
149   the method in New).
150
151 * Dropping TypeContainer as an argument to EmitContext
152
153         My theory is that I can get rid of the TypeBuilder completely from
154         the EmitContext, and have typecasts where it is used (from
155         DeclSpace to where it matters).  
156
157         The only pending problem is that the code that implements Aliases
158         is on TypeContainer, and probably should go in DeclSpace.
159
160 * Tests
161
162         Write tests for the various reference conversions.  We have
163         test for all the numeric conversions.
164
165 * Optimizations: variable allocation.
166
167         When local variables of a type are required, we should request
168         the variable and later release it when we are done, so that
169         the same local variable slot can be reused later on.
170
171 * Add a cache for the various GetArrayMethod operations.
172
173 * MakeUnionSet Callers
174
175         If the types are the same, there is no need to compute the unionset,
176         we can just use the list from one of the types.
177
178 * Factor the lookup code for class declarations an interfaces
179   (interface.cs:GetInterfaceByName)
180
181 RECOMMENDATIONS
182 ---------------
183
184 * Use of lexer.Location in the parser
185
186         Currently we do:
187
188         TOKEN nt TERMINAL nt TERMINAL nt3 {
189                 $$ = new Blah ($2, $4, $6, lexer.Location);
190         }
191
192         This is bad, because the lexer.Location is for the last item in `nt3'
193
194         We need to change that to use this pattern:
195
196         TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
197                 $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
198         }
199
200         Notice how numbering of the arguments changes as the
201         { oob_stack.Push (lexer.Location) } takes a "slot"  in the productions.
202
203