< prev index next >
src/hotspot/share/c1/c1_Optimizer.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 87,97 ****
}
virtual void block_do(BlockBegin* block);
private:
! Value make_ifop(Value x, Instruction::Condition cond, Value y, Value tval, Value fval);
};
void CE_Eliminator::block_do(BlockBegin* block) {
// 1) find conditional expression
// check if block ends with an If
--- 87,98 ----
}
virtual void block_do(BlockBegin* block);
private:
! Value make_ifop(Value x, Instruction::Condition cond, Value y, Value tval, Value fval,
! ValueStack* state_before, bool substituability_check);
};
void CE_Eliminator::block_do(BlockBegin* block) {
// 1) find conditional expression
// check if block ends with an If
*** 197,207 ****
f_value = new Constant(f_const->type());
NOT_PRODUCT(f_value->set_printable_bci(if_->printable_bci()));
cur_end = cur_end->set_next(f_value);
}
! Value result = make_ifop(if_->x(), if_->cond(), if_->y(), t_value, f_value);
assert(result != NULL, "make_ifop must return a non-null instruction");
if (!result->is_linked() && result->can_be_linked()) {
NOT_PRODUCT(result->set_printable_bci(if_->printable_bci()));
cur_end = cur_end->set_next(result);
}
--- 198,209 ----
f_value = new Constant(f_const->type());
NOT_PRODUCT(f_value->set_printable_bci(if_->printable_bci()));
cur_end = cur_end->set_next(f_value);
}
! Value result = make_ifop(if_->x(), if_->cond(), if_->y(), t_value, f_value,
! if_->state_before(), if_->substituability_check());
assert(result != NULL, "make_ifop must return a non-null instruction");
if (!result->is_linked() && result->can_be_linked()) {
NOT_PRODUCT(result->set_printable_bci(if_->printable_bci()));
cur_end = cur_end->set_next(result);
}
*** 249,261 ****
}
_hir->verify();
}
! Value CE_Eliminator::make_ifop(Value x, Instruction::Condition cond, Value y, Value tval, Value fval) {
if (!OptimizeIfOps) {
! return new IfOp(x, cond, y, tval, fval);
}
tval = tval->subst();
fval = fval->subst();
if (tval == fval) {
--- 251,264 ----
}
_hir->verify();
}
! Value CE_Eliminator::make_ifop(Value x, Instruction::Condition cond, Value y, Value tval, Value fval,
! ValueStack* state_before, bool substituability_check) {
if (!OptimizeIfOps) {
! return new IfOp(x, cond, y, tval, fval, state_before, substituability_check);
}
tval = tval->subst();
fval = fval->subst();
if (tval == fval) {
*** 286,296 ****
_ifop_count++;
if (new_tval == new_fval) {
return new_tval;
} else {
! return new IfOp(x_ifop->x(), x_ifop_cond, x_ifop->y(), new_tval, new_fval);
}
}
}
} else {
Constant* x_const = x->as_Constant();
--- 289,299 ----
_ifop_count++;
if (new_tval == new_fval) {
return new_tval;
} else {
! return new IfOp(x_ifop->x(), x_ifop_cond, x_ifop->y(), new_tval, new_fval, state_before, substituability_check);
}
}
}
} else {
Constant* x_const = x->as_Constant();
*** 302,312 ****
return x_compare_res == Constant::cond_true ? tval : fval;
}
}
}
}
! return new IfOp(x, cond, y, tval, fval);
}
void Optimizer::eliminate_conditional_expressions() {
// find conditional expressions & replace them with IfOps
CE_Eliminator ce(ir());
--- 305,315 ----
return x_compare_res == Constant::cond_true ? tval : fval;
}
}
}
}
! return new IfOp(x, cond, y, tval, fval, state_before, substituability_check);
}
void Optimizer::eliminate_conditional_expressions() {
// find conditional expressions & replace them with IfOps
CE_Eliminator ce(ir());
*** 434,444 ****
BlockBegin* tblock = tval->compare(cond, con, tsux, fsux);
BlockBegin* fblock = fval->compare(cond, con, tsux, fsux);
if (tblock != fblock && !if_->is_safepoint()) {
If* newif = new If(ifop->x(), ifop->cond(), false, ifop->y(),
! tblock, fblock, if_->state_before(), if_->is_safepoint());
newif->set_state(if_->state()->copy());
assert(prev->next() == if_, "must be guaranteed by above search");
NOT_PRODUCT(newif->set_printable_bci(if_->printable_bci()));
prev->set_next(newif);
--- 437,447 ----
BlockBegin* tblock = tval->compare(cond, con, tsux, fsux);
BlockBegin* fblock = fval->compare(cond, con, tsux, fsux);
if (tblock != fblock && !if_->is_safepoint()) {
If* newif = new If(ifop->x(), ifop->cond(), false, ifop->y(),
! tblock, fblock, if_->state_before(), if_->is_safepoint(), if_->substituability_check());
newif->set_state(if_->state()->copy());
assert(prev->next() == if_, "must be guaranteed by above search");
NOT_PRODUCT(newif->set_printable_bci(if_->printable_bci()));
prev->set_next(newif);
< prev index next >