equal
deleted
inserted
replaced
1857 // This is not a "slow path" call; all memory comes from the call. |
1857 // This is not a "slow path" call; all memory comes from the call. |
1858 set_all_memory_call(call); |
1858 set_all_memory_call(call); |
1859 } |
1859 } |
1860 } |
1860 } |
1861 |
1861 |
|
1862 // Keep track of MergeMems feeding into other MergeMems |
|
1863 static void add_mergemem_users_to_worklist(Unique_Node_List& wl, Node* mem) { |
|
1864 if (!mem->is_MergeMem()) { |
|
1865 return; |
|
1866 } |
|
1867 for (SimpleDUIterator i(mem); i.has_next(); i.next()) { |
|
1868 Node* use = i.get(); |
|
1869 if (use->is_MergeMem()) { |
|
1870 wl.push(use); |
|
1871 } |
|
1872 } |
|
1873 } |
1862 |
1874 |
1863 // Replace the call with the current state of the kit. |
1875 // Replace the call with the current state of the kit. |
1864 void GraphKit::replace_call(CallNode* call, Node* result, bool do_replaced_nodes) { |
1876 void GraphKit::replace_call(CallNode* call, Node* result, bool do_replaced_nodes) { |
1865 JVMState* ejvms = NULL; |
1877 JVMState* ejvms = NULL; |
1866 if (has_exceptions()) { |
1878 if (has_exceptions()) { |
1875 |
1887 |
1876 // Find all the needed outputs of this call |
1888 // Find all the needed outputs of this call |
1877 CallProjections callprojs; |
1889 CallProjections callprojs; |
1878 call->extract_projections(&callprojs, true); |
1890 call->extract_projections(&callprojs, true); |
1879 |
1891 |
|
1892 Unique_Node_List wl; |
1880 Node* init_mem = call->in(TypeFunc::Memory); |
1893 Node* init_mem = call->in(TypeFunc::Memory); |
1881 Node* final_mem = final_state->in(TypeFunc::Memory); |
1894 Node* final_mem = final_state->in(TypeFunc::Memory); |
1882 Node* final_ctl = final_state->in(TypeFunc::Control); |
1895 Node* final_ctl = final_state->in(TypeFunc::Control); |
1883 Node* final_io = final_state->in(TypeFunc::I_O); |
1896 Node* final_io = final_state->in(TypeFunc::I_O); |
1884 |
1897 |
1890 if (final_mem->is_MergeMem()) { |
1903 if (final_mem->is_MergeMem()) { |
1891 // Parser's exits MergeMem was not transformed but may be optimized |
1904 // Parser's exits MergeMem was not transformed but may be optimized |
1892 final_mem = _gvn.transform(final_mem); |
1905 final_mem = _gvn.transform(final_mem); |
1893 } |
1906 } |
1894 C->gvn_replace_by(callprojs.fallthrough_memproj, final_mem); |
1907 C->gvn_replace_by(callprojs.fallthrough_memproj, final_mem); |
|
1908 add_mergemem_users_to_worklist(wl, final_mem); |
1895 } |
1909 } |
1896 if (callprojs.fallthrough_ioproj != NULL) { |
1910 if (callprojs.fallthrough_ioproj != NULL) { |
1897 C->gvn_replace_by(callprojs.fallthrough_ioproj, final_io); |
1911 C->gvn_replace_by(callprojs.fallthrough_ioproj, final_io); |
1898 } |
1912 } |
1899 |
1913 |
1929 if (callprojs.catchall_catchproj != NULL) { |
1943 if (callprojs.catchall_catchproj != NULL) { |
1930 C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control()); |
1944 C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control()); |
1931 ex_ctl = ekit.control(); |
1945 ex_ctl = ekit.control(); |
1932 } |
1946 } |
1933 if (callprojs.catchall_memproj != NULL) { |
1947 if (callprojs.catchall_memproj != NULL) { |
1934 C->gvn_replace_by(callprojs.catchall_memproj, ekit.reset_memory()); |
1948 Node* ex_mem = ekit.reset_memory(); |
|
1949 C->gvn_replace_by(callprojs.catchall_memproj, ex_mem); |
|
1950 add_mergemem_users_to_worklist(wl, ex_mem); |
1935 } |
1951 } |
1936 if (callprojs.catchall_ioproj != NULL) { |
1952 if (callprojs.catchall_ioproj != NULL) { |
1937 C->gvn_replace_by(callprojs.catchall_ioproj, ekit.i_o()); |
1953 C->gvn_replace_by(callprojs.catchall_ioproj, ekit.i_o()); |
1938 } |
1954 } |
1939 |
1955 |
1947 call->disconnect_inputs(NULL, C); |
1963 call->disconnect_inputs(NULL, C); |
1948 C->gvn_replace_by(call, C->top()); |
1964 C->gvn_replace_by(call, C->top()); |
1949 |
1965 |
1950 // Clean up any MergeMems that feed other MergeMems since the |
1966 // Clean up any MergeMems that feed other MergeMems since the |
1951 // optimizer doesn't like that. |
1967 // optimizer doesn't like that. |
1952 if (final_mem->is_MergeMem()) { |
1968 while (wl.size() > 0) { |
1953 Node_List wl; |
1969 _gvn.transform(wl.pop()); |
1954 for (SimpleDUIterator i(final_mem); i.has_next(); i.next()) { |
|
1955 Node* m = i.get(); |
|
1956 if (m->is_MergeMem() && !wl.contains(m)) { |
|
1957 wl.push(m); |
|
1958 } |
|
1959 } |
|
1960 while (wl.size() > 0) { |
|
1961 _gvn.transform(wl.pop()); |
|
1962 } |
|
1963 } |
1970 } |
1964 |
1971 |
1965 if (callprojs.fallthrough_catchproj != NULL && !final_ctl->is_top() && do_replaced_nodes) { |
1972 if (callprojs.fallthrough_catchproj != NULL && !final_ctl->is_top() && do_replaced_nodes) { |
1966 replaced_nodes.apply(C, final_ctl); |
1973 replaced_nodes.apply(C, final_ctl); |
1967 } |
1974 } |