annotate src/share/vm/opto/divnode.hpp @ 17716:cdb71841f4bc

6498581: ThreadInterruptTest3 produces wrong output on Windows Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set. Reviewed-by: acorn, kvn Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author minqi
date Wed, 26 Feb 2014 15:20:41 -0800
parents f95d63e2154a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_OPTO_DIVNODE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_OPTO_DIVNODE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "opto/multnode.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "opto/node.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "opto/opcodes.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "opto/type.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // Portions of code courtesy of Clifford Click
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // Optimization - Graph Style
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 //------------------------------DivINode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // Integer division
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // Note: this is division as defined by JVMS, i.e., MinInt/-1 == MinInt.
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // On processors which don't naturally support this special case (e.g., x86),
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // the matcher or runtime system must take care of this.
a61af66fc99e Initial load
duke
parents:
diff changeset
43 class DivINode : public Node {
a61af66fc99e Initial load
duke
parents:
diff changeset
44 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
45 DivINode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
46 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 virtual Node *Identity( PhaseTransform *phase );
a61af66fc99e Initial load
duke
parents:
diff changeset
48 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
a61af66fc99e Initial load
duke
parents:
diff changeset
49 virtual const Type *Value( PhaseTransform *phase ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 virtual const Type *bottom_type() const { return TypeInt::INT; }
a61af66fc99e Initial load
duke
parents:
diff changeset
51 virtual uint ideal_reg() const { return Op_RegI; }
a61af66fc99e Initial load
duke
parents:
diff changeset
52 };
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 //------------------------------DivLNode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Long division
a61af66fc99e Initial load
duke
parents:
diff changeset
56 class DivLNode : public Node {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
58 DivLNode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
59 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 virtual Node *Identity( PhaseTransform *phase );
a61af66fc99e Initial load
duke
parents:
diff changeset
61 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 virtual const Type *Value( PhaseTransform *phase ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 virtual const Type *bottom_type() const { return TypeLong::LONG; }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 virtual uint ideal_reg() const { return Op_RegL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 };
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 //------------------------------DivFNode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // Float division
a61af66fc99e Initial load
duke
parents:
diff changeset
69 class DivFNode : public Node {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
71 DivFNode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
72 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 virtual Node *Identity( PhaseTransform *phase );
a61af66fc99e Initial load
duke
parents:
diff changeset
74 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 virtual const Type *Value( PhaseTransform *phase ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 virtual const Type *bottom_type() const { return Type::FLOAT; }
a61af66fc99e Initial load
duke
parents:
diff changeset
77 virtual uint ideal_reg() const { return Op_RegF; }
a61af66fc99e Initial load
duke
parents:
diff changeset
78 };
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 //------------------------------DivDNode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // Double division
a61af66fc99e Initial load
duke
parents:
diff changeset
82 class DivDNode : public Node {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
84 DivDNode( Node *c, Node *dividend, Node *divisor ) : Node(c,dividend, divisor) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
85 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
86 virtual Node *Identity( PhaseTransform *phase );
a61af66fc99e Initial load
duke
parents:
diff changeset
87 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 virtual const Type *Value( PhaseTransform *phase ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 virtual const Type *bottom_type() const { return Type::DOUBLE; }
a61af66fc99e Initial load
duke
parents:
diff changeset
90 virtual uint ideal_reg() const { return Op_RegD; }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 };
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 //------------------------------ModINode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // Integer modulus
a61af66fc99e Initial load
duke
parents:
diff changeset
95 class ModINode : public Node {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
97 ModINode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
98 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 virtual const Type *Value( PhaseTransform *phase ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
100 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 virtual const Type *bottom_type() const { return TypeInt::INT; }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 virtual uint ideal_reg() const { return Op_RegI; }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 };
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 //------------------------------ModLNode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Long modulus
a61af66fc99e Initial load
duke
parents:
diff changeset
107 class ModLNode : public Node {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
109 ModLNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
110 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
111 virtual const Type *Value( PhaseTransform *phase ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
112 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
a61af66fc99e Initial load
duke
parents:
diff changeset
113 virtual const Type *bottom_type() const { return TypeLong::LONG; }
a61af66fc99e Initial load
duke
parents:
diff changeset
114 virtual uint ideal_reg() const { return Op_RegL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
115 };
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 //------------------------------ModFNode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // Float Modulus
a61af66fc99e Initial load
duke
parents:
diff changeset
119 class ModFNode : public Node {
a61af66fc99e Initial load
duke
parents:
diff changeset
120 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
121 ModFNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
122 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
123 virtual const Type *Value( PhaseTransform *phase ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 virtual const Type *bottom_type() const { return Type::FLOAT; }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 virtual uint ideal_reg() const { return Op_RegF; }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 };
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 //------------------------------ModDNode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // Double Modulus
a61af66fc99e Initial load
duke
parents:
diff changeset
130 class ModDNode : public Node {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
132 ModDNode( Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
133 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 virtual const Type *Value( PhaseTransform *phase ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
135 virtual const Type *bottom_type() const { return Type::DOUBLE; }
a61af66fc99e Initial load
duke
parents:
diff changeset
136 virtual uint ideal_reg() const { return Op_RegD; }
a61af66fc99e Initial load
duke
parents:
diff changeset
137 };
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 //------------------------------DivModNode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // Division with remainder result.
a61af66fc99e Initial load
duke
parents:
diff changeset
141 class DivModNode : public MultiNode {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
143 DivModNode( Node *c, Node *dividend, Node *divisor );
a61af66fc99e Initial load
duke
parents:
diff changeset
144 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
145 enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
146 div_proj_num = 0, // quotient
a61af66fc99e Initial load
duke
parents:
diff changeset
147 mod_proj_num = 1 // remainder
a61af66fc99e Initial load
duke
parents:
diff changeset
148 };
a61af66fc99e Initial load
duke
parents:
diff changeset
149 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
150 virtual Node *Identity( PhaseTransform *phase ) { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
151 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape) { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
152 virtual const Type *Value( PhaseTransform *phase ) const { return bottom_type(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
153 virtual uint hash() const { return Node::hash(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
154 virtual bool is_CFG() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
155 virtual uint ideal_reg() const { return NotAMachineReg; }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 ProjNode* div_proj() { return proj_out(div_proj_num); }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 ProjNode* mod_proj() { return proj_out(mod_proj_num); }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 };
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161 //------------------------------DivModINode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
162 // Integer division with remainder result.
a61af66fc99e Initial load
duke
parents:
diff changeset
163 class DivModINode : public DivModNode {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
165 DivModINode( Node *c, Node *dividend, Node *divisor ) : DivModNode(c, dividend, divisor) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
166 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
167 virtual const Type *bottom_type() const { return TypeTuple::INT_PAIR; }
a61af66fc99e Initial load
duke
parents:
diff changeset
168 virtual Node *match( const ProjNode *proj, const Matcher *m );
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 // Make a divmod and associated projections from a div or mod.
a61af66fc99e Initial load
duke
parents:
diff changeset
171 static DivModINode* make(Compile* C, Node* div_or_mod);
a61af66fc99e Initial load
duke
parents:
diff changeset
172 };
a61af66fc99e Initial load
duke
parents:
diff changeset
173
a61af66fc99e Initial load
duke
parents:
diff changeset
174 //------------------------------DivModLNode---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
175 // Long division with remainder result.
a61af66fc99e Initial load
duke
parents:
diff changeset
176 class DivModLNode : public DivModNode {
a61af66fc99e Initial load
duke
parents:
diff changeset
177 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
178 DivModLNode( Node *c, Node *dividend, Node *divisor ) : DivModNode(c, dividend, divisor) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
179 virtual int Opcode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
180 virtual const Type *bottom_type() const { return TypeTuple::LONG_PAIR; }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 virtual Node *match( const ProjNode *proj, const Matcher *m );
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 // Make a divmod and associated projections from a div or mod.
a61af66fc99e Initial load
duke
parents:
diff changeset
184 static DivModLNode* make(Compile* C, Node* div_or_mod);
a61af66fc99e Initial load
duke
parents:
diff changeset
185 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
186
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
187 #endif // SHARE_VM_OPTO_DIVNODE_HPP