Can someone (DarxKies?) check that?
Am I missing something (specific order in 'list' for example?) or was
ReversePostorder() doing a very complicated and useless recursive tree
traversal indexing all reachable blocks? This patch does exactly that
without recursion and on only one list. All tests pass.
Compile time down by 2 seconds (21->19), memory usage *extremely*
lower - aot stopped swaping out at all now - for the first time it can
run along with firefox and MD completely in memory.
Index: AOT/Core/IR/Method.cs
===================================================================
--- AOT/Core/IR/Method.cs (wersja 953)
+++ AOT/Core/IR/Method.cs (kopia robocza)
@@ -757,50 +757,20 @@
private List<Block> ReversePostorder ()
{
List<Block> list = new List<Block> ();
- List<Block> visited = new List<Block> ();
- List<Block> active = new List<Block> ();
- visited.Add (this.blocks [0]);
- list.Add (this.blocks [0]);
+ list.Add (this.blocks[0]);
- ReversePostorder (visited, active, list, this.blocks [0]);
+ for (int i = 0; i < list.Count; i++) {
+ List<Block> outs = list[i].Outs;
+ for (int o = 0; o < outs.Count; o++)
+ if (!list.Contains (outs [o]))
+ list.Add (outs [o]);
+ }
return list;
}
/// <summary>
- /// Reverses the postorder.
- /// </summary>
- /// <param name="visited">The visited.</param>
- /// <param name="active">The active.</param>
- /// <param name="list">The list.</param>
- /// <param name="current">The current.</param>
- private void ReversePostorder (List<Block> visited, List<Block> active, List<Block> list, Block current)
- {
- if (this.blocks.Count == list.Count)
- return;
-
- if (active.Contains (current))
- return;
-
- active.Add (current);
-
- for (int i = 0; i < current.Outs.Count; i++) {
- if (!visited.Contains (current.Outs [i])) {
- visited.Add (current.Outs [i]);
- list.Add (current.Outs [i]);
- }
- }
-
- for (int i = 0; i < current.Outs.Count; i++)
- ReversePostorder (visited, active, list, current.Outs [i]);
-
- active.Remove (current);
-
- return;
- }
-
- /// <summary>
/// Computes the block dominators.
/// </summary>
private void Dominators ()
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
SharpOS-Developers mailing list
SharpOS-Developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sharpos-developers