428 int off,
429 bool is_unsigned_load,
430 BasicType loadbt);
431
432 static const Type* make_constant_from_field(ciField* field,
433 ciInstance* holder,
434 BasicType loadbt,
435 bool is_unsigned_load);
436
437 static const Type* make_constant_from_array_element(ciArray* array,
438 int off,
439 int stable_dimension,
440 BasicType loadbt,
441 bool is_unsigned_load);
442
443 // Speculative type helper methods. See TypePtr.
444 virtual const TypePtr* speculative() const { return NULL; }
445 virtual ciKlass* speculative_type() const { return NULL; }
446 virtual ciKlass* speculative_type_not_null() const { return NULL; }
447 virtual bool speculative_maybe_null() const { return true; }
448 virtual const Type* remove_speculative() const { return this; }
449 virtual const Type* cleanup_speculative() const { return this; }
450 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const { return exact_kls != NULL; }
451 virtual bool would_improve_ptr(bool maybe_null) const { return !maybe_null; }
452 const Type* maybe_remove_speculative(bool include_speculative) const;
453
454 virtual bool maybe_null() const { return true; }
455
456 private:
457 // support arrays
458 static const BasicType _basic_type[];
459 static const Type* _zero_type[T_CONFLICT+1];
460 static const Type* _const_basic_type[T_CONFLICT+1];
461 };
462
463 //------------------------------TypeF------------------------------------------
464 // Class of Float-Constant Types.
465 class TypeF : public Type {
466 TypeF( float f ) : Type(FloatCon), _f(f) {};
467 public:
468 virtual bool eq( const Type *t ) const;
469 virtual int hash() const; // Type specific hashing
470 virtual bool singleton(void) const; // TRUE if type is a singleton
471 virtual bool empty(void) const; // TRUE if type is vacuous
868 int meet_offset( int offset ) const;
869 int dual_offset( ) const;
870 virtual const Type *xdual() const; // Compute dual right now.
871
872 // meet, dual and join over pointer equivalence sets
873 PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; }
874 PTR dual_ptr() const { return ptr_dual[ptr()]; }
875
876 // This is textually confusing unless one recalls that
877 // join(t) == dual()->meet(t->dual())->dual().
878 PTR join_ptr( const PTR in_ptr ) const {
879 return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ];
880 }
881
882 // Speculative type helper methods.
883 virtual const TypePtr* speculative() const { return _speculative; }
884 int inline_depth() const { return _inline_depth; }
885 virtual ciKlass* speculative_type() const;
886 virtual ciKlass* speculative_type_not_null() const;
887 virtual bool speculative_maybe_null() const;
888 virtual const Type* remove_speculative() const;
889 virtual const Type* cleanup_speculative() const;
890 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
891 virtual bool would_improve_ptr(bool maybe_null) const;
892 virtual const TypePtr* with_inline_depth(int depth) const;
893
894 virtual bool maybe_null() const { return meet_ptr(Null) == ptr(); }
895
896 // Tests for relation to centerline of type lattice:
897 static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); }
898 static bool below_centerline(PTR ptr) { return (ptr >= NotNull); }
899 // Convenience common pre-built types.
900 static const TypePtr *NULL_PTR;
901 static const TypePtr *NOTNULL;
902 static const TypePtr *BOTTOM;
903 #ifndef PRODUCT
904 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
905 #endif
906 };
907
908 //------------------------------TypeRawPtr-------------------------------------
909 // Class of raw pointers, pointers to things other than Oops. Examples
910 // include the stack pointer, top of heap, card-marking area, handles, etc.
911 class TypeRawPtr : public TypePtr {
|
428 int off,
429 bool is_unsigned_load,
430 BasicType loadbt);
431
432 static const Type* make_constant_from_field(ciField* field,
433 ciInstance* holder,
434 BasicType loadbt,
435 bool is_unsigned_load);
436
437 static const Type* make_constant_from_array_element(ciArray* array,
438 int off,
439 int stable_dimension,
440 BasicType loadbt,
441 bool is_unsigned_load);
442
443 // Speculative type helper methods. See TypePtr.
444 virtual const TypePtr* speculative() const { return NULL; }
445 virtual ciKlass* speculative_type() const { return NULL; }
446 virtual ciKlass* speculative_type_not_null() const { return NULL; }
447 virtual bool speculative_maybe_null() const { return true; }
448 virtual bool speculative_always_null() const { return true; }
449 virtual const Type* remove_speculative() const { return this; }
450 virtual const Type* cleanup_speculative() const { return this; }
451 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const { return exact_kls != NULL; }
452 virtual bool would_improve_ptr(ProfilePtrKind ptr_kind) const { return ptr_kind == ProfileAlwaysNull || ptr_kind == ProfileNeverNull; }
453 const Type* maybe_remove_speculative(bool include_speculative) const;
454
455 virtual bool maybe_null() const { return true; }
456
457 private:
458 // support arrays
459 static const BasicType _basic_type[];
460 static const Type* _zero_type[T_CONFLICT+1];
461 static const Type* _const_basic_type[T_CONFLICT+1];
462 };
463
464 //------------------------------TypeF------------------------------------------
465 // Class of Float-Constant Types.
466 class TypeF : public Type {
467 TypeF( float f ) : Type(FloatCon), _f(f) {};
468 public:
469 virtual bool eq( const Type *t ) const;
470 virtual int hash() const; // Type specific hashing
471 virtual bool singleton(void) const; // TRUE if type is a singleton
472 virtual bool empty(void) const; // TRUE if type is vacuous
869 int meet_offset( int offset ) const;
870 int dual_offset( ) const;
871 virtual const Type *xdual() const; // Compute dual right now.
872
873 // meet, dual and join over pointer equivalence sets
874 PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; }
875 PTR dual_ptr() const { return ptr_dual[ptr()]; }
876
877 // This is textually confusing unless one recalls that
878 // join(t) == dual()->meet(t->dual())->dual().
879 PTR join_ptr( const PTR in_ptr ) const {
880 return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ];
881 }
882
883 // Speculative type helper methods.
884 virtual const TypePtr* speculative() const { return _speculative; }
885 int inline_depth() const { return _inline_depth; }
886 virtual ciKlass* speculative_type() const;
887 virtual ciKlass* speculative_type_not_null() const;
888 virtual bool speculative_maybe_null() const;
889 virtual bool speculative_always_null() const;
890 virtual const Type* remove_speculative() const;
891 virtual const Type* cleanup_speculative() const;
892 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
893 virtual bool would_improve_ptr(ProfilePtrKind maybe_null) const;
894 virtual const TypePtr* with_inline_depth(int depth) const;
895
896 virtual bool maybe_null() const { return meet_ptr(Null) == ptr(); }
897
898 // Tests for relation to centerline of type lattice:
899 static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); }
900 static bool below_centerline(PTR ptr) { return (ptr >= NotNull); }
901 // Convenience common pre-built types.
902 static const TypePtr *NULL_PTR;
903 static const TypePtr *NOTNULL;
904 static const TypePtr *BOTTOM;
905 #ifndef PRODUCT
906 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
907 #endif
908 };
909
910 //------------------------------TypeRawPtr-------------------------------------
911 // Class of raw pointers, pointers to things other than Oops. Examples
912 // include the stack pointer, top of heap, card-marking area, handles, etc.
913 class TypeRawPtr : public TypePtr {
|