< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Oop.java

Print this page

 87     }
 88   }
 89 
 90   public boolean isA(Klass k) {
 91     return getKlass().isSubtypeOf(k);
 92   }
 93 
 94   // Returns the byte size of this object
 95   public long getObjectSize() {
 96     Klass k = getKlass();
 97     // All other types should be overriding getObjectSize directly
 98     return ((InstanceKlass)k).getObjectSize(this);
 99   }
100 
101   // Type test operations
102   public boolean isInstance()          { return false; }
103   public boolean isInstanceRef()       { return false; }
104   public boolean isArray()             { return false; }
105   public boolean isObjArray()          { return false; }
106   public boolean isTypeArray()         { return false; }

107   public boolean isThread()            { return false; }
108 
109   // Align the object size.
110   public static long alignObjectSize(long size) {
111     return VM.getVM().alignUp(size, VM.getVM().getMinObjAlignmentInBytes());
112   }
113 
114   // All vm's align longs, so pad out certain offsets.
115   public static long alignObjectOffset(long offset) {
116     return VM.getVM().alignUp(offset, VM.getVM().getBytesPerLong());
117   }
118 
119   public boolean equals(Object obj) {
120     if (obj instanceof Oop other) {
121       return getHandle().equals(other.getHandle());
122     }
123     return false;
124  }
125 
126   public int hashCode() { return getHandle().hashCode(); }

 87     }
 88   }
 89 
 90   public boolean isA(Klass k) {
 91     return getKlass().isSubtypeOf(k);
 92   }
 93 
 94   // Returns the byte size of this object
 95   public long getObjectSize() {
 96     Klass k = getKlass();
 97     // All other types should be overriding getObjectSize directly
 98     return ((InstanceKlass)k).getObjectSize(this);
 99   }
100 
101   // Type test operations
102   public boolean isInstance()          { return false; }
103   public boolean isInstanceRef()       { return false; }
104   public boolean isArray()             { return false; }
105   public boolean isObjArray()          { return false; }
106   public boolean isTypeArray()         { return false; }
107   public boolean isFlatArray()         { return false; }
108   public boolean isThread()            { return false; }
109 
110   // Align the object size.
111   public static long alignObjectSize(long size) {
112     return VM.getVM().alignUp(size, VM.getVM().getMinObjAlignmentInBytes());
113   }
114 
115   // All vm's align longs, so pad out certain offsets.
116   public static long alignObjectOffset(long offset) {
117     return VM.getVM().alignUp(offset, VM.getVM().getBytesPerLong());
118   }
119 
120   public boolean equals(Object obj) {
121     if (obj instanceof Oop other) {
122       return getHandle().equals(other.getHandle());
123     }
124     return false;
125  }
126 
127   public int hashCode() { return getHandle().hashCode(); }
< prev index next >