< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/RobustOopDeterminator.java

Print this page
*** 24,10 ***
--- 24,11 ---
  
  package sun.jvm.hotspot.utilities;
  
  import sun.jvm.hotspot.debugger.*;
  import sun.jvm.hotspot.oops.Metadata;
+ import sun.jvm.hotspot.oops.Oop;
  import sun.jvm.hotspot.runtime.*;
  import sun.jvm.hotspot.types.*;
  
  /** This class determines to the best of its ability, and in a
      reasonably robust fashion, whether a given pointer is an intact

*** 35,44 ***
      metaclass hierarchy. This is only intended for use in the
      debugging system. It may provide more resilience to unexpected VM
      states than the ObjectHeap code. */
  
  public class RobustOopDeterminator {
-   private static AddressField klassField;
- 
-   static {
-     VM.registerVMInitializedObserver(new Observer() {
-         public void update(Observable o, Object data) {
-           initialize(VM.getVM().getTypeDataBase());
-         }
-       });
-   }
- 
-   private static void initialize(TypeDataBase db) {
-     Type type = db.lookupType("oopDesc");
- 
-     if (VM.getVM().isCompressedKlassPointersEnabled()) {
-       klassField = type.getAddressField("_metadata._compressed_klass");
-     } else {
-       klassField = type.getAddressField("_metadata._klass");
-     }
-   }
- 
    public static boolean oopLooksValid(OopHandle oop) {
      if (oop == null) {
        return false;
      }
      if (!VM.getVM().getUniverse().isIn(oop)) {
        return false;
      }
      try {
        // Try to instantiate the Klass
!       if (VM.getVM().isCompressedKlassPointersEnabled()) {
-         Metadata.instantiateWrapperFor(oop.getCompKlassAddressAt(klassField.getOffset()));
-       } else {
-         Metadata.instantiateWrapperFor(klassField.getValue(oop));
-       }
        return true;
      } catch (AddressException | WrongTypeException e) {
        return false;
      }
    }
--- 36,20 ---
      metaclass hierarchy. This is only intended for use in the
      debugging system. It may provide more resilience to unexpected VM
      states than the ObjectHeap code. */
  
  public class RobustOopDeterminator {
    public static boolean oopLooksValid(OopHandle oop) {
      if (oop == null) {
        return false;
      }
      if (!VM.getVM().getUniverse().isIn(oop)) {
        return false;
      }
      try {
        // Try to instantiate the Klass
!       Oop.getKlassForOopHandle(oop);
        return true;
      } catch (AddressException | WrongTypeException e) {
        return false;
      }
    }
< prev index next >