|
|
|
This optimizes "for i in array" as well as "for i in range()"
It goes into the pipeline "ResolveExpressions" after ProcessMethodBodiesWithDuckTyping. The above comment refers to the attached file "OptimizeIterationStatements.cs"
now the iterators run just as fast as C#'s equivalents, while keeping Boo's shiny syntax. Ok, Use this new file, it changes the order the loop expands to.
Before it did which would go on forever if <block> contained a continue statement. Please make sure that all tests currently in the repository pass (I've just added some test cases regarding range runtime behavior).
Another thing, all the files in the boo code base must have the following header: http://svn.boo.codehaus.org/boo/trunk/notice.txt?rev=1775&view=auto Alright, I have done all the tests and everything, and it's all peachy now with the new attachment.
6 test cases are still failing after I apply the patch but I'll be giving a throughout review later after this release.
Thanks! Here's a version that makes it look like other Boo files, e.g. UTF-8 and proper indentation.
Please tell me what tests it failed on. I ran a lot of tests, and didn't have a problem. Alright, the file I attached fixed all the errors coming up from `nant test`
Now, it doesn't support multidimensional arrays (yet). It also doesn't support callables, because it's in a hazy place in between when all the entities are declared, but before the callables are expanded. I plan on making multidimensional arrays work. If one were to have an array of callable types, one would generally not going to be dealing with large arrays that need strict optimization. Here's an updated patch.
When incrementing by step, it now uses add instead of add.ovf. The overflow checking is unnecessary in that case, because the max already exists. Also, when available, it will replace num != end with num < end or num > end. This gives it the same IL as C#'s. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pass
should expand to jump statements that would generate
for (int index = 0; index < 10, index++)
{
}