comparison src/share/vm/opto/macro.cpp @ 708:f2049ae95c3d

6711117: Assertion in 64bit server vm (flat != TypePtr::BOTTOM,"cannot alias-analyze an untyped ptr") Summary: Delay a memory node transformation if its control or address on IGVN worklist. Reviewed-by: never
author kvn
date Tue, 07 Apr 2009 19:04:24 -0700
parents 7bb995fbd3c0
children c96bf21b756f
comparison
equal deleted inserted replaced
707:4ec1257180ec 708:f2049ae95c3d
804 #endif 804 #endif
805 _igvn.replace_node(mem_proj, mem); 805 _igvn.replace_node(mem_proj, mem);
806 } 806 }
807 } else if (use->is_AddP()) { 807 } else if (use->is_AddP()) {
808 // raw memory addresses used only by the initialization 808 // raw memory addresses used only by the initialization
809 _igvn.hash_delete(use); 809 _igvn.replace_node(use, C->top());
810 _igvn.subsume_node(use, C->top());
811 } else { 810 } else {
812 assert(false, "only Initialize or AddP expected"); 811 assert(false, "only Initialize or AddP expected");
813 } 812 }
814 j -= (oc1 - _resproj->outcnt()); 813 j -= (oc1 - _resproj->outcnt());
815 } 814 }
1289 1288
1290 1289
1291 if (_fallthroughcatchproj != NULL) { 1290 if (_fallthroughcatchproj != NULL) {
1292 ctrl = _fallthroughcatchproj->clone(); 1291 ctrl = _fallthroughcatchproj->clone();
1293 transform_later(ctrl); 1292 transform_later(ctrl);
1294 _igvn.hash_delete(_fallthroughcatchproj); 1293 _igvn.replace_node(_fallthroughcatchproj, result_region);
1295 _igvn.subsume_node(_fallthroughcatchproj, result_region);
1296 } else { 1294 } else {
1297 ctrl = top(); 1295 ctrl = top();
1298 } 1296 }
1299 Node *slow_result; 1297 Node *slow_result;
1300 if (_resproj == NULL) { 1298 if (_resproj == NULL) {
1301 // no uses of the allocation result 1299 // no uses of the allocation result
1302 slow_result = top(); 1300 slow_result = top();
1303 } else { 1301 } else {
1304 slow_result = _resproj->clone(); 1302 slow_result = _resproj->clone();
1305 transform_later(slow_result); 1303 transform_later(slow_result);
1306 _igvn.hash_delete(_resproj); 1304 _igvn.replace_node(_resproj, result_phi_rawoop);
1307 _igvn.subsume_node(_resproj, result_phi_rawoop);
1308 } 1305 }
1309 1306
1310 // Plug slow-path into result merge point 1307 // Plug slow-path into result merge point
1311 result_region ->init_req( slow_result_path, ctrl ); 1308 result_region ->init_req( slow_result_path, ctrl );
1312 result_phi_rawoop->init_req( slow_result_path, slow_result); 1309 result_phi_rawoop->init_req( slow_result_path, slow_result);
1611 // Seach for MemBarAcquire node and delete it also. 1608 // Seach for MemBarAcquire node and delete it also.
1612 MemBarNode* membar = fallthroughproj->unique_ctrl_out()->as_MemBar(); 1609 MemBarNode* membar = fallthroughproj->unique_ctrl_out()->as_MemBar();
1613 assert(membar != NULL && membar->Opcode() == Op_MemBarAcquire, ""); 1610 assert(membar != NULL && membar->Opcode() == Op_MemBarAcquire, "");
1614 Node* ctrlproj = membar->proj_out(TypeFunc::Control); 1611 Node* ctrlproj = membar->proj_out(TypeFunc::Control);
1615 Node* memproj = membar->proj_out(TypeFunc::Memory); 1612 Node* memproj = membar->proj_out(TypeFunc::Memory);
1616 _igvn.hash_delete(ctrlproj); 1613 _igvn.replace_node(ctrlproj, fallthroughproj);
1617 _igvn.subsume_node(ctrlproj, fallthroughproj); 1614 _igvn.replace_node(memproj, memproj_fallthrough);
1618 _igvn.hash_delete(memproj);
1619 _igvn.subsume_node(memproj, memproj_fallthrough);
1620 1615
1621 // Delete FastLock node also if this Lock node is unique user 1616 // Delete FastLock node also if this Lock node is unique user
1622 // (a loop peeling may clone a Lock node). 1617 // (a loop peeling may clone a Lock node).
1623 Node* flock = alock->as_Lock()->fastlock_node(); 1618 Node* flock = alock->as_Lock()->fastlock_node();
1624 if (flock->outcnt() == 1) { 1619 if (flock->outcnt() == 1) {
1625 assert(flock->unique_out() == alock, "sanity"); 1620 assert(flock->unique_out() == alock, "sanity");
1626 _igvn.hash_delete(flock); 1621 _igvn.replace_node(flock, top());
1627 _igvn.subsume_node(flock, top());
1628 } 1622 }
1629 } 1623 }
1630 1624
1631 // Seach for MemBarRelease node and delete it also. 1625 // Seach for MemBarRelease node and delete it also.
1632 if (alock->is_Unlock() && ctrl != NULL && ctrl->is_Proj() && 1626 if (alock->is_Unlock() && ctrl != NULL && ctrl->is_Proj() &&
1633 ctrl->in(0)->is_MemBar()) { 1627 ctrl->in(0)->is_MemBar()) {
1634 MemBarNode* membar = ctrl->in(0)->as_MemBar(); 1628 MemBarNode* membar = ctrl->in(0)->as_MemBar();
1635 assert(membar->Opcode() == Op_MemBarRelease && 1629 assert(membar->Opcode() == Op_MemBarRelease &&
1636 mem->is_Proj() && membar == mem->in(0), ""); 1630 mem->is_Proj() && membar == mem->in(0), "");
1637 _igvn.hash_delete(fallthroughproj); 1631 _igvn.replace_node(fallthroughproj, ctrl);
1638 _igvn.subsume_node(fallthroughproj, ctrl); 1632 _igvn.replace_node(memproj_fallthrough, mem);
1639 _igvn.hash_delete(memproj_fallthrough);
1640 _igvn.subsume_node(memproj_fallthrough, mem);
1641 fallthroughproj = ctrl; 1633 fallthroughproj = ctrl;
1642 memproj_fallthrough = mem; 1634 memproj_fallthrough = mem;
1643 ctrl = membar->in(TypeFunc::Control); 1635 ctrl = membar->in(TypeFunc::Control);
1644 mem = membar->in(TypeFunc::Memory); 1636 mem = membar->in(TypeFunc::Memory);
1645 } 1637 }
1646 1638
1647 _igvn.hash_delete(fallthroughproj); 1639 _igvn.replace_node(fallthroughproj, ctrl);
1648 _igvn.subsume_node(fallthroughproj, ctrl); 1640 _igvn.replace_node(memproj_fallthrough, mem);
1649 _igvn.hash_delete(memproj_fallthrough);
1650 _igvn.subsume_node(memproj_fallthrough, mem);
1651 return true; 1641 return true;
1652 } 1642 }
1653 1643
1654 1644
1655 //------------------------------expand_lock_node---------------------- 1645 //------------------------------expand_lock_node----------------------
1877 _igvn.hash_delete(_fallthroughproj); 1867 _igvn.hash_delete(_fallthroughproj);
1878 _fallthroughproj->disconnect_inputs(NULL); 1868 _fallthroughproj->disconnect_inputs(NULL);
1879 region->init_req(1, slow_ctrl); 1869 region->init_req(1, slow_ctrl);
1880 // region inputs are now complete 1870 // region inputs are now complete
1881 transform_later(region); 1871 transform_later(region);
1882 _igvn.subsume_node(_fallthroughproj, region); 1872 _igvn.replace_node(_fallthroughproj, region);
1883 1873
1884 Node *memproj = transform_later( new(C, 1) ProjNode(call, TypeFunc::Memory) ); 1874 Node *memproj = transform_later( new(C, 1) ProjNode(call, TypeFunc::Memory) );
1885 mem_phi->init_req(1, memproj ); 1875 mem_phi->init_req(1, memproj );
1886 transform_later(mem_phi); 1876 transform_later(mem_phi);
1887 _igvn.hash_delete(_memproj_fallthrough); 1877 _igvn.replace_node(_memproj_fallthrough, mem_phi);
1888 _igvn.subsume_node(_memproj_fallthrough, mem_phi);
1889 } 1878 }
1890 1879
1891 //------------------------------expand_unlock_node---------------------- 1880 //------------------------------expand_unlock_node----------------------
1892 void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) { 1881 void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
1893 1882
1941 _igvn.hash_delete(_fallthroughproj); 1930 _igvn.hash_delete(_fallthroughproj);
1942 _fallthroughproj->disconnect_inputs(NULL); 1931 _fallthroughproj->disconnect_inputs(NULL);
1943 region->init_req(1, slow_ctrl); 1932 region->init_req(1, slow_ctrl);
1944 // region inputs are now complete 1933 // region inputs are now complete
1945 transform_later(region); 1934 transform_later(region);
1946 _igvn.subsume_node(_fallthroughproj, region); 1935 _igvn.replace_node(_fallthroughproj, region);
1947 1936
1948 Node *memproj = transform_later( new(C, 1) ProjNode(call, TypeFunc::Memory) ); 1937 Node *memproj = transform_later( new(C, 1) ProjNode(call, TypeFunc::Memory) );
1949 mem_phi->init_req(1, memproj ); 1938 mem_phi->init_req(1, memproj );
1950 mem_phi->init_req(2, mem); 1939 mem_phi->init_req(2, mem);
1951 transform_later(mem_phi); 1940 transform_later(mem_phi);
1952 _igvn.hash_delete(_memproj_fallthrough); 1941 _igvn.replace_node(_memproj_fallthrough, mem_phi);
1953 _igvn.subsume_node(_memproj_fallthrough, mem_phi);
1954 } 1942 }
1955 1943
1956 //------------------------------expand_macro_nodes---------------------- 1944 //------------------------------expand_macro_nodes----------------------
1957 // Returns true if a failure occurred. 1945 // Returns true if a failure occurred.
1958 bool PhaseMacroExpand::expand_macro_nodes() { 1946 bool PhaseMacroExpand::expand_macro_nodes() {
1967 bool success = false; 1955 bool success = false;
1968 debug_only(int old_macro_count = C->macro_count();); 1956 debug_only(int old_macro_count = C->macro_count(););
1969 if (n->is_AbstractLock()) { 1957 if (n->is_AbstractLock()) {
1970 success = eliminate_locking_node(n->as_AbstractLock()); 1958 success = eliminate_locking_node(n->as_AbstractLock());
1971 } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) { 1959 } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) {
1972 _igvn.add_users_to_worklist(n); 1960 _igvn.replace_node(n, n->in(1));
1973 _igvn.hash_delete(n);
1974 _igvn.subsume_node(n, n->in(1));
1975 success = true; 1961 success = true;
1976 } 1962 }
1977 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count"); 1963 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
1978 progress = progress || success; 1964 progress = progress || success;
1979 } 1965 }