src/share/vm/c1/c1_Optimizer.cpp

Print this page

        

*** 435,449 **** // Because of a static contained within (for the purpose of iteration // over instructions), it is only valid to have one of these active at // a time ! class NullCheckEliminator { private: - static NullCheckEliminator* _static_nce; - static void do_value(Value* vp); - Optimizer* _opt; ValueSet* _visitable_instructions; // Visit each instruction only once per basic block BlockList* _work_list; // Basic blocks to visit --- 435,446 ---- // Because of a static contained within (for the purpose of iteration // over instructions), it is only valid to have one of these active at // a time ! class NullCheckEliminator: public ValueVisitor { private: Optimizer* _opt; ValueSet* _visitable_instructions; // Visit each instruction only once per basic block BlockList* _work_list; // Basic blocks to visit
*** 502,511 **** --- 499,510 ---- IR* ir () { return opt()->ir(); } // Process a graph void iterate(BlockBegin* root); + void visit(Value* f); + // In some situations (like NullCheck(x); getfield(x)) the debug // information from the explicit NullCheck can be used to populate // the getfield, even if the two instructions are in different // scopes; this allows implicit null checks to be used but the // correct exception information to be generated. We must clear the
*** 600,617 **** void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {} void NullCheckVisitor::do_ProfileCall (ProfileCall* x) { nce()->clear_last_explicit_null_check(); } void NullCheckVisitor::do_ProfileCounter (ProfileCounter* x) {} ! NullCheckEliminator* NullCheckEliminator::_static_nce = NULL; ! ! ! void NullCheckEliminator::do_value(Value* p) { assert(*p != NULL, "should not find NULL instructions"); ! if (_static_nce->visitable(*p)) { ! _static_nce->mark_visited(*p); ! (*p)->visit(&_static_nce->_visitor); } } bool NullCheckEliminator::merge_state_for(BlockBegin* block, ValueSet* incoming_state) { ValueSet* state = state_for(block); --- 599,613 ---- void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {} void NullCheckVisitor::do_ProfileCall (ProfileCall* x) { nce()->clear_last_explicit_null_check(); } void NullCheckVisitor::do_ProfileCounter (ProfileCounter* x) {} ! void NullCheckEliminator::visit(Value* p) { assert(*p != NULL, "should not find NULL instructions"); ! if (visitable(*p)) { ! mark_visited(*p); ! (*p)->visit(&_visitor); } } bool NullCheckEliminator::merge_state_for(BlockBegin* block, ValueSet* incoming_state) { ValueSet* state = state_for(block);
*** 635,645 **** } } void NullCheckEliminator::iterate_one(BlockBegin* block) { - _static_nce = this; clear_visitable_state(); // clear out an old explicit null checks set_last_explicit_null_check(NULL); if (PrintNullCheckElimination) { --- 631,640 ----
*** 710,720 **** // visiting instructions which are references in other blocks or // visiting instructions more than once. mark_visitable(instr); if (instr->is_root() || instr->can_trap() || (instr->as_NullCheck() != NULL)) { mark_visited(instr); ! instr->input_values_do(&NullCheckEliminator::do_value); instr->visit(&_visitor); } } // Propagate state to successors if necessary --- 705,715 ---- // visiting instructions which are references in other blocks or // visiting instructions more than once. mark_visitable(instr); if (instr->is_root() || instr->can_trap() || (instr->as_NullCheck() != NULL)) { mark_visited(instr); ! instr->input_values_do(this); instr->visit(&_visitor); } } // Propagate state to successors if necessary