Question on arithmetic overflow detection support in C2
rednaxelafx at gmail.com
Wed Jun 20 22:04:26 PDT 2012
Got the jo instruction emitted now. Thanks Vladimir!
I added a new FlagsProjNode type that derives from ProjNode, and explicitly
overrides bottom_type() and ideal_reg() to TypeInt::CC and Op_RegFlags,
respectively. That enabled the projection node matching to work.
Current status of the patch is avaiable here:
But there are still some unexpected behavior. I was expecting the Bool(...
[ov]) node to be matched into a cmpOp, and the If node to be matched into a
jmpCon; instead, they're actually matched into the unsigned version. Can't
figure out what was going on yet.
The IR graph of Math.addExact(int, int),
(so far so good)
after matching and GCM:
(oops...got jmpConU instead of the expected jmpCon)
Another problem is that I had to use a fixed register for the "dst" of
checkedAddI_reg and its data result projection. In this case I'm using eax;
but any fixed RegI will do.
The cause is stated before: I don't know how to specify the relationship
between the "dst" of checkedAddI_reg and its data result projection, so as
to make them use the same register.
If I can fix these two problems, then I'll go back and make a full-fledged
intrinsic for Math.addExact(int, int). The way I pattern match the overflow
checking logic wouldn't work when Math.addExact(int, int) is inlined into a
caller with complex control-flow.
On Thu, Jun 21, 2012 at 10:07 AM, Vladimir Kozlov <
vladimir.kozlov at oracle.com> wrote:
> C2 matchs from bottom to top of graph. So first it tries to match If node
> and failed. In second mail I explained that State for Proj node is
> incorrect for your case because ideal_reg() is incorrect:
> s->DFA( m->ideal_reg(), m );
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-compiler-dev