Re: become:
Bryce Kampjes <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.strongtalk |
|---|---|
| Message-ID | <[email protected]> |
eliotemiranda writes: > --- In [email protected], Gilad Bracha <gilad@...> wrote: > For example, consider the following method > ArrayedCollection methods for clarification > sum > | sum | > sum := 0. > 1 to: self size do: > [:i| > sum := sum + (self at: i)]. > ^sum > > An adaptive optimizer will easily be able to optimize thus: Another possibility is to clone the loop then check if the assumptions are still true in your method re-entry code (1). So long as the compiled code is willing to deal arbitrary changes made when it's not running it shouldn't be too difficult. Dealing with arbitrary changes would require either duplicating the loop and only optimising one version or de-optimising and dropping back to the interpreter. I'm sure I've read a few Self papers on loop cloning based on types, possibly from Chambers. Analysing the loop for the case where execution stays in it is easy. Figuring out that at: is aways sent to the same receiver is easy too by reading the PIC though this does not provide a definitive answer merely a probabilistic one. OK, in your case it's easy to figure out the receiver statically too. Bryce (1) For Exupery adding a few checks to the re-entry to method code does not seem bad as re-entry code needs to copy the stack into registers. So there's already a short sequence required for each entry point. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/strongtalk/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/strongtalk/join (Yahoo! ID required) <*> To change settings via email: mailto:[email protected] mailto:[email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/