fr.umlv.corosol.component
Interface JReferenceManager

All Superinterfaces:
JObject, JVMComponent
All Known Implementing Classes:
DefaultJReferenceManager

public interface JReferenceManager
extends JVMComponent

A JReferenceManager implements the reference representation into Corosol heap memory and permits to read and write objets into it. It also assigns a reference for each heap object and manages the associations between an heap object and its reference.

Author:
Christophe Deleray

Method Summary
 void assignReference(JHeapObject object)
          Assigns a new reference to the specified object and saves the association .
 java.util.Iterator getObjects()
          Returns an iterator over all the referenced objects.
 JHeapObject readReference(JHeap heap, int index)
          Reads a reference value starting at the specified position in the specified heap and returns the object it referents to.
 int sizeofReference(JHeap heap)
          Returns the size of a reference value the size in bytes into the specified Corosol heap.
 JHeapObject wrapNativeObject(java.lang.Object nativeObject)
          Returns the specified object (class instance or array) allocated into the underlaying JVM heap as a JHeapObject object and assigns a new reference to this new object.
 JReturnAddress wrapPC(int pc)
          Returns the returnAddress value corresponding to the specified program counter.
 void writeReference(JHeap heap, int index, JHeapObject object)
          Writes the reference of the specified object at the specified position in the specified heap.
 
Methods inherited from interface fr.umlv.corosol.component.JVMComponent
configure, getComponentClass, replace
 

Method Detail

readReference

JHeapObject readReference(JHeap heap,
                          int index)
Reads a reference value starting at the specified position in the specified heap and returns the object it referents to.

Parameters:
heap - a Corosol heap
index - index at which the reference value is to be read
Returns:
the object which the reference is read in this heap

writeReference

void writeReference(JHeap heap,
                    int index,
                    JHeapObject object)
Writes the reference of the specified object at the specified position in the specified heap.

Parameters:
heap - a Corosol heap
index - index at which the reference value is to be writed
object - the object which reference is to be writed in the heap

sizeofReference

int sizeofReference(JHeap heap)
Returns the size of a reference value the size in bytes into the specified Corosol heap.

Parameters:
heap - a Corosol heap
Returns:
the size of a reference value into the specified heap

assignReference

void assignReference(JHeapObject object)
Assigns a new reference to the specified object and saves the association .

Parameters:
object - a heap object

wrapNativeObject

JHeapObject wrapNativeObject(java.lang.Object nativeObject)
Returns the specified object (class instance or array) allocated into the underlaying JVM heap as a JHeapObject object and assigns a new reference to this new object.

Parameters:
nativeObject - an object allocated into the underlaying JVM heap
Returns:
a JHeapObject wrapping the specified native object

wrapPC

JReturnAddress wrapPC(int pc)
Returns the returnAddress value corresponding to the specified program counter.

Parameters:
pc - a program counter into the bytecode array
Returns:
a returnAddress

getObjects

java.util.Iterator getObjects()
Returns an iterator over all the referenced objects.