示例#1
0
文件: Magic.java 项目: alanweide/coff
  /**
   * Cast bits.
   *
   * @param address object reference as bits
   * @return object reference
   */
  public static Object addressAsObject(Address address) {
    if (VM.runningVM && VM.VerifyAssertions) {
      VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler
    }

    if (objectAddressRemapper == null) {
      return null; // tool isn't interested in remapping
    }

    return objectAddressRemapper.addressAsObject(address);
  }
示例#2
0
文件: Magic.java 项目: alanweide/coff
  /**
   * Certain objects aren't replicated in the boot image to save space.
   *
   * @param object to intern
   * @return interned object
   */
  public static <T> T bootImageIntern(T object) {
    if (VM.runningVM && VM.VerifyAssertions) {
      VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler
    }

    if (objectAddressRemapper == null) {
      return object; // tool isn't interested in remapping
    }

    return objectAddressRemapper.intern(object);
  }
示例#3
0
文件: Magic.java 项目: alanweide/coff
  /**
   * Certain objects aren't replicated in the boot image to save space.
   *
   * @param object to intern
   * @return interned object
   */
  public static int bootImageIdentityHashCode(Object object) {
    if (VM.runningVM && VM.VerifyAssertions) {
      VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler
    }

    if (objectAddressRemapper == null) {
      // shouldn't create identity hash codes when we cannot record the effect, ignore if we're
      // running a tool
      if (VM.VerifyAssertions) VM._assert(VM.runningTool || VM.writingImage);
      return System.identityHashCode(object);
    }

    return objectAddressRemapper.identityHashCode(object);
  }