< prev index next >

src/share/vm/opto/graphKit.cpp

Print this page
rev 5783 : 8024069: replace_in_map() should operate on parent maps
Summary: type information gets lost because replace_in_map() doesn't update parent maps
Reviewed-by: kvn, twisti
rev 5784 : 8026796: Make replace_in_map() on parent maps generic
Summary: propagate node replacements along control flow edges to callers
Reviewed-by: kvn, vlivanov

*** 425,434 **** --- 425,435 ---- _gvn.set_type(phi, dsttype); } } } } + phi_map->merge_replaced_nodes_with(ex_map); } //--------------------------use_exception_state-------------------------------- Node* GraphKit::use_exception_state(SafePointNode* phi_map) { if (failing()) { stop(); return top(); }
*** 1382,1402 **** } //--------------------------replace_in_map------------------------------------- void GraphKit::replace_in_map(Node* old, Node* neww) { ! this->map()->replace_edge(old, neww); // Note: This operation potentially replaces any edge // on the map. This includes locals, stack, and monitors // of the current (innermost) JVM state. ! // We can consider replacing in caller maps. ! // The idea would be that an inlined function's null checks ! // can be shared with the entire inlining tree. ! // The expense of doing this is that the PreserveJVMState class ! // would have to preserve caller states too, with a deep copy. } //============================================================================= //--------------------------------memory--------------------------------------- --- 1383,1413 ---- } //--------------------------replace_in_map------------------------------------- void GraphKit::replace_in_map(Node* old, Node* neww) { ! if (old == neww) { ! return; ! } ! ! map()->replace_edge(old, neww); // Note: This operation potentially replaces any edge // on the map. This includes locals, stack, and monitors // of the current (innermost) JVM state. ! // don't let inconsistent types from profiling escape this ! // method ! ! const Type* told = _gvn.type(old); ! const Type* tnew = _gvn.type(neww); ! ! if (!tnew->higher_equal(told)) { ! return; ! } ! ! map()->record_replaced_node(old, neww); } //============================================================================= //--------------------------------memory---------------------------------------
*** 1772,1787 **** } } // Replace the call with the current state of the kit. ! void GraphKit::replace_call(CallNode* call, Node* result) { JVMState* ejvms = NULL; if (has_exceptions()) { ejvms = transfer_exceptions_into_jvms(); } SafePointNode* final_state = stop(); // Find all the needed outputs of this call CallProjections callprojs; call->extract_projections(&callprojs, true); --- 1783,1802 ---- } } // Replace the call with the current state of the kit. ! void GraphKit::replace_call(CallNode* call, Node* result, bool do_replaced_nodes) { JVMState* ejvms = NULL; if (has_exceptions()) { ejvms = transfer_exceptions_into_jvms(); } + ReplacedNodes replaced_nodes = map()->replaced_nodes(); + ReplacedNodes replaced_nodes_exception; + Node* ex_ctl = top(); + SafePointNode* final_state = stop(); // Find all the needed outputs of this call CallProjections callprojs; call->extract_projections(&callprojs, true);
*** 1794,1803 **** --- 1809,1822 ---- // Replace all the old call edges with the edges from the inlining result if (callprojs.fallthrough_catchproj != NULL) { C->gvn_replace_by(callprojs.fallthrough_catchproj, final_ctl); } if (callprojs.fallthrough_memproj != NULL) { + if (final_mem->is_MergeMem()) { + // Parser's exits MergeMem was not transformed but may be optimized + final_mem = _gvn.transform(final_mem); + } C->gvn_replace_by(callprojs.fallthrough_memproj, final_mem); } if (callprojs.fallthrough_ioproj != NULL) { C->gvn_replace_by(callprojs.fallthrough_ioproj, final_io); }
*** 1825,1838 **** --- 1844,1860 ---- } else { GraphKit ekit(ejvms); // Load my combined exception state into the kit, with all phis transformed: SafePointNode* ex_map = ekit.combine_and_pop_all_exception_states(); + replaced_nodes_exception = ex_map->replaced_nodes(); Node* ex_oop = ekit.use_exception_state(ex_map); + if (callprojs.catchall_catchproj != NULL) { C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control()); + ex_ctl = ekit.control(); } if (callprojs.catchall_memproj != NULL) { C->gvn_replace_by(callprojs.catchall_memproj, ekit.reset_memory()); } if (callprojs.catchall_ioproj != NULL) {
*** 1861,1870 **** --- 1883,1899 ---- } while (wl.size() > 0) { _gvn.transform(wl.pop()); } } + + if (callprojs.fallthrough_catchproj != NULL && !final_ctl->is_top() && do_replaced_nodes) { + replaced_nodes.apply(C, final_ctl); + } + if (!ex_ctl->is_top() && do_replaced_nodes) { + replaced_nodes_exception.apply(C, ex_ctl); + } } //------------------------------increment_counter------------------------------ // for statistics: increment a VM counter by 1
< prev index next >