RFR(M): 8027754: Enable loop optimizations for loops with MathExact inside (original) (raw)

Igor Veresov igor.veresov at oracle.com
Thu Jan 23 15:54:28 PST 2014


Nice!

In library_call.cpp:

Could the LibaryCallKit::inline_math*() family of functions be factored with templates to shave a few lines? There is quite a lot of common code. I think the overflow idiom insertion can be something like:

template<typename OperationNodeType, template OverflowNodeType> void LibraryCallKit::inline_overflow(Node* arg1, Node* arg2) { Node* op = _gvn.transform(new(C) OperationNodeType(arg1, arg2)); Node* of = _gvn.transform(new(C) OverflowNodeType(arg1, arg2)); inline_math_mathExact(op, of); }

In mathexactnode.cpp: You’ve already commoned many things up by introducing OverflowINode and OverflowLNode in hierarchy. But it feels like some of the code there could factored up as well using template helpers. In many cases the code looks exactly the same for ints and longs, differing only in some types.

igor

On Jan 23, 2014, at 3:27 AM, Rickard Bäckman <rickard.backman at oracle.com> wrote:

Hi all,

this change is going to 9 (and backporting to 8u20). Can I please have this change reviewed? The implementation of different j.l.Math.mathExact() didn't work very well with different optimizations because there was one node that generated both control and data. This change has a new implementation where each call to j.l.Math.mathExact() generates a Overflow node and a normal math operation node (in the integer add example: OverflowAddINode and a AddINode). The Overflow node is responsible for generating control. In the end we generate assembly like: mov rdx, rdi add rdx, rsi ... mov rax, rdi add rax, rsi jo With one add instruction for the data and one for flags. Future improvements could be to try to match the Overflow and the math operation and remove one of them. Bug: https://bugs.openjdk.java.net/browse/JDK-8027754 Webrev: http://cr.openjdk.java.net/~rbackman/8027754/ Thanks /R

-------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140123/3689b0b1/attachment.html



More information about the hotspot-compiler-dev mailing list