2010 FRC Java API


com.sun.squawk
Class NativeUnsafe

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

public final class NativeUnsafe
extends Object

A collection of methods for performing peek and poke operations on memory addresses.

Only the public methods of this class which do not override any of the methods in java.lang.Object will be available in a non-hosted environment. The translator replaces any calls to these methods to native method calls.


Field Summary
static int NATIVE_TASK_ARGS_OFFSET
           
static int NATIVE_TASK_EVENTID_OFFSET
           
static int NATIVE_TASK_LOW_RESULT_OFFSET
           
static int NATIVE_TASK_NT_ERRNO_RESULT_OFFSET
           
static int NATIVE_TASK_RESULT_OFFSET
           
 
Method Summary
static void clearObject(Object base, int offset)
          Clears a pointer value in memory.
static void copyMemory(byte[] buffer, int memoryOffset, int bufferOffset, int length)
          Copies a range of memory into a buffer.
static int getNativeTaskErrno(Address ntask)
           
static int getNativeTaskEventID(Address ntask)
           
static int getNativeTaskResult(Address ntask)
           
static int getUByte(Object base, int offset)
           
static void hostedInit()
          Do this little dance to avoid initializing static variables only used in a hosted environment.
static void initialize(byte[] buffer, BitSet oopMap, boolean append)
          Initialize or appends to the contents of memory.
static void setMemorySize(int newSize)
          Sets the size of used/initialized memory.
static int waitForBlockingFunction(Address ntask)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NATIVE_TASK_ARGS_OFFSET

public static final int NATIVE_TASK_ARGS_OFFSET
See Also:
Constant Field Values

NATIVE_TASK_EVENTID_OFFSET

public static final int NATIVE_TASK_EVENTID_OFFSET
See Also:
Constant Field Values

NATIVE_TASK_LOW_RESULT_OFFSET

public static final int NATIVE_TASK_LOW_RESULT_OFFSET
See Also:
Constant Field Values

NATIVE_TASK_NT_ERRNO_RESULT_OFFSET

public static final int NATIVE_TASK_NT_ERRNO_RESULT_OFFSET
See Also:
Constant Field Values

NATIVE_TASK_RESULT_OFFSET

public static final int NATIVE_TASK_RESULT_OFFSET
See Also:
Constant Field Values
Method Detail

clearObject

public static void clearObject(Object base,
                               int offset)
Clears a pointer value in memory.

Parameters:
base - the base address
offset - the offset (in UWords) from base of the pointer to clear

copyMemory

public static void copyMemory(byte[] buffer,
                              int memoryOffset,
                              int bufferOffset,
                              int length)
Copies a range of memory into a buffer.

Parameters:
buffer - the buffer to copy into
memoryOffset - the offset in memory at which to start copying from
bufferOffset - the offset in buffer at which to start copying to
length - the number of bytes to copy

getNativeTaskErrno

public static int getNativeTaskErrno(Address ntask)

getNativeTaskEventID

public static int getNativeTaskEventID(Address ntask)

getNativeTaskResult

public static int getNativeTaskResult(Address ntask)

getUByte

public static int getUByte(Object base,
                           int offset)
See Also:
Unsafe.getUByte(com.sun.squawk.Address, int)

hostedInit

public static void hostedInit()
Do this little dance to avoid initializing static variables only used in a hosted environment. Also used for testing.


initialize

public static void initialize(byte[] buffer,
                              BitSet oopMap,
                              boolean append)
Initialize or appends to the contents of memory.

Parameters:
buffer - a buffer containing a serialized object memory relative to 0
oopMap - an oop map specifying where the pointers in the serialized object memory are
append - specifies if the memory is being appended to

setMemorySize

public static void setMemorySize(int newSize)
Sets the size of used/initialized memory. If the new size is less than the current size, all memory locations at index newSize and greater are zeroed.

Parameters:
newSize - the new size of memory

waitForBlockingFunction

public static int waitForBlockingFunction(Address ntask)

2010 FRC Java API


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