Mercurial > hg > truffle
comparison src/share/vm/opto/type.hpp @ 163:885ed790ecf0
6695810: null oop passed to encode_heap_oop_not_null
Summary: fix several problems in C2 related to Escape Analysis and Compressed Oops.
Reviewed-by: never, jrose
author | kvn |
---|---|
date | Wed, 21 May 2008 10:45:07 -0700 |
parents | f3de1255b035 |
children | d1605aabd0a1 1e026f8da827 |
comparison
equal
deleted
inserted
replaced
162:8aa010f60e0f | 163:885ed790ecf0 |
---|---|
189 // Normalizes all empty values to TOP. Does not kill _widen bits. | 189 // Normalizes all empty values to TOP. Does not kill _widen bits. |
190 // Currently, it also works around limitations involving interface types. | 190 // Currently, it also works around limitations involving interface types. |
191 virtual const Type *filter( const Type *kills ) const; | 191 virtual const Type *filter( const Type *kills ) const; |
192 | 192 |
193 // Returns true if this pointer points at memory which contains a | 193 // Returns true if this pointer points at memory which contains a |
194 // compressed oop references. In 32-bit builds it's non-virtual | 194 // compressed oop references. |
195 // since we don't support compressed oops at all in the mode. | 195 bool is_ptr_to_narrowoop() const; |
196 LP64_ONLY(virtual) bool is_narrow() const { return false; } | |
197 | 196 |
198 // Convenience access | 197 // Convenience access |
199 float getf() const; | 198 float getf() const; |
200 double getd() const; | 199 double getd() const; |
201 | 200 |
211 const TypeAry *is_ary() const; // Array, NOT array pointer | 210 const TypeAry *is_ary() const; // Array, NOT array pointer |
212 const TypePtr *is_ptr() const; // Asserts it is a ptr type | 211 const TypePtr *is_ptr() const; // Asserts it is a ptr type |
213 const TypePtr *isa_ptr() const; // Returns NULL if not ptr type | 212 const TypePtr *isa_ptr() const; // Returns NULL if not ptr type |
214 const TypeRawPtr *isa_rawptr() const; // NOT Java oop | 213 const TypeRawPtr *isa_rawptr() const; // NOT Java oop |
215 const TypeRawPtr *is_rawptr() const; // Asserts is rawptr | 214 const TypeRawPtr *is_rawptr() const; // Asserts is rawptr |
216 const TypeNarrowOop *is_narrowoop() const; // Java-style GC'd pointer | 215 const TypeNarrowOop *is_narrowoop() const; // Java-style GC'd pointer |
217 const TypeNarrowOop *isa_narrowoop() const; // Returns NULL if not oop ptr type | 216 const TypeNarrowOop *isa_narrowoop() const; // Returns NULL if not oop ptr type |
218 const TypeOopPtr *isa_oopptr() const; // Returns NULL if not oop ptr type | 217 const TypeOopPtr *isa_oopptr() const; // Returns NULL if not oop ptr type |
219 const TypeOopPtr *is_oopptr() const; // Java-style GC'd pointer | 218 const TypeOopPtr *is_oopptr() const; // Java-style GC'd pointer |
220 const TypeKlassPtr *isa_klassptr() const; // Returns NULL if not KlassPtr | 219 const TypeKlassPtr *isa_klassptr() const; // Returns NULL if not KlassPtr |
221 const TypeKlassPtr *is_klassptr() const; // assert if not KlassPtr | 220 const TypeKlassPtr *is_klassptr() const; // assert if not KlassPtr |
222 const TypeInstPtr *isa_instptr() const; // Returns NULL if not InstPtr | 221 const TypeInstPtr *isa_instptr() const; // Returns NULL if not InstPtr |
641 | 640 |
642 //------------------------------TypeOopPtr------------------------------------- | 641 //------------------------------TypeOopPtr------------------------------------- |
643 // Some kind of oop (Java pointer), either klass or instance or array. | 642 // Some kind of oop (Java pointer), either klass or instance or array. |
644 class TypeOopPtr : public TypePtr { | 643 class TypeOopPtr : public TypePtr { |
645 protected: | 644 protected: |
646 TypeOopPtr( TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id ) : TypePtr(t, ptr, offset), _const_oop(o), _klass(k), _klass_is_exact(xk), _instance_id(instance_id) { } | 645 TypeOopPtr( TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id ); |
647 public: | 646 public: |
648 virtual bool eq( const Type *t ) const; | 647 virtual bool eq( const Type *t ) const; |
649 virtual int hash() const; // Type specific hashing | 648 virtual int hash() const; // Type specific hashing |
650 virtual bool singleton(void) const; // TRUE if type is a singleton | 649 virtual bool singleton(void) const; // TRUE if type is a singleton |
651 enum { | 650 enum { |
658 ciObject* _const_oop; // Constant oop | 657 ciObject* _const_oop; // Constant oop |
659 // If _klass is NULL, then so is _sig. This is an unloaded klass. | 658 // If _klass is NULL, then so is _sig. This is an unloaded klass. |
660 ciKlass* _klass; // Klass object | 659 ciKlass* _klass; // Klass object |
661 // Does the type exclude subclasses of the klass? (Inexact == polymorphic.) | 660 // Does the type exclude subclasses of the klass? (Inexact == polymorphic.) |
662 bool _klass_is_exact; | 661 bool _klass_is_exact; |
663 | 662 bool _is_ptr_to_narrowoop; |
664 int _instance_id; // if not UNKNOWN_INSTANCE, indicates that this is a particular instance | 663 |
664 int _instance_id; // if not UNKNOWN_INSTANCE, indicates that this is a particular instance | |
665 // of this type which is distinct. This is the the node index of the | 665 // of this type which is distinct. This is the the node index of the |
666 // node creating this instance | 666 // node creating this instance |
667 | 667 |
668 static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact); | 668 static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact); |
669 | 669 |
694 static const TypeOopPtr* make(PTR ptr, int offset); | 694 static const TypeOopPtr* make(PTR ptr, int offset); |
695 | 695 |
696 ciObject* const_oop() const { return _const_oop; } | 696 ciObject* const_oop() const { return _const_oop; } |
697 virtual ciKlass* klass() const { return _klass; } | 697 virtual ciKlass* klass() const { return _klass; } |
698 bool klass_is_exact() const { return _klass_is_exact; } | 698 bool klass_is_exact() const { return _klass_is_exact; } |
699 | |
700 // Returns true if this pointer points at memory which contains a | |
701 // compressed oop references. | |
702 bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; } | |
703 | |
699 bool is_instance() const { return _instance_id != UNKNOWN_INSTANCE; } | 704 bool is_instance() const { return _instance_id != UNKNOWN_INSTANCE; } |
700 uint instance_id() const { return _instance_id; } | 705 uint instance_id() const { return _instance_id; } |
701 bool is_instance_field() const { return _instance_id != UNKNOWN_INSTANCE && _offset >= 0; } | 706 bool is_instance_field() const { return _instance_id != UNKNOWN_INSTANCE && _offset >= 0; } |
702 | 707 |
703 virtual intptr_t get_con() const; | 708 virtual intptr_t get_con() const; |
713 | 718 |
714 virtual const TypePtr *add_offset( int offset ) const; | 719 virtual const TypePtr *add_offset( int offset ) const; |
715 | 720 |
716 // returns the equivalent compressed version of this pointer type | 721 // returns the equivalent compressed version of this pointer type |
717 virtual const TypeNarrowOop* make_narrowoop() const; | 722 virtual const TypeNarrowOop* make_narrowoop() const; |
718 | |
719 #ifdef _LP64 | |
720 virtual bool is_narrow() const { | |
721 return (UseCompressedOops && _offset != 0); | |
722 } | |
723 #endif | |
724 | 723 |
725 virtual const Type *xmeet( const Type *t ) const; | 724 virtual const Type *xmeet( const Type *t ) const; |
726 virtual const Type *xdual() const; // Compute dual right now. | 725 virtual const Type *xdual() const; // Compute dual right now. |
727 | 726 |
728 // Do not allow interface-vs.-noninterface joins to collapse to top. | 727 // Do not allow interface-vs.-noninterface joins to collapse to top. |
841 virtual const TypePtr *add_offset( int offset ) const; | 840 virtual const TypePtr *add_offset( int offset ) const; |
842 | 841 |
843 virtual const Type *xmeet( const Type *t ) const; | 842 virtual const Type *xmeet( const Type *t ) const; |
844 virtual const Type *xdual() const; // Compute dual right now. | 843 virtual const Type *xdual() const; // Compute dual right now. |
845 | 844 |
846 #ifdef _LP64 | |
847 virtual bool is_narrow() const { | |
848 return (UseCompressedOops && klass() != NULL && _offset != 0); | |
849 } | |
850 #endif | |
851 | |
852 // Convenience common pre-built types. | 845 // Convenience common pre-built types. |
853 static const TypeAryPtr *RANGE; | 846 static const TypeAryPtr *RANGE; |
854 static const TypeAryPtr *OOPS; | 847 static const TypeAryPtr *OOPS; |
848 static const TypeAryPtr *NARROWOOPS; | |
855 static const TypeAryPtr *BYTES; | 849 static const TypeAryPtr *BYTES; |
856 static const TypeAryPtr *SHORTS; | 850 static const TypeAryPtr *SHORTS; |
857 static const TypeAryPtr *CHARS; | 851 static const TypeAryPtr *CHARS; |
858 static const TypeAryPtr *INTS; | 852 static const TypeAryPtr *INTS; |
859 static const TypeAryPtr *LONGS; | 853 static const TypeAryPtr *LONGS; |
899 | 893 |
900 virtual const TypePtr *add_offset( int offset ) const; | 894 virtual const TypePtr *add_offset( int offset ) const; |
901 virtual const Type *xmeet( const Type *t ) const; | 895 virtual const Type *xmeet( const Type *t ) const; |
902 virtual const Type *xdual() const; // Compute dual right now. | 896 virtual const Type *xdual() const; // Compute dual right now. |
903 | 897 |
904 #ifdef _LP64 | |
905 // Perm objects don't use compressed references, except for static fields | |
906 // which are currently compressed | |
907 virtual bool is_narrow() const { | |
908 if (UseCompressedOops && _offset != 0 && _klass->is_instance_klass()) { | |
909 ciInstanceKlass* ik = _klass->as_instance_klass(); | |
910 return ik != NULL && ik->get_field_by_offset(_offset, true) != NULL; | |
911 } | |
912 return false; | |
913 } | |
914 #endif | |
915 | |
916 // Convenience common pre-built types. | 898 // Convenience common pre-built types. |
917 static const TypeKlassPtr* OBJECT; // Not-null object klass or below | 899 static const TypeKlassPtr* OBJECT; // Not-null object klass or below |
918 static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same | 900 static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same |
919 #ifndef PRODUCT | 901 #ifndef PRODUCT |
920 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | 902 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping |
921 #endif | 903 #endif |
922 }; | 904 }; |
923 | 905 |
924 //------------------------------TypeNarrowOop---------------------------------------- | 906 //------------------------------TypeNarrowOop---------------------------------- |
925 // A compressed reference to some kind of Oop. This type wraps around | 907 // A compressed reference to some kind of Oop. This type wraps around |
926 // a preexisting TypeOopPtr and forwards most of it's operations to | 908 // a preexisting TypeOopPtr and forwards most of it's operations to |
927 // the underlying type. It's only real purpose is to track the | 909 // the underlying type. It's only real purpose is to track the |
928 // oopness of the compressed oop value when we expose the conversion | 910 // oopness of the compressed oop value when we expose the conversion |
929 // between the normal and the compressed form. | 911 // between the normal and the compressed form. |
1011 #endif | 993 #endif |
1012 // Convenience common pre-built types. | 994 // Convenience common pre-built types. |
1013 }; | 995 }; |
1014 | 996 |
1015 //------------------------------accessors-------------------------------------- | 997 //------------------------------accessors-------------------------------------- |
998 inline bool Type::is_ptr_to_narrowoop() const { | |
999 #ifdef _LP64 | |
1000 return (isa_oopptr() != NULL && is_oopptr()->is_ptr_to_narrowoop_nv()); | |
1001 #else | |
1002 return false; | |
1003 #endif | |
1004 } | |
1005 | |
1016 inline float Type::getf() const { | 1006 inline float Type::getf() const { |
1017 assert( _base == FloatCon, "Not a FloatCon" ); | 1007 assert( _base == FloatCon, "Not a FloatCon" ); |
1018 return ((TypeF*)this)->_f; | 1008 return ((TypeF*)this)->_f; |
1019 } | 1009 } |
1020 | 1010 |