src/share/vm/opto/type.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/opto/type.hpp	Tue Mar 25 15:47:09 2014
--- new/src/share/vm/opto/type.hpp	Tue Mar 25 15:47:08 2014

*** 222,232 **** --- 222,232 ---- const Type *meet(const Type *t) const { return meet_helper(t, false); } // Variant that keeps the speculative part of the types const Type *meet_speculative(const Type *t) const { ! return meet_helper(t, true)->cleanup_speculative(); } // WIDEN: 'widens' for Ints and other range types virtual const Type *widen( const Type *old, const Type* limit ) const { return this; } // NARROW: complement for widen, used by pessimistic phases virtual const Type *narrow( const Type *old ) const { return this; }
*** 245,255 **** --- 245,255 ---- const Type *join(const Type *t) const { return join_helper(t, false); } // Variant that keeps the speculative part of the types const Type *join_speculative(const Type *t) const { ! return join_helper(t, true)->cleanup_speculative(); } // Modified version of JOIN adapted to the needs Node::Value. // Normalizes all empty values to TOP. Does not kill _widen bits. // Currently, it also works around limitations involving interface types.
*** 257,267 **** --- 257,267 ---- const Type *filter(const Type *kills) const { return filter_helper(kills, false); } // Variant that keeps the speculative part of the types const Type *filter_speculative(const Type *kills) const { ! return filter_helper(kills, true)->cleanup_speculative(); } #ifdef ASSERT // One type is interface, the other is oop virtual bool interface_vs_oop(const Type *t) const;
*** 412,430 **** --- 412,433 ---- static const Type* make_from_constant(ciConstant constant, bool require_constant = false, bool is_autobox_cache = false); ! // Speculative type. See TypeInstPtr ! virtual const TypeOopPtr* speculative() const { return NULL; } ! // Speculative type helper methods. See TypePtr. ! virtual const TypePtr* speculative() const { return NULL; } virtual ciKlass* speculative_type() const { return NULL; } const Type* maybe_remove_speculative(bool include_speculative) const; + virtual ciKlass* speculative_type_not_null() const { return NULL; } + virtual bool speculative_maybe_null() const { return true; } virtual const Type* remove_speculative() const { return this; } + virtual const Type* cleanup_speculative() const { return this; } + virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const { return exact_kls != NULL; } + virtual bool would_improve_ptr(bool maybe_null) const { return !maybe_null; } + const Type* maybe_remove_speculative(bool include_speculative) const; ! virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const { return exact_kls != NULL; } ! virtual bool maybe_null() const { return true; } private: // support arrays static const BasicType _basic_type[]; static const Type* _zero_type[T_CONFLICT+1];
*** 677,686 **** --- 680,690 ---- virtual const Type *xmeet( const Type *t ) const; virtual const Type *xdual() const; // Compute dual right now. bool ary_must_be_exact() const; // true if arrays of such are never generic virtual const Type* remove_speculative() const; + virtual const Type* cleanup_speculative() const; #ifdef ASSERT // One type is interface, the other is oop virtual bool interface_vs_oop(const Type *t) const; #endif #ifndef PRODUCT
*** 759,795 **** --- 763,839 ---- class TypePtr : public Type { friend class TypeNarrowPtr; public: enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR }; protected: ! TypePtr( TYPES t, PTR ptr, int offset ) : Type(t), _ptr(ptr), _offset(offset) {} virtual bool eq( const Type *t ) const; virtual int hash() const; // Type specific hashing ! TypePtr(TYPES t, PTR ptr, int offset, + const TypePtr* speculative = NULL, + int inline_depth = InlineDepthBottom) : + Type(t), _ptr(ptr), _offset(offset), _speculative(speculative), + _inline_depth(inline_depth) {} static const PTR ptr_meet[lastPTR][lastPTR]; static const PTR ptr_dual[lastPTR]; static const char * const ptr_msg[lastPTR]; + enum { + InlineDepthBottom = INT_MAX, + InlineDepthTop = -InlineDepthBottom + }; + + // Extra type information profiling gave us. We propagate it the + // same way the rest of the type info is propagated. If we want to + // use it, then we have to emit a guard: this part of the type is + // not something we know but something we speculate about the type. + const TypePtr* _speculative; + // For speculative types, we record at what inlining depth the + // profiling point that provided the data is. We want to favor + // profile data coming from outer scopes which are likely better for + // the current compilation. + int _inline_depth; + + // utility methods to work on the speculative part of the type + const TypePtr* dual_speculative() const; + const TypePtr* xmeet_speculative(const TypePtr* other) const; + bool eq_speculative(const TypePtr* other) const; + int hash_speculative() const; + const TypePtr* add_offset_speculative(intptr_t offset) const; + #ifndef PRODUCT + void dump_speculative(outputStream *st) const; + #endif + + // utility methods to work on the inline depth of the type + int dual_inline_depth() const; + int meet_inline_depth(int depth) const; + #ifndef PRODUCT + void dump_inline_depth(outputStream *st) const; + #endif + public: const int _offset; // Offset into oop, with TOP & BOT const PTR _ptr; // Pointer equivalence class const int offset() const { return _offset; } const PTR ptr() const { return _ptr; } ! static const TypePtr *make( TYPES t, PTR ptr, int offset ); ! static const TypePtr *make(TYPES t, PTR ptr, int offset, + const TypePtr* speculative = NULL, + int inline_depth = InlineDepthBottom); // Return a 'ptr' version of this type virtual const Type *cast_to_ptr_type(PTR ptr) const; virtual intptr_t get_con() const; int xadd_offset( intptr_t offset ) const; virtual const TypePtr *add_offset( intptr_t offset ) const; + virtual bool eq(const Type *t) const; + virtual int hash() const; // Type specific hashing virtual bool singleton(void) const; // TRUE if type is a singleton virtual bool empty(void) const; // TRUE if type is vacuous virtual const Type *xmeet( const Type *t ) const; + virtual const Type *xmeet_helper( const Type *t ) const; int meet_offset( int offset ) const; int dual_offset( ) const; virtual const Type *xdual() const; // Compute dual right now. // meet, dual and join over pointer equivalence sets
*** 800,809 **** --- 844,867 ---- // join(t) == dual()->meet(t->dual())->dual(). PTR join_ptr( const PTR in_ptr ) const { return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ]; } + // Speculative type helper methods. + virtual const TypePtr* speculative() const { return _speculative; } + int inline_depth() const { return _inline_depth; } + virtual ciKlass* speculative_type() const; + virtual ciKlass* speculative_type_not_null() const; + virtual bool speculative_maybe_null() const; + virtual const Type* remove_speculative() const; + virtual const Type* cleanup_speculative() const; + virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const; + virtual bool would_improve_ptr(bool maybe_null) const; + virtual const TypePtr* with_inline_depth(int depth) const; + + virtual bool maybe_null() const { return meet_ptr(Null) == ptr(); } + // Tests for relation to centerline of type lattice: static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); } static bool below_centerline(PTR ptr) { return (ptr >= NotNull); } // Convenience common pre-built types. static const TypePtr *NULL_PTR;
*** 848,872 **** --- 906,927 ---- //------------------------------TypeOopPtr------------------------------------- // Some kind of oop (Java pointer), either klass or instance or array. class TypeOopPtr : public TypePtr { protected: - TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id, const TypeOopPtr* speculative, int inline_depth); + const TypePtr* speculative, int inline_depth); public: virtual bool eq( const Type *t ) const; virtual int hash() const; // Type specific hashing virtual bool singleton(void) const; // TRUE if type is a singleton enum { InstanceTop = -1, // undefined instance InstanceBot = 0 // any possible instance }; protected: enum { InlineDepthBottom = INT_MAX, InlineDepthTop = -InlineDepthBottom }; // Oop is NULL, unless this is a constant oop. ciObject* _const_oop; // Constant oop // If _klass is NULL, then so is _sig. This is an unloaded klass. ciKlass* _klass; // Klass object // Does the type exclude subclasses of the klass? (Inexact == polymorphic.)
*** 878,919 **** --- 933,947 ---- // If not InstanceTop or InstanceBot, indicates that this is // a particular instance of this type which is distinct. // This is the the node index of the allocation node creating this instance. int _instance_id; // Extra type information profiling gave us. We propagate it the // same way the rest of the type info is propagated. If we want to // use it, then we have to emit a guard: this part of the type is // not something we know but something we speculate about the type. const TypeOopPtr* _speculative; // For speculative types, we record at what inlining depth the // profiling point that provided the data is. We want to favor // profile data coming from outer scopes which are likely better for // the current compilation. int _inline_depth; static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact); int dual_instance_id() const; int meet_instance_id(int uid) const; // utility methods to work on the speculative part of the type const TypeOopPtr* dual_speculative() const; const TypeOopPtr* xmeet_speculative(const TypeOopPtr* other) const; bool eq_speculative(const TypeOopPtr* other) const; int hash_speculative() const; const TypeOopPtr* add_offset_speculative(intptr_t offset) const; #ifndef PRODUCT void dump_speculative(outputStream *st) const; #endif // utility methods to work on the inline depth of the type int dual_inline_depth() const; int meet_inline_depth(int depth) const; #ifndef PRODUCT void dump_inline_depth(outputStream *st) const; #endif // Do not allow interface-vs.-noninterface joins to collapse to top. virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; public: // Creates a type given a klass. Correctly handles multi-dimensional arrays
*** 939,949 **** --- 967,979 ---- static const TypeOopPtr* make_from_constant(ciObject* o, bool require_constant = false, bool not_null_elements = false); // Make a generic (unclassed) pointer to an oop. - static const TypeOopPtr* make(PTR ptr, int offset, int instance_id, const TypeOopPtr* speculative = NULL, int inline_depth = InlineDepthBottom); + const TypePtr* speculative = NULL, + int inline_depth = InlineDepthBottom); ciObject* const_oop() const { return _const_oop; } virtual ciKlass* klass() const { return _klass; } bool klass_is_exact() const { return _klass_is_exact; }
*** 953,963 **** --- 983,992 ---- bool is_ptr_to_narrowklass_nv() const { return _is_ptr_to_narrowklass; } bool is_ptr_to_boxed_value() const { return _is_ptr_to_boxed_value; } bool is_known_instance() const { return _instance_id > 0; } int instance_id() const { return _instance_id; } bool is_known_instance_field() const { return is_known_instance() && _offset >= 0; } virtual const TypeOopPtr* speculative() const { return _speculative; } virtual intptr_t get_con() const; virtual const Type *cast_to_ptr_type(PTR ptr) const;
*** 967,1012 **** --- 996,1029 ---- // corresponding pointer to klass, for a given instance const TypeKlassPtr* as_klass_type() const; virtual const TypePtr *add_offset( intptr_t offset ) const; // Return same type without a speculative part + + // Speculative type helper methods. virtual const Type* remove_speculative() const; + virtual const Type* cleanup_speculative() const; + virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const; + virtual const TypePtr* with_inline_depth(int depth) const; virtual const Type *xmeet(const Type *t) const; virtual const Type *xdual() const; // Compute dual right now. // the core of the computation of the meet for TypeOopPtr and for its subclasses virtual const Type *xmeet_helper(const Type *t) const; // Convenience common pre-built type. static const TypeOopPtr *BOTTOM; #ifndef PRODUCT virtual void dump2( Dict &d, uint depth, outputStream *st ) const; #endif // Return the speculative type if any ciKlass* speculative_type() const { if (_speculative != NULL) { const TypeOopPtr* speculative = _speculative->join(this)->is_oopptr(); if (speculative->klass_is_exact()) { return speculative->klass(); } } return NULL; } int inline_depth() const { return _inline_depth; } virtual const TypeOopPtr* with_inline_depth(int depth) const; virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const; }; //------------------------------TypeInstPtr------------------------------------ // Class of Java object pointers, pointing either to non-array Java instances // or to a Klass* (including array klasses). class TypeInstPtr : public TypeOopPtr { - TypeInstPtr(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id, const TypeOopPtr* speculative, int inline_depth); + const TypePtr* speculative, int inline_depth); virtual bool eq( const Type *t ) const; virtual int hash() const; // Type specific hashing ciSymbol* _name; // class name
*** 1038,1048 **** --- 1055,1068 ---- static const TypeInstPtr *make(PTR ptr, ciKlass* klass, int offset) { return make(ptr, klass, false, NULL, offset, InstanceBot); } // Make a pointer to an oop. - static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id = InstanceBot, const TypeOopPtr* speculative = NULL, int inline_depth = InlineDepthBottom); + int instance_id = InstanceBot, + const TypePtr* speculative = NULL, + int inline_depth = InlineDepthBottom); /** Create constant type for a constant boxed value */ const Type* get_const_boxed_value() const; // If this is a java.lang.Class constant, return the type for it or NULL.
*** 1055,1067 **** --- 1075,1088 ---- virtual const Type *cast_to_exactness(bool klass_is_exact) const; virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const; virtual const TypePtr *add_offset( intptr_t offset ) const; // Return same type without a speculative part + + // Speculative type helper methods. virtual const Type* remove_speculative() const; ! virtual const TypeOopPtr* with_inline_depth(int depth) const; ! virtual const TypePtr* with_inline_depth(int depth) const; // the core of the computation of the meet of 2 types virtual const Type *xmeet_helper(const Type *t) const; virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const; virtual const Type *xdual() const; // Compute dual right now.
*** 1079,1089 **** --- 1100,1111 ---- //------------------------------TypeAryPtr------------------------------------- // Class of Java array pointers class TypeAryPtr : public TypeOopPtr { TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, - int offset, int instance_id, bool is_autobox_cache, const TypeOopPtr* speculative, int inline_depth) + const TypePtr* speculative, int inline_depth) : TypeOopPtr(AryPtr,ptr,k,xk,o,offset, instance_id, speculative, inline_depth), _ary(ary), _is_autobox_cache(is_autobox_cache) { #ifdef ASSERT
*** 1118,1130 **** --- 1140,1158 ---- const TypeInt* size() const { return _ary->_size; } bool is_stable() const { return _ary->_stable; } bool is_autobox_cache() const { return _is_autobox_cache; } ! static const TypeAryPtr *make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot, const TypeOopPtr* speculative = NULL, int inline_depth = InlineDepthBottom); + int instance_id = InstanceBot, + const TypePtr* speculative = NULL, + int inline_depth = InlineDepthBottom); // Constant pointer to array ! static const TypeAryPtr *make( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot, const TypeOopPtr* speculative = NULL, int inline_depth = InlineDepthBottom, bool is_autobox_cache= false); + int instance_id = InstanceBot, + const TypePtr* speculative = NULL, + int inline_depth = InlineDepthBottom, bool is_autobox_cache = false); // Return a 'ptr' version of this type virtual const Type *cast_to_ptr_type(PTR ptr) const; virtual const Type *cast_to_exactness(bool klass_is_exact) const;
*** 1134,1146 **** --- 1162,1175 ---- virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const; virtual const TypeInt* narrow_size_type(const TypeInt* size) const; virtual bool empty(void) const; // TRUE if type is vacuous virtual const TypePtr *add_offset( intptr_t offset ) const; // Return same type without a speculative part + + // Speculative type helper methods. virtual const Type* remove_speculative() const; ! virtual const TypeOopPtr* with_inline_depth(int depth) const; ! virtual const TypePtr* with_inline_depth(int depth) const; // the core of the computation of the meet of 2 types virtual const Type *xmeet_helper(const Type *t) const; virtual const Type *xdual() const; // Compute dual right now.
*** 1365,1377 **** --- 1394,1405 ---- } static const TypeNarrowOop *BOTTOM; static const TypeNarrowOop *NULL_PTR; ! virtual const Type* remove_speculative() const { ! return make(_ptrtype->remove_speculative()->is_ptr()); } ! virtual const Type* remove_speculative() const; ! virtual const Type* cleanup_speculative() const; #ifndef PRODUCT virtual void dump2( Dict &d, uint depth, outputStream *st ) const; #endif };

src/share/vm/opto/type.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File