"

2013 FRC Java API

"

com.sun.squawk
Class ObjectMemory

java.lang.Object
  extended by com.sun.squawk.ObjectMemory

public final class ObjectMemory
extends Object

An ObjectMemory instance is an immutable wrapper for an object memory and its metadata.


Field Summary
static String BOOTSTRAP_URI
          The reserved URI denoting the bootstrap suite.
static String BOOTSTRAP_URI_PROPERTY
          The property name used to specify a different default than squawk.suite for the bootstrap suite.
 
Constructor Summary
ObjectMemory(Address start, int size, String uri, Object root, int hash, ObjectMemory parent)
          Constructs a new object memory file.
 
Method Summary
 boolean containsAddress(Address address)
          Determines if this object memory contains a given address.
 boolean containsCanonicalAddress(Address canonicalAddress)
          Determines if this object memory contains a given canonical address.
static ObjectMemory createBootstrapObjectMemory(Suite bootstrapSuite)
          Creates an ObjectMemory that is a wrapper for the bootstrap suite.
 ObjectMemory findAddress(Address address)
          Searches up a chain of object memories starting from this one for a given physical address.
 ObjectMemory findCanonicalAddress(Address canonicalAddress)
          Searches up a chain of object memories starting from this one for a given canonical address.
 Address fromCanonical(Address canonicalAddress)
          Converts a canonical address that is within the range of this object memory into a physical address.
 Address getCanonicalEnd()
          Gets the address one byte past the end of the canonical object memory.
 Address getCanonicalStart()
          Gets the canonical starting address of this object memory.
 Address getEnd()
          Gets the address one byte past the end of the object memory.
 int getHash()
          Gets the hash of the canonical form of this object memory.
 ObjectMemory getParent()
          Gets the direct parent object memory of this object memory.
 int getParentCount()
          Gets the number of parents in the chain of parent object memories.
 Object getRoot()
          Gets the root object in this object memory.
 int getSize()
          Gets the size (in bytes) of the object memory.
 Address getStart()
          Gets the start address of the object memory.
 String getURI()
          Gets the URI identifiying this object memory.
static void relocate(String uri, Object sourceStartBuffer, Address sourceStart, BitSet oopMap, Address targetStart, Address targetCanonicalStart, int targetSize, boolean toCanonical, boolean requiresEndianSwap, boolean trace, boolean verifyClearOopMap)
          Relocates the pointers in a range of memory that point to some target range of memory.
static void relocateParents(String uri, Object startBuffer, Address start, BitSet oopMap, ObjectMemory parent, boolean toCanonical, boolean requiresEndianSwap, boolean trace)
          Relocate all the pointers in a range of memory that point to one or more parent object memories.
 Address toCanonical(Address address)
          Converts a physical address that is within the range of this object memory into a canonical address.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOTSTRAP_URI

public static final String BOOTSTRAP_URI
The reserved URI denoting the bootstrap suite.

See Also:
Constant Field Values

BOOTSTRAP_URI_PROPERTY

public static final String BOOTSTRAP_URI_PROPERTY
The property name used to specify a different default than squawk.suite for the bootstrap suite.

See Also:
Constant Field Values
Constructor Detail

ObjectMemory

public ObjectMemory(Address start,
                    int size,
                    String uri,
                    Object root,
                    int hash,
                    ObjectMemory parent)
Constructs a new object memory file.

Parameters:
start - the start address of the object memory.
size - the size (in bytes) of the object memory
uri - the URI identifying this object memory
root - the root of the serialized graph in the object memory
hash - the hash object memory in canonical form
parent - the direct parent object memory
Method Detail

createBootstrapObjectMemory

public static ObjectMemory createBootstrapObjectMemory(Suite bootstrapSuite)
Creates an ObjectMemory that is a wrapper for the bootstrap suite.

Parameters:
bootstrapSuite -
Returns:
an ObjectMemory that is a wrapper for the bootstrap suite

getCanonicalStart

public Address getCanonicalStart()
Gets the canonical starting address of this object memory. This address is computed as the sum of the size of all the parent object memories.

Returns:
the canonical starting address of this object memory

getCanonicalEnd

public Address getCanonicalEnd()
Gets the address one byte past the end of the canonical object memory.

Returns:
the address one byte past the end of the canonical object memory

getSize

public int getSize()
Gets the size (in bytes) of the object memory.

Returns:
the size of the object memory

getRoot

public Object getRoot()
Gets the root object in this object memory.

Returns:
the root object in this object memory

getParent

public ObjectMemory getParent()
Gets the direct parent object memory of this object memory.

Returns:
the direct parent object memory of this object memory

getParentCount

public int getParentCount()
Gets the number of parents in the chain of parent object memories.

Returns:
the number of parents in the chain of parent object memories

getHash

public int getHash()
Gets the hash of the canonical form of this object memory.

Returns:
the hash of the canonical form of this object memory

getURI

public String getURI()
Gets the URI identifiying this object memory. If this is the object memory containing the bootstrap suite, then "memory:bootstrap" is returned.

Returns:
the URI identifying this object memory

getStart

public Address getStart()
Gets the start address of the object memory.

Returns:
the address of the object memory

getEnd

public Address getEnd()
Gets the address one byte past the end of the object memory.

Returns:
the address one byte past the end of the object memory

containsAddress

public boolean containsAddress(Address address)
Determines if this object memory contains a given address.

Parameters:
address - the address to test
Returns:
true if this ObjectMemory contains address

containsCanonicalAddress

public boolean containsCanonicalAddress(Address canonicalAddress)
Determines if this object memory contains a given canonical address.

Parameters:
canonicalAddress - the address to test
Returns:
true if this ObjectMemory contains canonicalAddress

findAddress

public ObjectMemory findAddress(Address address)
Searches up a chain of object memories starting from this one for a given physical address. The given address must be within the chain of object memories.

Parameters:
address - the address to search for
Returns:
the ObjectMemory in which address lies

findCanonicalAddress

public ObjectMemory findCanonicalAddress(Address canonicalAddress)
Searches up a chain of object memories starting from this one for a given canonical address. The given address must be within the chain of object memories.

Parameters:
canonicalAddress - the canonical address to search for
Returns:
the ObjectMemory in which canonicalAddress lies

toCanonical

public Address toCanonical(Address address)
Converts a physical address that is within the range of this object memory into a canonical address.

Parameters:
address - the physical address to convert
Returns:
the canonical corresponding to address

fromCanonical

public Address fromCanonical(Address canonicalAddress)
Converts a canonical address that is within the range of this object memory into a physical address.

Parameters:
canonicalAddress - the canonical address to convert
Returns:
the physical corresponding to canonicalAddress

relocateParents

public static void relocateParents(String uri,
                                   Object startBuffer,
                                   Address start,
                                   BitSet oopMap,
                                   ObjectMemory parent,
                                   boolean toCanonical,
                                   boolean requiresEndianSwap,
                                   boolean trace)
Relocate all the pointers in a range of memory that point to one or more parent object memories.

Parameters:
uri - the URI of the source memory whose pointers are being relocated
startBuffer - the object containing the source memory if it is in a RAM buffer otherwise null
start - the start address of the source memory
oopMap - describes where all the not yet relocated pointers in the source memory are. The bits are are cleared as the corresponding pointers are relocated.
parent - the direct parent memory of the given memory
toCanonical - specifies the direction of the relocation
requiresEndianSwap - specifies if the endianess of the pointers differs from the endianess of the platform
trace - enables tracing if true

relocate

public static void relocate(String uri,
                            Object sourceStartBuffer,
                            Address sourceStart,
                            BitSet oopMap,
                            Address targetStart,
                            Address targetCanonicalStart,
                            int targetSize,
                            boolean toCanonical,
                            boolean requiresEndianSwap,
                            boolean trace,
                            boolean verifyClearOopMap)
                     throws com.sun.squawk.ObjectMemory.GCDuringRelocationError
Relocates the pointers in a range of memory that point to some target range of memory. If toCanonical is true, then the pointers are currently relative to the real address of the target memory and are adjusted to be relative to its canonical address. Otherwise, the pointers are currently relative to the canonical address of the target memory and are adjusted to be relative to its real address.

Parameters:
uri - the URI of the source memory whose pointers are being relocated
sourceStartBuffer - the object containing the source memory if it is in a RAM buffer otherwise null
sourceStart - the start address of the source memory
oopMap - describes where all the not yet relocated pointers in the source memory are. The bits are are cleared as the corresponding pointers are relocated.
targetStart - the real start address of the target space
targetCanonicalStart - the canonical start address of the target space
targetSize - the size of the target space
toCanonical - specifies the direction of the relocation
requiresEndianSwap - specifies if the endianess of the pointers differs from the endianess of the platform
trace - enables tracing if true
verifyClearOopMap - if true, this routine will verify that the oop map is empty before returning
Throws:
GCDuringRelocationError - if 'sourceStartBuffer' is not null and some point has a different value than 'sourceStart' which implies that a garbage collection occurred
com.sun.squawk.ObjectMemory.GCDuringRelocationError

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"