On Wed, May 26, 2010 at 5:44 PM, Rémi Forax <[email protected]> wrote: > Le 26/05/2010 23:09, Charles Oliver Nutter a écrit : >> Yes, I definitely agree with that. And that's why I've started work >> recently (and one of our committers started work some time ago) to >> build both a better compiler and type-profiled optimizations for >> JRuby. Hopefully we'll start to get some of that in place for JRuby >> 1.6 later this summer, at least to eliminate boxed math in local >> scopes where it can be shown that we're only doing known operations >> against numeric types. That much should be pretty easy. >> >> - Charlie >> >> > > Here is what I'm doing or planned to do: > > I work at loop level and not at method level. > There is several reasons for that: > - loop body can be called often, so body can be hot > - you know the closure at that time and my language > as no real function, all is closures. > - you also know the range of the loop variable > the array size, etc > in your case, you will know if you will have to use bignum or not
Oh yes, for loops we'll certainly be able to reduce it as long as we can see a constant stride and a static starting point. That's not always the case, however. For arbitrary math, however, we can't really do that. We don't know until runtime if 2 ** x will need to overflow, and so we basically have to compile two paths. The automatic overflow into Bignum is a real hassle since we can't represent operations against both long and Bignum in the same code. I'm open to suggestions on that end of things...it's really the only thing preventing us from attempting primitive specialization for Fixnum right now. As far as methods versus loop bodies...yes, I figure we'll probably reserve the right to "outline" any basic block in the code, and in fact the optimized body of a method (+ inlined code) will very likely break down into several static methods calling each other, so that hotspot can choose the hot path for us and so that bytecode size isn't increased too much by inlining. - Charlie -- You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.
