c1_Optimizer.cpp revision 2293
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * This code is free software; you can redistribute it and/or modify it
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * under the terms of the GNU General Public License version 2 only, as
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * published by the Free Software Foundation.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * This code is distributed in the hope that it will be useful, but WITHOUT
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * version 2 for more details (a copy is included in the LICENSE file that
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * accompanied this code).
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * You should have received a copy of the GNU General Public License version
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * 2 along with this work; if not, write to the Free Software Foundation,
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * or visit www.oracle.com if you need additional information or have any
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson * questions.
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson int _cee_count; // the number of CEs successfully eliminated
1cb6af97c6f66f456d4f726ef056e1ebc0f73305wnelson int _ifop_count; // the number of IfOps successfully simplified
_has_substitution = false;
if (_has_substitution) {
Goto* goto_ = new Goto(sux, state_before, if_->is_safepoint() || t_goto->is_safepoint() || f_goto->is_safepoint());
_has_substitution = true;
_cee_count++;
if (PrintCEE) {
tty->print_cr("%d. CEE in B%d (B%d B%d)", cee_count(), block->block_id(), t_block->block_id(), f_block->block_id());
Value CE_Eliminator::make_ifop(Value x, Instruction::Condition cond, Value y, Value tval, Value fval) {
if (!OptimizeIfOps) {
_ifop_count++;
return tval;
x = x->subst();
y = y->subst();
guarantee(t_compare_res != Constant::not_comparable && f_compare_res != Constant::not_comparable, "incomparable constants in IfOp");
_ifop_count++;
return new_tval;
_ifop_count++;
, _merge_count(0)
#ifdef ASSERT
int index;
_merge_count++;
if (PrintBlockElimination) {
if (if_) {
bool swapped = false;
swapped = true;
if (swapped) {
_merge_count++;
if (PrintBlockElimination) {
tty->print_cr("%d. replaced If and IfOp at end of B%d with single If", _merge_count, block->block_id());
class NullCheckEliminator;
NullCheckVisitor() {}
void clear_visitable_state() {
void iterate_all();
void set_state_for (BlockBegin* block, ValueSet* stack) { _block_states[block->block_id()] = stack; }
: NULL); }
return _last_explicit_null_check;
void NullCheckVisitor::do_ArithmeticOp (ArithmeticOp* x) { if (x->can_trap()) nce()->clear_last_explicit_null_check(); }
if (visitable(*p)) {
mark_visited(*p);
return changed;
if (PrintNullCheckElimination) {
if (PrintNullCheckElimination) {
for (i = 0; i < e->number_of_sux(); i++) {
iterate_all();
if (x->is_static()) {
if (PrintNullCheckElimination) {
x->id());
set_put(x);
x->set_needs_null_check(true);
if (PrintNullCheckElimination) {
x->set_needs_null_check(false);
if (PrintNullCheckElimination) {
if (PrintNullCheckElimination) {
x->set_needs_null_check(true);
x->set_needs_null_check(true);
if (PrintNullCheckElimination) {
x->set_needs_null_check(false);
if (PrintNullCheckElimination) {
if (PrintNullCheckElimination) {
x->set_needs_null_check(true);
x->set_needs_null_check(true);
if (PrintNullCheckElimination) {
x->set_needs_null_check(false);
if (PrintNullCheckElimination) {
if (PrintNullCheckElimination) {
x->set_needs_null_check(true);
if (PrintNullCheckElimination) {
x->set_needs_null_check(false);
if (PrintNullCheckElimination) {
x->set_needs_null_check(true);
if (PrintNullCheckElimination) {
x->set_can_trap(false);
x->set_can_trap(true);
if (PrintNullCheckElimination) {
if (!x->has_receiver()) {
if (PrintNullCheckElimination) {
set_put(x);
if (PrintNullCheckElimination) {
set_put(x);
if (PrintNullCheckElimination) {
set_put(x);
if (PrintNullCheckElimination) {
if (PrintNullCheckElimination) {
x->set_needs_null_check(false);
if (PrintNullCheckElimination) {
x->set_needs_null_check(true);
if (!x->has_receiver()) {
for (int i = 0; i < x->number_of_arguments(); i++) {
if (PrintNullCheckElimination) {
x->set_needs_null_check(false);
if (PrintNullCheckElimination) {
x->set_needs_null_check(true);
bool all_non_null = true;
if (x->is_illegal()) {
all_non_null = false;
for (i = 0; i < x->operand_count(); i++) {
all_non_null = false;
if (all_non_null) {
if (PrintNullCheckElimination) {
tty->print_cr("Eliminated Phi %d's null check for phifun because all inputs are non-null", x->id());
x->set_needs_null_check(false);
} else if (set_contains(x)) {
set_remove(x);
if (PrintNullCheckElimination) {
for (int e = b->number_of_exception_handlers(); e-- > 0; ) {
if (PrintNullCheckElimination) {