Skip to content

Commit 9f7dc19

Browse files
Saranya Natarajanchhagedorn
authored andcommitted
8353276: C2: simplify PhaseMacroExpand::opt_bits_test
Reviewed-by: chagedorn, thartmann
1 parent 805f1de commit 9f7dc19

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/hotspot/share/opto/macro.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,8 @@ void PhaseMacroExpand::migrate_outs(Node *old, Node *target) {
9393
assert(old->outcnt() == 0, "all uses must be deleted");
9494
}
9595

96-
Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path) {
97-
Node* cmp;
98-
if (mask != 0) {
99-
Node* and_node = transform_later(new AndXNode(word, MakeConX(mask)));
100-
cmp = transform_later(new CmpXNode(and_node, MakeConX(bits)));
101-
} else {
102-
cmp = word;
103-
}
96+
Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word) {
97+
Node* cmp = word;
10498
Node* bol = transform_later(new BoolNode(cmp, BoolTest::ne));
10599
IfNode* iff = new IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN );
106100
transform_later(iff);
@@ -111,13 +105,8 @@ Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node*
111105
// Fast path not-taken, i.e. slow path
112106
Node *slow_taken = transform_later(new IfTrueNode(iff));
113107

114-
if (return_fast_path) {
115-
region->init_req(edge, slow_taken); // Capture slow-control
116-
return fast_taken;
117-
} else {
118108
region->init_req(edge, fast_taken); // Capture fast-control
119109
return slow_taken;
120-
}
121110
}
122111

123112
//--------------------copy_predefined_input_for_runtime_call--------------------
@@ -2220,7 +2209,7 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
22202209
mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
22212210

22222211
// Optimize test; set region slot 2
2223-
slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0);
2212+
slow_path = opt_bits_test(ctrl, region, 2, flock);
22242213
mem_phi->init_req(2, mem);
22252214

22262215
// Make slow path call
@@ -2281,7 +2270,7 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
22812270
FastUnlockNode *funlock = new FastUnlockNode( ctrl, obj, box );
22822271
funlock = transform_later( funlock )->as_FastUnlock();
22832272
// Optimize test; set region slot 2
2284-
Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0);
2273+
Node *slow_path = opt_bits_test(ctrl, region, 2, funlock);
22852274
Node *thread = transform_later(new ThreadLocalNode());
22862275

22872276
CallNode *call = make_slow_call((CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(),

src/hotspot/share/opto/macro.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class PhaseMacroExpand : public Phase {
182182

183183
int replace_input(Node *use, Node *oldref, Node *newref);
184184
void migrate_outs(Node *old, Node *target);
185-
Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
185+
Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word);
186186
void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
187187
CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
188188
const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1,

0 commit comments

Comments
 (0)