(original) (raw)
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);
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@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 <overflow label>
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