fr.umlv.corosol.component.impl
Class JSimpleHeapAllocator

java.lang.Object
  extended by fr.umlv.corosol.component.impl.JSimpleHeapAllocator
All Implemented Interfaces:
JHeapAllocator, JObject, JVMComponent

public class JSimpleHeapAllocator
extends java.lang.Object
implements JHeapAllocator

A JHeapAllocator represents an allocator for the memory heap.

Author:
Christophe Deleray

Constructor Summary
JSimpleHeapAllocator()
          Creates a new JSimpleHeapAllocator instance.
 
Method Summary
 JArray allocateArray(JClass componentType, int length)
          Returns a new allocated array with the specified component type and length.
 JArray allocateArray(JClass componentType, int[] dimensions)
          Returns a new allocated array with the specified component type and dimensions.
 JClassInstance allocateClassInstance(JClass c)
          Returns a new allocated class instance of the specified type.
 JavaStack allocateJavaStack(int size)
          Returns a new allocated Java stack of the specified number of bytes.
 void configure(JVirtualMachine jvm)
          Configures the allocator via the specified JVM.
 java.lang.Class getComponentClass()
          Returns the class object describing this component.
 void moveAllocatables(JHeap srcHeap, JHeap destHeap)
           
 void replace(JVMComponent component)
          Replaces the data of this allocator by the data of the specified component.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSimpleHeapAllocator

public JSimpleHeapAllocator()
Creates a new JSimpleHeapAllocator instance.

Method Detail

configure

public void configure(JVirtualMachine jvm)
Configures the allocator via the specified JVM.

Specified by:
configure in interface JVMComponent
Parameters:
jvm - the Java Virtual Machine

getComponentClass

public java.lang.Class getComponentClass()
Returns the class object describing this component.

Specified by:
getComponentClass in interface JVMComponent

replace

public void replace(JVMComponent component)
Replaces the data of this allocator by the data of the specified component. The type of component must be the type of this component.

Specified by:
replace in interface JVMComponent
Parameters:
component - a component to be used to initialize this component

allocateClassInstance

public JClassInstance allocateClassInstance(JClass c)
Returns a new allocated class instance of the specified type.

Specified by:
allocateClassInstance in interface JHeapAllocator
Parameters:
c - the class to be instanciated
Returns:
a new instance of the specified class

allocateArray

public JArray allocateArray(JClass componentType,
                            int length)
Returns a new allocated array with the specified component type and length.

Specified by:
allocateArray in interface JHeapAllocator
Parameters:
componentType - the JClass object representing the component type of the new array
length - the length of the new array
Returns:
the new array

allocateArray

public JArray allocateArray(JClass componentType,
                            int[] dimensions)
Returns a new allocated array with the specified component type and dimensions.

Specified by:
allocateArray in interface JHeapAllocator
Parameters:
componentType - the JClass object representing the component type of the new array
dimensions - an array of int types representing the dimensions of the new array
Returns:
the new array

allocateJavaStack

public JavaStack allocateJavaStack(int size)
Returns a new allocated Java stack of the specified number of bytes.

Specified by:
allocateJavaStack in interface JHeapAllocator
Parameters:
size - the size of the newly allocated Java stack in bytes

moveAllocatables

public void moveAllocatables(JHeap srcHeap,
                             JHeap destHeap)
Specified by:
moveAllocatables in interface JHeapAllocator