Mercurial > hg > truffle
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java @ 11265:ef6915cf1e59
Add illegal stamp
Remove ValueNode.(object|integer)Stamp: use explicit tests/casts
Fix ObjectStamp.join
Introduce ObjectStamp.castTo
Add some tests for ObjectStamp.join
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 08 Aug 2013 18:17:47 +0200 |
parents | 3d309a26d4d5 |
children | 8185c119d731 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.nodes.calc; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5540
diff
changeset
|
25 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5504
diff
changeset
|
26 import com.oracle.graal.api.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
27 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
28 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
29 import com.oracle.graal.nodes.spi.*; |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5540
diff
changeset
|
30 import com.oracle.graal.nodes.type.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 @NodeInfo(shortName = "/") |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
33 public class IntegerDivNode extends FixedBinaryNode implements Canonicalizable, Lowerable, LIRLowerable { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
35 public IntegerDivNode(Kind kind, ValueNode x, ValueNode y) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 super(kind, x, y); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 @Override |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5540
diff
changeset
|
40 public boolean inferStamp() { |
11265 | 41 return updateStamp(StampTool.div(x().stamp(), y().stamp())); |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5540
diff
changeset
|
42 } |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5540
diff
changeset
|
43 |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5540
diff
changeset
|
44 @Override |
4309
4a609a685fa4
changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
4199
diff
changeset
|
45 public ValueNode canonical(CanonicalizerTool tool) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 if (x().isConstant() && y().isConstant()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 long yConst = y().asConstant().asLong(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 if (yConst == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 return this; // this will trap, can not canonicalize |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 } |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
51 if (kind() == Kind.Int) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 return ConstantNode.forInt(x().asConstant().asInt() / (int) yConst, graph()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 } else { |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
54 assert kind() == Kind.Long; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 return ConstantNode.forLong(x().asConstant().asLong() / yConst, graph()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 } else if (y().isConstant()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 long c = y().asConstant().asLong(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 if (c == 1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 return x(); |
5689
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
61 } |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
62 if (c == -1) { |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
63 return graph().unique(new NegateNode(x())); |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
64 } |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
65 long abs = Math.abs(c); |
11265 | 66 if (CodeUtil.isPowerOf2(abs) && x().stamp() instanceof IntegerStamp) { |
5689
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
67 ValueNode dividend = x(); |
11265 | 68 IntegerStamp stampX = (IntegerStamp) x().stamp(); |
5689
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
69 int log2 = CodeUtil.log2(abs); |
6299
1ed726759f65
Add helper methods to IntegerStamp for sign, use them
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5689
diff
changeset
|
70 // no rounding if dividend is positive or if its low bits are always 0 |
1ed726759f65
Add helper methods to IntegerStamp for sign, use them
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5689
diff
changeset
|
71 if (stampX.canBeNegative() || (stampX.mask() & (abs - 1)) != 0) { |
5689
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
72 int bits; |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6328
diff
changeset
|
73 if (kind().getStackKind() == Kind.Int) { |
5689
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
74 bits = 32; |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
75 } else { |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6328
diff
changeset
|
76 assert kind() == Kind.Long; |
5689
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
77 bits = 64; |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
78 } |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
79 RightShiftNode sign = graph().unique(new RightShiftNode(kind(), x(), ConstantNode.forInt(bits - 1, graph()))); |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
80 UnsignedRightShiftNode round = graph().unique(new UnsignedRightShiftNode(kind(), sign, ConstantNode.forInt(bits - log2, graph()))); |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
81 dividend = IntegerArithmeticNode.add(dividend, round); |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
82 } |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
83 RightShiftNode shift = graph().unique(new RightShiftNode(kind(), dividend, ConstantNode.forInt(log2, graph()))); |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
84 if (c < 0) { |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
85 return graph().unique(new NegateNode(shift)); |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
86 } |
1d3df3a16940
Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5657
diff
changeset
|
87 return shift; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
88 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 } |
7378
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
90 |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
91 // Convert the expression ((a - a % b) / b) into (a / b). |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
92 if (x() instanceof IntegerSubNode) { |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
93 IntegerSubNode integerSubNode = (IntegerSubNode) x(); |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
94 if (integerSubNode.y() instanceof IntegerRemNode) { |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
95 IntegerRemNode integerRemNode = (IntegerRemNode) integerSubNode.y(); |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
96 if (integerSubNode.kind() == this.kind() && integerRemNode.kind() == this.kind() && integerSubNode.x() == integerRemNode.x() && this.y() == integerRemNode.y()) { |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
97 return graph().add(new IntegerDivNode(kind(), integerSubNode.x(), this.y())); |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
98 } |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
99 } |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
100 } |
88506cfc3bab
Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7305
diff
changeset
|
101 |
9449
3d309a26d4d5
Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9251
diff
changeset
|
102 if (next() instanceof IntegerDivNode) { |
3d309a26d4d5
Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9251
diff
changeset
|
103 NodeClass nodeClass = NodeClass.get(this.getClass()); |
3d309a26d4d5
Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9251
diff
changeset
|
104 if (next().getClass() == this.getClass() && nodeClass.inputsEqual(this, next()) && nodeClass.valueEqual(this, next())) { |
3d309a26d4d5
Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9251
diff
changeset
|
105 return next(); |
3d309a26d4d5
Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9251
diff
changeset
|
106 } |
3d309a26d4d5
Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9251
diff
changeset
|
107 } |
3d309a26d4d5
Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9251
diff
changeset
|
108 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 return this; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 @Override |
9251
435bb9425124
added enum to Lowerable interface (before/after guard lowering)
Lukas Stadler <lukas.stadler@jku.at>
parents:
8892
diff
changeset
|
113 public void lower(LoweringTool tool, LoweringType loweringType) { |
7305
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
114 tool.getRuntime().lower(this, tool); |
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
115 } |
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
116 |
cd205ca515dd
Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
117 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 public void generate(LIRGeneratorTool gen) { |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7378
diff
changeset
|
119 gen.setResult(this, gen.emitDiv(gen.operand(x()), gen.operand(y()), this)); |
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7378
diff
changeset
|
120 } |
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7378
diff
changeset
|
121 |
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7378
diff
changeset
|
122 @Override |
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7378
diff
changeset
|
123 public boolean canDeoptimize() { |
11265 | 124 return !(y().stamp() instanceof IntegerStamp) || ((IntegerStamp) y().stamp()).contains(0); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 } |