Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/memnode.cpp @ 4815:53a127075045
7131302: connode.cpp:205 Error: ShouldNotReachHere()
Summary: Add Value() methods to short and byte Load nodes to truncate constants which does not fit.
Reviewed-by: jrose
author | kvn |
---|---|
date | Fri, 20 Jan 2012 09:43:06 -0800 |
parents | 35acf8f0a2e4 |
children | 52474ec73861 |
comparison
equal
deleted
inserted
replaced
4810:50d9b7a0072c | 4815:53a127075045 |
---|---|
1716 // (Also allow a variable load from a fresh array to produce zero.) | 1716 // (Also allow a variable load from a fresh array to produce zero.) |
1717 const TypeOopPtr *tinst = tp->isa_oopptr(); | 1717 const TypeOopPtr *tinst = tp->isa_oopptr(); |
1718 bool is_instance = (tinst != NULL) && tinst->is_known_instance_field(); | 1718 bool is_instance = (tinst != NULL) && tinst->is_known_instance_field(); |
1719 if (ReduceFieldZeroing || is_instance) { | 1719 if (ReduceFieldZeroing || is_instance) { |
1720 Node* value = can_see_stored_value(mem,phase); | 1720 Node* value = can_see_stored_value(mem,phase); |
1721 if (value != NULL && value->is_Con()) | 1721 if (value != NULL && value->is_Con()) { |
1722 assert(value->bottom_type()->higher_equal(_type),"sanity"); | |
1722 return value->bottom_type(); | 1723 return value->bottom_type(); |
1724 } | |
1723 } | 1725 } |
1724 | 1726 |
1725 if (is_instance) { | 1727 if (is_instance) { |
1726 // If we have an instance type and our memory input is the | 1728 // If we have an instance type and our memory input is the |
1727 // programs's initial memory state, there is no matching store, | 1729 // programs's initial memory state, there is no matching store, |
1757 } | 1759 } |
1758 // Identity call will handle the case where truncation is not needed. | 1760 // Identity call will handle the case where truncation is not needed. |
1759 return LoadNode::Ideal(phase, can_reshape); | 1761 return LoadNode::Ideal(phase, can_reshape); |
1760 } | 1762 } |
1761 | 1763 |
1764 const Type* LoadBNode::Value(PhaseTransform *phase) const { | |
1765 Node* mem = in(MemNode::Memory); | |
1766 Node* value = can_see_stored_value(mem,phase); | |
1767 if (value != NULL && value->is_Con()) { | |
1768 // If the input to the store does not fit with the load's result type, | |
1769 // it must be truncated. We can't delay until Ideal call since | |
1770 // a singleton Value is needed for split_thru_phi optimization. | |
1771 int con = value->get_int(); | |
1772 return TypeInt::make((con << 24) >> 24); | |
1773 } | |
1774 return LoadNode::Value(phase); | |
1775 } | |
1776 | |
1762 //--------------------------LoadUBNode::Ideal------------------------------------- | 1777 //--------------------------LoadUBNode::Ideal------------------------------------- |
1763 // | 1778 // |
1764 // If the previous store is to the same address as this load, | 1779 // If the previous store is to the same address as this load, |
1765 // and the value stored was larger than a byte, replace this load | 1780 // and the value stored was larger than a byte, replace this load |
1766 // with the value stored truncated to a byte. If no truncation is | 1781 // with the value stored truncated to a byte. If no truncation is |
1773 return new (phase->C, 3) AndINode(value, phase->intcon(0xFF)); | 1788 return new (phase->C, 3) AndINode(value, phase->intcon(0xFF)); |
1774 // Identity call will handle the case where truncation is not needed. | 1789 // Identity call will handle the case where truncation is not needed. |
1775 return LoadNode::Ideal(phase, can_reshape); | 1790 return LoadNode::Ideal(phase, can_reshape); |
1776 } | 1791 } |
1777 | 1792 |
1793 const Type* LoadUBNode::Value(PhaseTransform *phase) const { | |
1794 Node* mem = in(MemNode::Memory); | |
1795 Node* value = can_see_stored_value(mem,phase); | |
1796 if (value != NULL && value->is_Con()) { | |
1797 // If the input to the store does not fit with the load's result type, | |
1798 // it must be truncated. We can't delay until Ideal call since | |
1799 // a singleton Value is needed for split_thru_phi optimization. | |
1800 int con = value->get_int(); | |
1801 return TypeInt::make(con & 0xFF); | |
1802 } | |
1803 return LoadNode::Value(phase); | |
1804 } | |
1805 | |
1778 //--------------------------LoadUSNode::Ideal------------------------------------- | 1806 //--------------------------LoadUSNode::Ideal------------------------------------- |
1779 // | 1807 // |
1780 // If the previous store is to the same address as this load, | 1808 // If the previous store is to the same address as this load, |
1781 // and the value stored was larger than a char, replace this load | 1809 // and the value stored was larger than a char, replace this load |
1782 // with the value stored truncated to a char. If no truncation is | 1810 // with the value stored truncated to a char. If no truncation is |
1789 return new (phase->C, 3) AndINode(value,phase->intcon(0xFFFF)); | 1817 return new (phase->C, 3) AndINode(value,phase->intcon(0xFFFF)); |
1790 // Identity call will handle the case where truncation is not needed. | 1818 // Identity call will handle the case where truncation is not needed. |
1791 return LoadNode::Ideal(phase, can_reshape); | 1819 return LoadNode::Ideal(phase, can_reshape); |
1792 } | 1820 } |
1793 | 1821 |
1822 const Type* LoadUSNode::Value(PhaseTransform *phase) const { | |
1823 Node* mem = in(MemNode::Memory); | |
1824 Node* value = can_see_stored_value(mem,phase); | |
1825 if (value != NULL && value->is_Con()) { | |
1826 // If the input to the store does not fit with the load's result type, | |
1827 // it must be truncated. We can't delay until Ideal call since | |
1828 // a singleton Value is needed for split_thru_phi optimization. | |
1829 int con = value->get_int(); | |
1830 return TypeInt::make(con & 0xFFFF); | |
1831 } | |
1832 return LoadNode::Value(phase); | |
1833 } | |
1834 | |
1794 //--------------------------LoadSNode::Ideal-------------------------------------- | 1835 //--------------------------LoadSNode::Ideal-------------------------------------- |
1795 // | 1836 // |
1796 // If the previous store is to the same address as this load, | 1837 // If the previous store is to the same address as this load, |
1797 // and the value stored was larger than a short, replace this load | 1838 // and the value stored was larger than a short, replace this load |
1798 // with the value stored truncated to a short. If no truncation is | 1839 // with the value stored truncated to a short. If no truncation is |
1805 Node *result = phase->transform( new (phase->C, 3) LShiftINode(value, phase->intcon(16)) ); | 1846 Node *result = phase->transform( new (phase->C, 3) LShiftINode(value, phase->intcon(16)) ); |
1806 return new (phase->C, 3) RShiftINode(result, phase->intcon(16)); | 1847 return new (phase->C, 3) RShiftINode(result, phase->intcon(16)); |
1807 } | 1848 } |
1808 // Identity call will handle the case where truncation is not needed. | 1849 // Identity call will handle the case where truncation is not needed. |
1809 return LoadNode::Ideal(phase, can_reshape); | 1850 return LoadNode::Ideal(phase, can_reshape); |
1851 } | |
1852 | |
1853 const Type* LoadSNode::Value(PhaseTransform *phase) const { | |
1854 Node* mem = in(MemNode::Memory); | |
1855 Node* value = can_see_stored_value(mem,phase); | |
1856 if (value != NULL && value->is_Con()) { | |
1857 // If the input to the store does not fit with the load's result type, | |
1858 // it must be truncated. We can't delay until Ideal call since | |
1859 // a singleton Value is needed for split_thru_phi optimization. | |
1860 int con = value->get_int(); | |
1861 return TypeInt::make((con << 16) >> 16); | |
1862 } | |
1863 return LoadNode::Value(phase); | |
1810 } | 1864 } |
1811 | 1865 |
1812 //============================================================================= | 1866 //============================================================================= |
1813 //----------------------------LoadKlassNode::make------------------------------ | 1867 //----------------------------LoadKlassNode::make------------------------------ |
1814 // Polymorphic factory method: | 1868 // Polymorphic factory method: |