Assembly output from JRuby 'fib'
Charles Oliver Nutter
headius at headius.com
Mon May 2 12:55:14 PDT 2011
On Thu, Apr 28, 2011 at 11:18 AM, Rémi Forax <forax at univ-mlv.fr> wrote:
> Do you specialize the overflow check depending on the callsite ?
> for fib(n - 1), you just have to check if n is different from
> Integer.MIN_INT,
> for fib(n - 2), if n is <= to Integer.MIN_INT - 1
> and for + use the double xor tricks.
Here's a related question. Is there a way we can structure the double
xor trick to get Hotspot to intrinsify it as a jc instruction or
similar?
As I posted earlier, we use the "double xor" trick, which I would
expect JVM could recognize as a carry check and do the right thing. Or
perhaps there's an intrinsic somewhere in JVM/JDK we could call?
I did a couple comparisons, and it seems like for math-heavy logic the
current overflow check adds about 10% overhead...much more than I'd
like :(
- Charlie
More information about the mlvm-dev
mailing list