752 // sanity check the alias category against the created node type
753 assert(!(adr_type->isa_oopptr() &&
754 adr_type->offset() == oopDesc::klass_offset_in_bytes()),
755 "use LoadKlassNode instead");
756 assert(!(adr_type->isa_aryptr() &&
757 adr_type->offset() == arrayOopDesc::length_offset_in_bytes()),
758 "use LoadRangeNode instead");
759 switch (bt) {
760 case T_BOOLEAN:
761 case T_BYTE: return new (C, 3) LoadBNode(ctl, mem, adr, adr_type, rt->is_int() );
762 case T_INT: return new (C, 3) LoadINode(ctl, mem, adr, adr_type, rt->is_int() );
763 case T_CHAR: return new (C, 3) LoadCNode(ctl, mem, adr, adr_type, rt->is_int() );
764 case T_SHORT: return new (C, 3) LoadSNode(ctl, mem, adr, adr_type, rt->is_int() );
765 case T_LONG: return new (C, 3) LoadLNode(ctl, mem, adr, adr_type, rt->is_long() );
766 case T_FLOAT: return new (C, 3) LoadFNode(ctl, mem, adr, adr_type, rt );
767 case T_DOUBLE: return new (C, 3) LoadDNode(ctl, mem, adr, adr_type, rt );
768 case T_ADDRESS: return new (C, 3) LoadPNode(ctl, mem, adr, adr_type, rt->is_ptr() );
769 case T_OBJECT:
770 #ifdef _LP64
771 if (adr->bottom_type()->is_ptr_to_narrowoop()) {
772 const TypeNarrowOop* narrowtype;
773 if (rt->isa_narrowoop()) {
774 narrowtype = rt->is_narrowoop();
775 } else {
776 narrowtype = rt->is_oopptr()->make_narrowoop();
777 }
778 Node* load = gvn.transform(new (C, 3) LoadNNode(ctl, mem, adr, adr_type, narrowtype));
779
780 return DecodeNNode::decode(&gvn, load);
781 } else
782 #endif
783 {
784 assert(!adr->bottom_type()->is_ptr_to_narrowoop(), "should have got back a narrow oop");
785 return new (C, 3) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr());
786 }
787 }
788 ShouldNotReachHere();
789 return (LoadNode*)NULL;
790 }
791
792 LoadLNode* LoadLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt) {
793 bool require_atomic = true;
794 return new (C, 3) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), require_atomic);
795 }
796
797
798
799
800 //------------------------------hash-------------------------------------------
1614 Node* value = can_see_stored_value(mem,phase);
1615 if( value && !phase->type(value)->higher_equal( _type ) ) {
1616 Node *result = phase->transform( new (phase->C, 3) LShiftINode(value, phase->intcon(16)) );
1617 return new (phase->C, 3) RShiftINode(result, phase->intcon(16));
1618 }
1619 // Identity call will handle the case where truncation is not needed.
1620 return LoadNode::Ideal(phase, can_reshape);
1621 }
1622
1623 //=============================================================================
1624 //----------------------------LoadKlassNode::make------------------------------
1625 // Polymorphic factory method:
1626 Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, const TypeKlassPtr *tk ) {
1627 Compile* C = gvn.C;
1628 Node *ctl = NULL;
1629 // sanity check the alias category against the created node type
1630 const TypeOopPtr *adr_type = adr->bottom_type()->isa_oopptr();
1631 assert(adr_type != NULL, "expecting TypeOopPtr");
1632 #ifdef _LP64
1633 if (adr_type->is_ptr_to_narrowoop()) {
1634 const TypeNarrowOop* narrowtype = tk->is_oopptr()->make_narrowoop();
1635 Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, narrowtype));
1636 return DecodeNNode::decode(&gvn, load_klass);
1637 }
1638 #endif
1639 assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
1640 return new (C, 3) LoadKlassNode(ctl, mem, adr, at, tk);
1641 }
1642
1643 //------------------------------Value------------------------------------------
1644 const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
1645 return klass_value_common(phase);
1646 }
1647
1648 const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const {
1649 // Either input is TOP ==> the result is TOP
1650 const Type *t1 = phase->type( in(MemNode::Memory) );
1651 if (t1 == Type::TOP) return Type::TOP;
1652 Node *adr = in(MemNode::Address);
1653 const Type *t2 = phase->type( adr );
1654 if (t2 == Type::TOP) return Type::TOP;
1655 const TypePtr *tp = t2->is_ptr();
1656 if (TypePtr::above_centerline(tp->ptr()) ||
1826 && adr2->is_AddP()
1827 ) {
1828 int mirror_field = Klass::java_mirror_offset_in_bytes();
1829 if (offset == java_lang_Class::array_klass_offset_in_bytes()) {
1830 mirror_field = in_bytes(arrayKlass::component_mirror_offset());
1831 }
1832 if (tkls->offset() == mirror_field + (int)sizeof(oopDesc)) {
1833 return adr2->in(AddPNode::Base);
1834 }
1835 }
1836 }
1837 }
1838
1839 return this;
1840 }
1841
1842
1843 //------------------------------Value------------------------------------------
1844 const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
1845 const Type *t = klass_value_common(phase);
1846
1847 if (t == TypePtr::NULL_PTR) {
1848 return TypeNarrowOop::NULL_PTR;
1849 }
1850 if (t != Type::TOP && !t->isa_narrowoop()) {
1851 assert(t->is_oopptr(), "sanity");
1852 t = t->is_oopptr()->make_narrowoop();
1853 }
1854 return t;
1855 }
1856
1857 //------------------------------Identity---------------------------------------
1858 // To clean up reflective code, simplify k.java_mirror.as_klass to narrow k.
1859 // Also feed through the klass in Allocate(...klass...)._klass.
1860 Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
1861 Node *x = klass_identity_common(phase);
1862
1863 const Type *t = phase->type( x );
1864 if( t == Type::TOP ) return x;
1865 if( t->isa_narrowoop()) return x;
1866
1867 return EncodePNode::encode(phase, x);
1868 }
1869
1870 //------------------------------Value-----------------------------------------
1871 const Type *LoadRangeNode::Value( PhaseTransform *phase ) const {
1872 // Either input is TOP ==> the result is TOP
1873 const Type *t1 = phase->type( in(MemNode::Memory) );
1874 if( t1 == Type::TOP ) return Type::TOP;
1875 Node *adr = in(MemNode::Address);
1876 const Type *t2 = phase->type( adr );
1877 if( t2 == Type::TOP ) return Type::TOP;
1878 const TypePtr *tp = t2->is_ptr();
1879 if (TypePtr::above_centerline(tp->ptr())) return Type::TOP;
1880 const TypeAryPtr *tap = tp->isa_aryptr();
1881 if( !tap ) return _type;
1882 return tap->size();
1883 }
1884
1885 //------------------------------Identity---------------------------------------
1886 // Feed through the length in AllocateArray(...length...)._length.
1887 Node* LoadRangeNode::Identity( PhaseTransform *phase ) {
1913 //---------------------------StoreNode::make-----------------------------------
1914 // Polymorphic factory method:
1915 StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, BasicType bt ) {
1916 Compile* C = gvn.C;
1917
1918 switch (bt) {
1919 case T_BOOLEAN:
1920 case T_BYTE: return new (C, 4) StoreBNode(ctl, mem, adr, adr_type, val);
1921 case T_INT: return new (C, 4) StoreINode(ctl, mem, adr, adr_type, val);
1922 case T_CHAR:
1923 case T_SHORT: return new (C, 4) StoreCNode(ctl, mem, adr, adr_type, val);
1924 case T_LONG: return new (C, 4) StoreLNode(ctl, mem, adr, adr_type, val);
1925 case T_FLOAT: return new (C, 4) StoreFNode(ctl, mem, adr, adr_type, val);
1926 case T_DOUBLE: return new (C, 4) StoreDNode(ctl, mem, adr, adr_type, val);
1927 case T_ADDRESS:
1928 case T_OBJECT:
1929 #ifdef _LP64
1930 if (adr->bottom_type()->is_ptr_to_narrowoop() ||
1931 (UseCompressedOops && val->bottom_type()->isa_klassptr() &&
1932 adr->bottom_type()->isa_rawptr())) {
1933 const TypePtr* type = val->bottom_type()->is_ptr();
1934 Node* cp = EncodePNode::encode(&gvn, val);
1935 return new (C, 4) StoreNNode(ctl, mem, adr, adr_type, cp);
1936 } else
1937 #endif
1938 {
1939 return new (C, 4) StorePNode(ctl, mem, adr, adr_type, val);
1940 }
1941 }
1942 ShouldNotReachHere();
1943 return (StoreNode*)NULL;
1944 }
1945
1946 StoreLNode* StoreLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val) {
1947 bool require_atomic = true;
1948 return new (C, 4) StoreLNode(ctl, mem, adr, adr_type, val, require_atomic);
1949 }
1950
1951
1952 //--------------------------bottom_type----------------------------------------
1953 const Type *StoreNode::bottom_type() const {
1954 return Type::MEMORY;
1955 }
|
752 // sanity check the alias category against the created node type
753 assert(!(adr_type->isa_oopptr() &&
754 adr_type->offset() == oopDesc::klass_offset_in_bytes()),
755 "use LoadKlassNode instead");
756 assert(!(adr_type->isa_aryptr() &&
757 adr_type->offset() == arrayOopDesc::length_offset_in_bytes()),
758 "use LoadRangeNode instead");
759 switch (bt) {
760 case T_BOOLEAN:
761 case T_BYTE: return new (C, 3) LoadBNode(ctl, mem, adr, adr_type, rt->is_int() );
762 case T_INT: return new (C, 3) LoadINode(ctl, mem, adr, adr_type, rt->is_int() );
763 case T_CHAR: return new (C, 3) LoadCNode(ctl, mem, adr, adr_type, rt->is_int() );
764 case T_SHORT: return new (C, 3) LoadSNode(ctl, mem, adr, adr_type, rt->is_int() );
765 case T_LONG: return new (C, 3) LoadLNode(ctl, mem, adr, adr_type, rt->is_long() );
766 case T_FLOAT: return new (C, 3) LoadFNode(ctl, mem, adr, adr_type, rt );
767 case T_DOUBLE: return new (C, 3) LoadDNode(ctl, mem, adr, adr_type, rt );
768 case T_ADDRESS: return new (C, 3) LoadPNode(ctl, mem, adr, adr_type, rt->is_ptr() );
769 case T_OBJECT:
770 #ifdef _LP64
771 if (adr->bottom_type()->is_ptr_to_narrowoop()) {
772 Node* load = gvn.transform(new (C, 3) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop()));
773 return new (C, 2) DecodeNNode(load, load->bottom_type()->make_ptr());
774 } else
775 #endif
776 {
777 assert(!adr->bottom_type()->is_ptr_to_narrowoop(), "should have got back a narrow oop");
778 return new (C, 3) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr());
779 }
780 }
781 ShouldNotReachHere();
782 return (LoadNode*)NULL;
783 }
784
785 LoadLNode* LoadLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt) {
786 bool require_atomic = true;
787 return new (C, 3) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), require_atomic);
788 }
789
790
791
792
793 //------------------------------hash-------------------------------------------
1607 Node* value = can_see_stored_value(mem,phase);
1608 if( value && !phase->type(value)->higher_equal( _type ) ) {
1609 Node *result = phase->transform( new (phase->C, 3) LShiftINode(value, phase->intcon(16)) );
1610 return new (phase->C, 3) RShiftINode(result, phase->intcon(16));
1611 }
1612 // Identity call will handle the case where truncation is not needed.
1613 return LoadNode::Ideal(phase, can_reshape);
1614 }
1615
1616 //=============================================================================
1617 //----------------------------LoadKlassNode::make------------------------------
1618 // Polymorphic factory method:
1619 Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, const TypeKlassPtr *tk ) {
1620 Compile* C = gvn.C;
1621 Node *ctl = NULL;
1622 // sanity check the alias category against the created node type
1623 const TypeOopPtr *adr_type = adr->bottom_type()->isa_oopptr();
1624 assert(adr_type != NULL, "expecting TypeOopPtr");
1625 #ifdef _LP64
1626 if (adr_type->is_ptr_to_narrowoop()) {
1627 Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop()));
1628 return new (C, 2) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr());
1629 }
1630 #endif
1631 assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
1632 return new (C, 3) LoadKlassNode(ctl, mem, adr, at, tk);
1633 }
1634
1635 //------------------------------Value------------------------------------------
1636 const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
1637 return klass_value_common(phase);
1638 }
1639
1640 const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const {
1641 // Either input is TOP ==> the result is TOP
1642 const Type *t1 = phase->type( in(MemNode::Memory) );
1643 if (t1 == Type::TOP) return Type::TOP;
1644 Node *adr = in(MemNode::Address);
1645 const Type *t2 = phase->type( adr );
1646 if (t2 == Type::TOP) return Type::TOP;
1647 const TypePtr *tp = t2->is_ptr();
1648 if (TypePtr::above_centerline(tp->ptr()) ||
1818 && adr2->is_AddP()
1819 ) {
1820 int mirror_field = Klass::java_mirror_offset_in_bytes();
1821 if (offset == java_lang_Class::array_klass_offset_in_bytes()) {
1822 mirror_field = in_bytes(arrayKlass::component_mirror_offset());
1823 }
1824 if (tkls->offset() == mirror_field + (int)sizeof(oopDesc)) {
1825 return adr2->in(AddPNode::Base);
1826 }
1827 }
1828 }
1829 }
1830
1831 return this;
1832 }
1833
1834
1835 //------------------------------Value------------------------------------------
1836 const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
1837 const Type *t = klass_value_common(phase);
1838 if (t == Type::TOP)
1839 return t;
1840
1841 return t->make_narrowoop();
1842 }
1843
1844 //------------------------------Identity---------------------------------------
1845 // To clean up reflective code, simplify k.java_mirror.as_klass to narrow k.
1846 // Also feed through the klass in Allocate(...klass...)._klass.
1847 Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
1848 Node *x = klass_identity_common(phase);
1849
1850 const Type *t = phase->type( x );
1851 if( t == Type::TOP ) return x;
1852 if( t->isa_narrowoop()) return x;
1853
1854 return phase->transform(new (phase->C, 2) EncodePNode(x, t->make_narrowoop()));
1855 }
1856
1857 //------------------------------Value-----------------------------------------
1858 const Type *LoadRangeNode::Value( PhaseTransform *phase ) const {
1859 // Either input is TOP ==> the result is TOP
1860 const Type *t1 = phase->type( in(MemNode::Memory) );
1861 if( t1 == Type::TOP ) return Type::TOP;
1862 Node *adr = in(MemNode::Address);
1863 const Type *t2 = phase->type( adr );
1864 if( t2 == Type::TOP ) return Type::TOP;
1865 const TypePtr *tp = t2->is_ptr();
1866 if (TypePtr::above_centerline(tp->ptr())) return Type::TOP;
1867 const TypeAryPtr *tap = tp->isa_aryptr();
1868 if( !tap ) return _type;
1869 return tap->size();
1870 }
1871
1872 //------------------------------Identity---------------------------------------
1873 // Feed through the length in AllocateArray(...length...)._length.
1874 Node* LoadRangeNode::Identity( PhaseTransform *phase ) {
1900 //---------------------------StoreNode::make-----------------------------------
1901 // Polymorphic factory method:
1902 StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, BasicType bt ) {
1903 Compile* C = gvn.C;
1904
1905 switch (bt) {
1906 case T_BOOLEAN:
1907 case T_BYTE: return new (C, 4) StoreBNode(ctl, mem, adr, adr_type, val);
1908 case T_INT: return new (C, 4) StoreINode(ctl, mem, adr, adr_type, val);
1909 case T_CHAR:
1910 case T_SHORT: return new (C, 4) StoreCNode(ctl, mem, adr, adr_type, val);
1911 case T_LONG: return new (C, 4) StoreLNode(ctl, mem, adr, adr_type, val);
1912 case T_FLOAT: return new (C, 4) StoreFNode(ctl, mem, adr, adr_type, val);
1913 case T_DOUBLE: return new (C, 4) StoreDNode(ctl, mem, adr, adr_type, val);
1914 case T_ADDRESS:
1915 case T_OBJECT:
1916 #ifdef _LP64
1917 if (adr->bottom_type()->is_ptr_to_narrowoop() ||
1918 (UseCompressedOops && val->bottom_type()->isa_klassptr() &&
1919 adr->bottom_type()->isa_rawptr())) {
1920 val = gvn.transform(new (C, 2) EncodePNode(val, val->bottom_type()->make_narrowoop()));
1921 return new (C, 4) StoreNNode(ctl, mem, adr, adr_type, val);
1922 } else
1923 #endif
1924 {
1925 return new (C, 4) StorePNode(ctl, mem, adr, adr_type, val);
1926 }
1927 }
1928 ShouldNotReachHere();
1929 return (StoreNode*)NULL;
1930 }
1931
1932 StoreLNode* StoreLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val) {
1933 bool require_atomic = true;
1934 return new (C, 4) StoreLNode(ctl, mem, adr, adr_type, val, require_atomic);
1935 }
1936
1937
1938 //--------------------------bottom_type----------------------------------------
1939 const Type *StoreNode::bottom_type() const {
1940 return Type::MEMORY;
1941 }
|