On May 2, 2011, at 9:55 PM, Charles Oliver Nutter wrote: > On Thu, Apr 28, 2011 at 11:18 AM, Rémi Forax <fo...@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 look a little into this and as far as I know there is nothing you could call. I also tried to hack something into the backend and I think that could work. I'm just not sure how many users would trigger that pattern. -- Christian > > 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 > _______________________________________________ > mlvm-dev mailing list > mlvm-dev@openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev