Sun SPOT API
Green Release  


com.sun.squawk
Class GC

java.lang.Object
  extended by com.sun.squawk.GC
All Implemented Interfaces:
com.sun.squawk.pragma.GlobalStaticFields

public class GC
extends Object
implements com.sun.squawk.pragma.GlobalStaticFields


Constructor Summary
GC()
           
 
Method Summary
static void arraycopy(Object src, int srcPos, Object dst, int dstPos, int lth)
          Copy data from one array to another.
static int calculateOopMapSizeInBytes(int size)
          Calculates the size (in bytes) of an oop map that will have a bit for every word in a memory of a given size.
static long freeMemory()
          Returns the amount of free memory in the system.
static int getArrayLength(Object array)
          Get the length of an array.
static int getHashCode(Object object)
          Get the hashcode for an object.
static Klass getKlass(Object object)
          Get the class of an object.
static boolean inRam(Object object)
          Determines if a given object is in RAM.
static String makeEightBitString(Object oop)
          Change the type of the given object to com.sun.squawk.StringOfBytes.
static String makeSixteenBitString(Object oop)
          Change the type of the given object to java.lang.String.
static int roundUpToWord(int value)
          Rounds up a 32 bit value to the next word boundry.
static void stringcopy(Object src, int srcPos, Object dst, int dstPos, int lth)
          Copy data from one string to another.
static long totalMemory()
          Returns the total amount of RAM memory in the Squawk Virtual Machine.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GC

public GC()
Method Detail

roundUpToWord

public static int roundUpToWord(int value)
Rounds up a 32 bit value to the next word boundry.

Parameters:
value - the value to round up
Returns:
the result

inRam

public static boolean inRam(Object object)
Determines if a given object is in RAM.

Parameters:
object - the object to test
Returns:
true if object is an instance in RAM

calculateOopMapSizeInBytes

public static int calculateOopMapSizeInBytes(int size)
Calculates the size (in bytes) of an oop map that will have a bit for every word in a memory of a given size.

Parameters:
size - the size (in bytes) of the memory that the oop map will describe
Returns:
the size (in bytes) of an oop map that will have a bit for every word in a memory region of size size bytes

getKlass

public static Klass getKlass(Object object)
Get the class of an object.

Parameters:
object - the object
Returns:
its class

getArrayLength

public static int getArrayLength(Object array)
                          throws com.sun.squawk.pragma.ForceInlinedPragma
Get the length of an array.

Parameters:
array - the array
Returns:
the length in elements of the array
Throws:
com.sun.squawk.pragma.ForceInlinedPragma

arraycopy

public static void arraycopy(Object src,
                             int srcPos,
                             Object dst,
                             int dstPos,
                             int lth)
Copy data from one array to another.

Parameters:
src - the source array
srcPos - the start position in the source array
dst - the destination array
dstPos - the start position in the destination array
lth - number of elements to copy

stringcopy

public static void stringcopy(Object src,
                              int srcPos,
                              Object dst,
                              int dstPos,
                              int lth)
Copy data from one string to another.

Parameters:
src - the source string
srcPos - the start position in the source string
dst - the destination string
dstPos - the start position in the destination string
lth - number of characters to copy

makeEightBitString

public static String makeEightBitString(Object oop)
Change the type of the given object to com.sun.squawk.StringOfBytes.

Parameters:
oop - the object
Returns:
the converted object

makeSixteenBitString

public static String makeSixteenBitString(Object oop)
Change the type of the given object to java.lang.String.

Parameters:
oop - the object
Returns:
the converted object

getHashCode

public static int getHashCode(Object object)
Get the hashcode for an object.

Parameters:
object - the object the hashcode is needed for.
Returns:
the hashcode

freeMemory

public static long freeMemory()
Returns the amount of free memory in the system. Calling the gc method may result in increasing the value returned by freeMemory.

Returns:
an approximation to the total amount of memory currently available for future allocated objects, measured in bytes.

totalMemory

public static long totalMemory()
Returns the total amount of RAM memory in the Squawk Virtual Machine. The value returned by this method may vary over time, depending on the host environment.

Note that the amount of memory required to hold an object of any given type may be implementation-dependent.

Returns:
the total amount of memory currently available for current and future objects, measured in bytes.

Sun SPOT API
Green Release  


Copyright © 2006 Sun Microsystems, Inc. All Rights Reserved.