comparison src/share/vm/opto/type.hpp @ 827:bf3489cc0aa0

6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer") Reviewed-by: kvn
author never
date Wed, 01 Jul 2009 12:22:23 -0700
parents 915cc9c5ebc6
children fc4be448891f
comparison
equal deleted inserted replaced
826:3f06f139ef53 827:bf3489cc0aa0
230 virtual bool is_finite() const; // Has a finite value 230 virtual bool is_finite() const; // Has a finite value
231 virtual bool is_nan() const; // Is not a number (NaN) 231 virtual bool is_nan() const; // Is not a number (NaN)
232 232
233 // Returns this ptr type or the equivalent ptr type for this compressed pointer. 233 // Returns this ptr type or the equivalent ptr type for this compressed pointer.
234 const TypePtr* make_ptr() const; 234 const TypePtr* make_ptr() const;
235
236 // Returns this oopptr type or the equivalent oopptr type for this compressed pointer.
237 // Asserts if the underlying type is not an oopptr or narrowoop.
238 const TypeOopPtr* make_oopptr() const;
239
235 // Returns this compressed pointer or the equivalent compressed version 240 // Returns this compressed pointer or the equivalent compressed version
236 // of this pointer type. 241 // of this pointer type.
237 const TypeNarrowOop* make_narrowoop() const; 242 const TypeNarrowOop* make_narrowoop() const;
238 243
239 // Special test for register pressure heuristic 244 // Special test for register pressure heuristic
930 // the underlying type. It's only real purpose is to track the 935 // the underlying type. It's only real purpose is to track the
931 // oopness of the compressed oop value when we expose the conversion 936 // oopness of the compressed oop value when we expose the conversion
932 // between the normal and the compressed form. 937 // between the normal and the compressed form.
933 class TypeNarrowOop : public Type { 938 class TypeNarrowOop : public Type {
934 protected: 939 protected:
935 const TypePtr* _ooptype; // Could be TypePtr::NULL_PTR 940 const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR
936 941
937 TypeNarrowOop( const TypePtr* ooptype): Type(NarrowOop), 942 TypeNarrowOop( const TypePtr* ptrtype): Type(NarrowOop),
938 _ooptype(ooptype) { 943 _ptrtype(ptrtype) {
939 assert(ooptype->offset() == 0 || 944 assert(ptrtype->offset() == 0 ||
940 ooptype->offset() == OffsetBot || 945 ptrtype->offset() == OffsetBot ||
941 ooptype->offset() == OffsetTop, "no real offsets"); 946 ptrtype->offset() == OffsetTop, "no real offsets");
942 } 947 }
943 public: 948 public:
944 virtual bool eq( const Type *t ) const; 949 virtual bool eq( const Type *t ) const;
945 virtual int hash() const; // Type specific hashing 950 virtual int hash() const; // Type specific hashing
946 virtual bool singleton(void) const; // TRUE if type is a singleton 951 virtual bool singleton(void) const; // TRUE if type is a singleton
960 static const TypeNarrowOop* make_from_constant(ciObject* con) { 965 static const TypeNarrowOop* make_from_constant(ciObject* con) {
961 return make(TypeOopPtr::make_from_constant(con)); 966 return make(TypeOopPtr::make_from_constant(con));
962 } 967 }
963 968
964 // returns the equivalent ptr type for this compressed pointer 969 // returns the equivalent ptr type for this compressed pointer
965 const TypePtr *make_oopptr() const { 970 const TypePtr *get_ptrtype() const {
966 return _ooptype; 971 return _ptrtype;
967 } 972 }
968 973
969 static const TypeNarrowOop *BOTTOM; 974 static const TypeNarrowOop *BOTTOM;
970 static const TypeNarrowOop *NULL_PTR; 975 static const TypeNarrowOop *NULL_PTR;
971 976
1148 assert( _base == KlassPtr, "Not a klass pointer" ); 1153 assert( _base == KlassPtr, "Not a klass pointer" );
1149 return (TypeKlassPtr*)this; 1154 return (TypeKlassPtr*)this;
1150 } 1155 }
1151 1156
1152 inline const TypePtr* Type::make_ptr() const { 1157 inline const TypePtr* Type::make_ptr() const {
1153 return (_base == NarrowOop) ? is_narrowoop()->make_oopptr() : 1158 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype() :
1154 (isa_ptr() ? is_ptr() : NULL); 1159 (isa_ptr() ? is_ptr() : NULL);
1160 }
1161
1162 inline const TypeOopPtr* Type::make_oopptr() const {
1163 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype()->is_oopptr() : is_oopptr();
1155 } 1164 }
1156 1165
1157 inline const TypeNarrowOop* Type::make_narrowoop() const { 1166 inline const TypeNarrowOop* Type::make_narrowoop() const {
1158 return (_base == NarrowOop) ? is_narrowoop() : 1167 return (_base == NarrowOop) ? is_narrowoop() :
1159 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL); 1168 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL);