001 /*
002 * This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 * This file is licensed to You under the Eclipse Public License (EPL);
005 * You may not use this file except in compliance with the License. You
006 * may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 * See the COPYRIGHT.txt file distributed with this work for information
011 * regarding copyright ownership.
012 */
013 package org.jikesrvm.runtime;
014
015 import org.vmmagic.unboxed.Address;
016
017 /**
018 * Facility for remapping object addresses across virtual machine address
019 * spaces. Used by boot image writer to map local (jdk) objects into remote
020 * (boot image) addresses. Used by debugger to map local (jdk) objects into
021 * remote (debugee vm) addresses.
022 *
023 * See also Magic.setObjectAddressRemapper()
024 */
025 public interface ObjectAddressRemapper {
026 /**
027 * Map an object to an address.
028 * @param object in "local" virtual machine
029 * @return its address in a foreign virtual machine
030 */
031 <T> Address objectAsAddress(T object);
032
033 /**
034 * Map an address to an object.
035 * @param address value obtained from "objectAsAddress"
036 * @return corresponding object
037 */
038 Object addressAsObject(Address address);
039
040 /**
041 * Avoid duplicates of certain objects
042 * @param object to intern
043 * @return interned object
044 */
045 <T> T intern(T object);
046
047 /**
048 * Identity hash code of an object
049 *
050 * @param object the object to generate the identity hash code for
051 * @return the identity hash code
052 */
053 int identityHashCode(Object object);
054 }