2010-05-25 Jb Evain <jbevain@novell.com>
[mcs.git] / mcs / OTODO
blobee2cc56f831247fa04525e117703712f8ad459ee
1 ---- This is a list of old tasks, just here for historical value ----
3 Open question:
4                 Create a toplevel block for anonymous methods?  
6 Anonymous Methods
7 -----------------
9         Plan:
11                 * Resolve anonymous methods before.
12                 * Each time a Local matches, if the mode is `InAnonymous', flag
13                   the VariableInfo for `proxying'.
14                 * During Resolve track the depth required for local variables.
15                 * Before Emit, create proxy classes with proper depth.
16                 * Emit.
18 Notes on memory allocation
19 --------------------------
21         Outdated:
23         A run of the AllocationProfile shows that the compiler allocates roughly
24         30 megabytes of strings.  From those, 20 megabytes come from
25         LookupType.  
27         See the notes on current_container problems below on memory usage.  
29 LookupTypeReflection:
30 ---------------------
32         With something like `System.Object', LookupTypeReflection will be called
33         twice: once to find out that `System' is not a type and once
34         for System.Object.
36         This is required because System.Reflection requires that the type/nested types are
37         not separated by a dot but by a plus sign.
39         A nested class would be My+Class (My being the toplevel, Class the nested one).
41         It is interesting to look at the most called lookups when bootstrapping MCS:
43     647 LTR: ArrayList
44     713 LTR: System.Globalization
45     822 LTR: System.Object+Expression
46     904 LTR: Mono.CSharp.ArrayList
47     976 LTR: System.Runtime.CompilerServices
48     999 LTR: Type
49    1118 LTR: System.Runtime
50    1208 LTR: Mono.CSharp.Type
51    1373 LTR: Mono.Languages
52    1599 LTR: System.Diagnostics
53    2036 LTR: System.Text
54    2302 LTR: System.Reflection.Emit
55    2515 LTR: System.Collections
56    4527 LTR: System.Reflection
57   22273 LTR: Mono.CSharp
58   24245 LTR: System
59   27005 LTR: Mono
61         Analysis:
62                 The top 9 lookups are done for things which are not types.
64                 Mono.CSharp.Type happens to be a common lookup: the class Type
65                 used heavily in the compiler in the default namespace.
67                 RED FLAG:
69                 Then `Type' is looked up alone a lot of the time, this happens
70                 in parameter declarations and am not entirely sure that this is
71                 correct (FindType will pass to LookupInterfaceOrClass a the current_type.FullName,
72                 which for some reason is null!).  This seems to be a problem with a lost
73                 piece of context during FindType.
75                 System.Object is also used a lot as a toplevel class, and we assume it will
76                 have children, we should just shortcut this.
78     A cache:
80         Adding a cache and adding a catch for `System.Object' to flag that it wont be the
81         root of a hierarchy reduced the MCS bootstrap time from 10.22 seconds to 8.90 seconds.
83         This cache is currently enabled with SIMPLE_SPEEDUP in typemanager.cs.  Memory consumption
84         went down from 74 megs to 65 megs with this change.  
86 Major tasks:
87 ------------
89         Pinned and volatile require type modifiers that can not be encoded
90         with Reflection.Emit.
92 * Revisit
94         Primary-expression, as it has now been split into 
95         non-array-creation-expression and array-creation-expression.
96                 
97 * Emit `pinned' for pinned local variables.
99         Both `modreq' and pinned will require special hacks in the compiler.
101 * Make sure that we are pinning the right variable
103 * local_variable_declaration
105         Not sure that this grammar is correct, we might have to
106         resolve this during semantic analysis.
108 * Optimizations
110         In Indexers and Properties, probably support an EmitWithDup
111         That emits the code to call Get and then leaves a this pointer
112         in the stack, so that later a Store can be emitted using that
113         this pointer (consider Property++ or Indexer++)
115 * Use of local temporary in UnaryMutator
117         We should get rid of the Localtemporary there for some cases
119         This turns out to be very complex, at least for the post-version,
120         because this case:
122                 a = i++
124         To produce optimal code, it is necessary for UnaryMutator to know 
125         that it is being assigned to a variable (the way the stack is laid
126         out using dup requires the store to happen inside UnaryMutator).
128 * Interface indexers
130         I have not figured out why the Microsoft version puts an
131         `instance' attribute, and I am not generating this `instance' attribute.
133         Explanation: The reason for the `instance' attribute on
134         indexers is that indexers only apply to instances
136 * Check for Final when overriding, if the parent is Final, then we cant
137   allow an override.
139         Implement base indexer access.
141 current_container/current_namespace and the DeclSpace
142 -----------------------------------------------------
144         We are storing fully qualified names in the DeclSpace instead of the node,
145         this is because `current_namespace' (Namepsace) is not a DeclSpace like
146         `current_container'.
148         The reason for storing the full names today is this:
150         namespace X {
151                 class Y {
152                 }
153         }
155         namespace A {
156                 class Y {
157                 }
158         }
160         The problem is that we only use the namespace stack to track the "prefix"
161         for typecontainers, but they are not typecontainers themselves, so we have
162         to use fully qualified names, because both A.X and A.Y would be entered
163         in the toplevel type container.  If we use the short names, there would be
164         a name clash.
166         To fix this problem, we have to make namespaces DeclSpaces.
168         The full size, contrasted with the size that could be stored is:
169                 corlib:
170                         Size of strings held: 368901
171                         Size of strings short: 147863
173                 System:
174                         Size of strings held: 212677
175                         Size of strings short: 97521
176                 
177                 System.XML:
178                         Size of strings held: 128055
179                         Size of strings short: 35782
180                 
181                 System.Data:
182                         Size of strings held: 117896
183                         Size of strings short: 36153
184                 
185                 System.Web:
186                         Size of strings held: 194527
187                         Size of strings short: 58064
188                 
189                 System.Windows.Forms:
190                         Size of strings held: 220495
191                         Size of strings short: 64923
193         
194 The use of DottedName
195 ---------------------
197         We could probably use a different system to represent names, like this:
199         class Name {
200                 string simplename;
201                 Name parent;
202         }
204         So `System.ComponentModel' becomes:
206                 x: (System, null)
207                 y: (ComponentModel, x)
209         The problem is that we would still need to construct the name to pass to
210         GetType.
212         This has been now implemented, its called "QualifiedIdentifier"
214 TODO:
216         1. Create a "partial" emit context for each TypeContainer..
218         2. EmitContext should be partially constructed.  No IL Generator.
220         interface_type review.
222         parameter_array, line 952: `note: must be a single dimension array type'.  Validate this
224 Instance idea
225 -------------
227         It would be nice to have things that can be "instances" to have an
228         EmitInstance method (this would default to nothing).
230         The idea is to be able to use efficiently the instance data on stack
231         manipulations, as opposed to the current scheme, where we basically have
232         a few special cases.
234         * `yield' is no longer a keyword, it only has special
235           meaning before a return or break keywords.
237         * Study side effects with assign
238         * Study TemporaryStorage/LocalStorage -> Merge/rename