Exemplo n.º 1
0
 /** Find field in direct superinterfaces. */
 public Field findInterfaceField(Symbol name, Symbol sig) {
   ObjArray interfaces = getLocalInterfaces();
   int n = (int) interfaces.getLength();
   for (int i = 0; i < n; i++) {
     InstanceKlass intf1 = (InstanceKlass) interfaces.getObjAt(i);
     if (Assert.ASSERTS_ENABLED) {
       Assert.that(intf1.isInterface(), "just checking type");
     }
     // search for field in current interface
     Field f = intf1.findLocalField(name, sig);
     if (f != null) {
       if (Assert.ASSERTS_ENABLED) {
         Assert.that(f.getAccessFlagsObj().isStatic(), "interface field must be static");
       }
       return f;
     }
     // search for field in direct superinterfaces
     f = intf1.findInterfaceField(name, sig);
     if (f != null) return f;
   }
   // otherwise field lookup fails
   return null;
 }
  /** Only returns addresses of valid OopHandles */
  private Address getOopHandleAddress(int x) {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(x < top(), "out of bounds");
    }

    Address oopAddr = addr.addOffsetTo(handlesField.getOffset() + x * VM.getVM().getOopSize());
    OopHandle handle = oopAddr.getOopHandleAt(0);
    if (VM.getVM().getUniverse().isInReserved(handle)
        && !VM.getVM().getJNIHandles().isDeletedHandle(handle)) {
      /* the oop handle is valid only if it is not freed (i.e. reserved in heap) and is not a deleted oop */
      return oopAddr;
    } else {
      return null;
    }
  }
 public String toString() {
   Address handleBase = addr.addOffsetTo(handlesField.getOffset());
   Address handleEnd =
       addr.addOffsetTo(handlesField.getOffset() + top() * VM.getVM().getOopSize());
   return "JNIHandleBlock [" + handleBase + ", " + handleEnd + ")";
 }