src/share/vm/opto/type.hpp

changeset 598
885ed790ecf0
parent 580
f3de1255b035
child 631
d1605aabd0a1
child 656
1e026f8da827
     1.1 --- a/src/share/vm/opto/type.hpp	Tue May 20 06:32:58 2008 -0700
     1.2 +++ b/src/share/vm/opto/type.hpp	Wed May 21 10:45:07 2008 -0700
     1.3 @@ -191,9 +191,8 @@
     1.4    virtual const Type *filter( const Type *kills ) const;
     1.5  
     1.6    // Returns true if this pointer points at memory which contains a
     1.7 -  // compressed oop references.  In 32-bit builds it's non-virtual
     1.8 -  // since we don't support compressed oops at all in the mode.
     1.9 -  LP64_ONLY(virtual) bool is_narrow() const { return false; }
    1.10 +  // compressed oop references.
    1.11 +  bool is_ptr_to_narrowoop() const;
    1.12  
    1.13    // Convenience access
    1.14    float getf() const;
    1.15 @@ -213,8 +212,8 @@
    1.16    const TypePtr    *isa_ptr() const;             // Returns NULL if not ptr type
    1.17    const TypeRawPtr *isa_rawptr() const;          // NOT Java oop
    1.18    const TypeRawPtr *is_rawptr() const;           // Asserts is rawptr
    1.19 -  const TypeNarrowOop  *is_narrowoop() const;        // Java-style GC'd pointer
    1.20 -  const TypeNarrowOop  *isa_narrowoop() const;       // Returns NULL if not oop ptr type
    1.21 +  const TypeNarrowOop  *is_narrowoop() const;    // Java-style GC'd pointer
    1.22 +  const TypeNarrowOop  *isa_narrowoop() const;   // Returns NULL if not oop ptr type
    1.23    const TypeOopPtr   *isa_oopptr() const;        // Returns NULL if not oop ptr type
    1.24    const TypeOopPtr   *is_oopptr() const;         // Java-style GC'd pointer
    1.25    const TypeKlassPtr *isa_klassptr() const;      // Returns NULL if not KlassPtr
    1.26 @@ -643,7 +642,7 @@
    1.27  // Some kind of oop (Java pointer), either klass or instance or array.
    1.28  class TypeOopPtr : public TypePtr {
    1.29  protected:
    1.30 -  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) { }
    1.31 +  TypeOopPtr( TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id );
    1.32  public:
    1.33    virtual bool eq( const Type *t ) const;
    1.34    virtual int  hash() const;             // Type specific hashing
    1.35 @@ -660,8 +659,9 @@
    1.36    ciKlass*      _klass;       // Klass object
    1.37    // Does the type exclude subclasses of the klass?  (Inexact == polymorphic.)
    1.38    bool          _klass_is_exact;
    1.39 +  bool          _is_ptr_to_narrowoop;
    1.40  
    1.41 -  int          _instance_id;   // if not UNKNOWN_INSTANCE, indicates that this is a particular instance
    1.42 +  int           _instance_id;  // if not UNKNOWN_INSTANCE, indicates that this is a particular instance
    1.43                                 // of this type which is distinct.  This is the  the node index of the
    1.44                                 // node creating this instance
    1.45  
    1.46 @@ -696,6 +696,11 @@
    1.47    ciObject* const_oop()    const { return _const_oop; }
    1.48    virtual ciKlass* klass() const { return _klass;     }
    1.49    bool klass_is_exact()    const { return _klass_is_exact; }
    1.50 +
    1.51 +  // Returns true if this pointer points at memory which contains a
    1.52 +  // compressed oop references.
    1.53 +  bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; }
    1.54 +
    1.55    bool is_instance()       const { return _instance_id != UNKNOWN_INSTANCE; }
    1.56    uint instance_id()       const { return _instance_id; }
    1.57    bool is_instance_field() const { return _instance_id != UNKNOWN_INSTANCE && _offset >= 0; }
    1.58 @@ -716,12 +721,6 @@
    1.59    // returns the equivalent compressed version of this pointer type
    1.60    virtual const TypeNarrowOop* make_narrowoop() const;
    1.61  
    1.62 -#ifdef _LP64
    1.63 -  virtual bool is_narrow() const {
    1.64 -    return (UseCompressedOops && _offset != 0);
    1.65 -  }
    1.66 -#endif
    1.67 -
    1.68    virtual const Type *xmeet( const Type *t ) const;
    1.69    virtual const Type *xdual() const;    // Compute dual right now.
    1.70  
    1.71 @@ -843,15 +842,10 @@
    1.72    virtual const Type *xmeet( const Type *t ) const;
    1.73    virtual const Type *xdual() const;    // Compute dual right now.
    1.74  
    1.75 -#ifdef _LP64
    1.76 -  virtual bool is_narrow() const {
    1.77 -    return (UseCompressedOops && klass() != NULL && _offset != 0);
    1.78 -  }
    1.79 -#endif
    1.80 -
    1.81    // Convenience common pre-built types.
    1.82    static const TypeAryPtr *RANGE;
    1.83    static const TypeAryPtr *OOPS;
    1.84 +  static const TypeAryPtr *NARROWOOPS;
    1.85    static const TypeAryPtr *BYTES;
    1.86    static const TypeAryPtr *SHORTS;
    1.87    static const TypeAryPtr *CHARS;
    1.88 @@ -901,18 +895,6 @@
    1.89    virtual const Type    *xmeet( const Type *t ) const;
    1.90    virtual const Type    *xdual() const;      // Compute dual right now.
    1.91  
    1.92 -#ifdef _LP64
    1.93 -  // Perm objects don't use compressed references, except for static fields
    1.94 -  // which are currently compressed
    1.95 -  virtual bool is_narrow() const {
    1.96 -    if (UseCompressedOops && _offset != 0 && _klass->is_instance_klass()) {
    1.97 -      ciInstanceKlass* ik = _klass->as_instance_klass();
    1.98 -      return ik != NULL && ik->get_field_by_offset(_offset, true) != NULL;
    1.99 -    }
   1.100 -    return false;
   1.101 -  }
   1.102 -#endif
   1.103 -
   1.104    // Convenience common pre-built types.
   1.105    static const TypeKlassPtr* OBJECT; // Not-null object klass or below
   1.106    static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
   1.107 @@ -921,7 +903,7 @@
   1.108  #endif
   1.109  };
   1.110  
   1.111 -//------------------------------TypeNarrowOop----------------------------------------
   1.112 +//------------------------------TypeNarrowOop----------------------------------
   1.113  // A compressed reference to some kind of Oop.  This type wraps around
   1.114  // a preexisting TypeOopPtr and forwards most of it's operations to
   1.115  // the underlying type.  It's only real purpose is to track the
   1.116 @@ -1013,6 +995,14 @@
   1.117  };
   1.118  
   1.119  //------------------------------accessors--------------------------------------
   1.120 +inline bool Type::is_ptr_to_narrowoop() const {
   1.121 +#ifdef _LP64
   1.122 +  return (isa_oopptr() != NULL && is_oopptr()->is_ptr_to_narrowoop_nv());
   1.123 +#else
   1.124 +  return false;
   1.125 +#endif
   1.126 +}
   1.127 +
   1.128  inline float Type::getf() const {
   1.129    assert( _base == FloatCon, "Not a FloatCon" );
   1.130    return ((TypeF*)this)->_f;

mercurial