|
SunSPOT API V4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.squawk.VM
public class VM
This is a Squawk VM specific class that is used to communicate between executing Java software and the low level core VM that is expressed in machine code. There are two parts to this. There are a set of native methods that are used to invoke very low level operations like manipulating memory at a very low level or performing I/O. In the other direction there are a number of methods that the low level core may call. These are used to implement high level operations that are better done in Java than in machine code.
A special version of this class exists for the romizer. The romizer version only implements the methods used to manipulate memory.
Nested Class Summary | |
---|---|
static class |
VM.Stats
Virtual machine statistics. |
Field Summary | |
---|---|
static int |
MAX_SYS_PRIORITY
The maximum priority that a system thread can have. |
static int |
STREAM_STDERR
The identifier denoting the standard error output stream. |
static int |
STREAM_STDOUT
The identifier denoting the standard output stream. |
Method Summary | |
---|---|
static void |
allowUserGC(boolean value)
Enable or disable Runtime.gc() |
static long |
branchCount()
Enables a dynamically loaded class to call this. |
static void |
collectGarbage(boolean forceFullGC)
Switch to the service stack and call 'GC.collectGarbage()' |
static int |
execGraphicsIO(int op,
int i1,
int i2,
int i3,
int i4,
int i5,
int i6,
Object send,
Object receive)
Not used on embedded devices. |
static int |
execIO(int op,
int channel,
int i1,
int i2,
int i3,
int i4,
int i5,
int i6,
Object send,
Object receive)
Executes a I/O operation that may block. |
static long |
execIOLong(int op,
int channel,
int i1,
int i2,
int i3,
int i4,
int i5,
int i6,
Object send,
Object receive)
Executes an I/O operation that returns a long value. |
static int |
execSyncIO(int op,
int i1)
Executes a non-blocking I/O operation whose result is guaranteed to be available immediately. |
static int |
execSyncIO(int context,
int op,
int i1,
int i2,
int i3,
int i4,
int i5,
int i6,
Object send,
Object receive)
Executes a non-blocking I/O operation whose result is guaranteed to be available immediately. |
static int |
execSyncIO(int op,
int i1,
int i2,
int i3,
int i4,
int i5,
int i6,
Object send,
Object receive)
Executes a non-blocking I/O operation whose result is guaranteed to be available immediately. |
static Address |
getBootstrapEnd()
Gets the address at which the object memory containing the bootstrap suite ends. |
static int |
getBootstrapHash()
Gets the hash of the object memory containing the bootstrap suite in it's canonical (i.e. relative to address 0) form. |
static Address |
getBootstrapStart()
Gets the address at which the object memory containing the bootstrap suite starts. |
static Object |
getClass(Object object)
Support routine to get the object representing the class of a given object. |
static Isolate |
getCurrentIsolate()
Gets the isolate of the currently executing thread. |
static char |
getFileSeparatorChar()
The system-dependent default name-separator character. |
static long |
getGUIEvent()
Not used on embedded devices. |
static Object |
getKeyedGlobal(int key)
Return the global registered using setGlobal with key. |
static Object |
getKeyedGlobalsMutex()
|
static Hashtable |
getManifestPropertiesOfSuite(String uri)
A helper method to provide access to the manifest of midlet suites from outside the bootstrap. |
static String |
getManifestProperty(String name)
Gets the value of an Suite#PROPERTIES_MANIFEST_RESOURCE_NAME property embedded in the suite. |
static Enumeration |
getManifestPropertyNames()
Gets the names of all manifest properties embedded in the leaf suite and all of its parents. |
static char |
getPathSeparatorChar()
The system-dependent path-separator character. |
static PeripheralRegistry |
getPeripheralRegistry()
|
static Address |
getRomStart()
Gets the address of the start of the object memory in ROM. |
static Thread[] |
getRunnableThreads()
Answer an array of threads that are runnable now, in the order they appear in the runnable queue. |
static long |
getTimeBeforeAnotherThreadIsRunnable()
Answer the time in millis until another thread is runnable. |
static long |
getTimeMicros()
Gets the current time. |
static long |
getTimeMillis()
Gets the current time. |
static void |
haltVM(int code)
Halt the VM without running exit hooks. |
static void |
invokeMain(String className,
String[] args)
Call the main method of the specified class |
static boolean |
isArray(Object o)
Support routine to test whether a given object is an array. |
static boolean |
isCurrentIsolateInitialized()
Determines if the current isolate is set and initialized. |
static boolean |
isHosted()
Determines if code running at the moment is running inside of a Squawk VM or a JSE VM. |
static boolean |
isVerbose()
Gets the flag indicating if the VM is running in verbose mode. |
static boolean |
isVeryVerbose()
Gets the flag indicating if the VM is running in very verbose mode. |
static void |
outPrint(long val)
Print val safely to System.err, or to VM.print if that fails. |
static void |
outPrint(PrintStream stream,
long val)
Print val safely to Stream, or to VM.print if that fails. |
static void |
outPrint(PrintStream stream,
String str)
Print str safely to Stream, or to VM.print if that fails. |
static void |
outPrint(String str)
Print str safely to System.err, or to VM.print if that fails. |
static void |
outPrintBC()
Print branch count as safely as possible. |
static void |
outPrintln()
Print new line safely to System.err, or to VM.print if that fails. |
static void |
outPrintln(PrintStream stream)
Print new line safely to Stream, or to VM.print if that fails. |
static void |
outPrintln(PrintStream stream,
String str)
Print str safely to Stream, or to VM.print if that fails. |
static void |
outPrintln(String str)
Print str safely to System.err, or to VM.print if that fails. |
static void |
print(boolean b)
Prints a boolean to the VM output stream. |
static void |
print(char x)
Prints a character to the VM output stream. |
static void |
print(double x)
Prints a double to the VM output stream. |
static void |
print(float x)
Prints a float to the VM output stream. |
static void |
print(int x)
Prints an integer to the VM output stream. |
static void |
print(long x)
Prints a long to the VM output stream. |
static void |
print(String x)
Prints a string to the VM output stream. |
static void |
printAddress(Address val)
Prints an address to the VM stream. |
static void |
printAddress(Object val)
Prints an address to the VM stream. |
static Throwable |
printExceptionAndTrace(Throwable exc,
String msg)
Safely print exception and stack trace to System.err. |
static Throwable |
printExceptionAndTrace(Throwable exc,
String msg,
boolean printUsingThrowable)
Safely print exception and stack trace to System.err. |
static void |
println()
Prints a new line to the VM output stream. |
static void |
println(boolean x)
Prints a boolean followed by a new line to the VM output stream. |
static void |
println(char x)
Prints a character followed by a new line to the VM output stream. |
static void |
println(double x)
Prints a double followed by a new line to the VM output stream. |
static void |
println(float x)
Prints a float followed by a new line to the VM output stream. |
static void |
println(int x)
Prints an integer followed by a new line to the VM output stream. |
static void |
println(long x)
Prints a long followed by a new line to the VM output stream. |
static void |
println(String x)
Prints a string followed by a new line to the VM output stream. |
static void |
printObject(Object obj)
Prints the string representation of an object to the VM stream. |
static void |
printOffset(Offset val)
Prints an offset to the VM stream. |
static void |
printUWord(UWord val)
Prints an unsigned word to the VM stream. |
static Object |
putKeyedGlobal(int key,
Object value)
Set the global registered for key. |
static void |
setAsDaemonThread(Thread t)
Mark the specified thread to be a daemon thread (won't prevent VM from exiting). |
static void |
setProperty(String name,
String value)
On a hosted system , this calls System.setProperty(), otherwise calls Isolate.currentIsolate().setProperty() |
static int |
setStream(int stream)
Sets the stream for the VM.print... methods to one of the STREAM_... constants. |
static void |
setSystemThreadPriority(Thread t,
int level)
Sets the given thread to the given priority, bounded by MAX_SYS_PRIORITY (eg. allowing higher than normal priority levels) Note that threads created by a thread with "system" priority do not inherit the system priority level, but default to NORM_PRIORITY. |
static Object |
shallowCopy(Object original)
Perform a shallow copy of the original object, without calling a constructor WARNING: This is bypassing the write barrier, which is (sort of) OK because we are writing to a new object. |
static void |
startTracing()
Start the VM tracing if tracing support is enabled. |
static void |
stopVM(int code)
Halt the VM in the normal way. |
static void |
unregisterSuite(String uri)
If the suite is registered, unregister it with the garbage collector. |
static boolean |
userGCAllowed()
Tests if Runtime.gc() is allowed. |
static boolean |
usingTypeMap()
Determines if the VM was built with memory access type checking enabled. |
static long |
waitForDeepSleep(long minimumDeepSleepTime)
Wait until it's possible that we can go to deep sleep. |
static void |
waitForInterrupt(int irq)
Waits for an interrupt. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_SYS_PRIORITY
public static final int STREAM_STDERR
public static final int STREAM_STDOUT
Method Detail |
---|
public static void allowUserGC(boolean value)
value
- true to enablepublic static long branchCount()
public static void collectGarbage(boolean forceFullGC)
forceFullGC
- forces a collection of the whole heap
NotInlinedPragma
- as the frame of this method will be the inner most frame on the
current thread's stack. The inner most frame on any stack does
not have it's local variables scanned by the garbage collector.
As such, this method must not use any local variables.public static int execGraphicsIO(int op, int i1, int i2, int i3, int i4, int i5, int i6, Object send, Object receive)
public static int execIO(int op, int channel, int i1, int i2, int i3, int i4, int i5, int i6, Object send, Object receive) throws IOException
op
- the opcodechannel
- the channel numberi1
- an integer parameteri2
- an integer parameteri3
- an integer parameteri4
- an integer parameteri5
- an integer parameteri6
- an integer parametersend
- an outgoing array parameterreceive
- an incoming array parameter
IOException
public static long execIOLong(int op, int channel, int i1, int i2, int i3, int i4, int i5, int i6, Object send, Object receive) throws IOException
long
value.
op
- the opcodechannel
- the channel identifieri1
- an integer parameteri2
- an integer parameteri3
- an integer parameteri4
- an integer parameteri5
- an integer parameteri6
- an integer parametersend
- a outgoing reference parameterreceive
- an incoming reference parameter (i.e. an array of some type)
IOException
public static int execSyncIO(int op, int i1)
op
- the opcodei1
- an integer parameter
public static int execSyncIO(int context, int op, int i1, int i2, int i3, int i4, int i5, int i6, Object send, Object receive)
context
- the I/O contextop
- the opcodei1
- an integer parameteri2
- an integer parameteri3
- an integer parameteri4
- an integer parameteri5
- an integer parameteri6
- an integer parametersend
- an outgoing array parameterreceive
- an incoming array parameter
public static int execSyncIO(int op, int i1, int i2, int i3, int i4, int i5, int i6, Object send, Object receive)
op
- the opcodei1
- an integer parameteri2
- an integer parameteri3
- an integer parameteri4
- an integer parameteri5
- an integer parameteri6
- an integer parametersend
- an outgoing array parameterreceive
- an incoming array parameter
public static Address getBootstrapEnd()
public static int getBootstrapHash()
public static Address getBootstrapStart()
public static Object getClass(Object object)
object
-
public static Isolate getCurrentIsolate()
public static char getFileSeparatorChar()
file.separator
. On UNIX systems the value of this
field is '/'
; on Microsoft Windows systems it is '\'
.
System.getProperty(java.lang.String)
public static long getGUIEvent()
public static Object getKeyedGlobal(int key)
synchronized (VM.getGlobalsMutex()) {
// access/manipulate globals here ...
}
key
-
public static Object getKeyedGlobalsMutex()
public static Hashtable getManifestPropertiesOfSuite(String uri)
uri
- suite's uri
public static String getManifestProperty(String name)
Suite#PROPERTIES_MANIFEST_RESOURCE_NAME
property embedded in the suite.
name
- the name of the property whose value is to be retrieved
public static Enumeration getManifestPropertyNames()
public static char getPathSeparatorChar()
':'
; on Windows
systems it is ';'
.
public static PeripheralRegistry getPeripheralRegistry()
public static Address getRomStart()
public static Thread[] getRunnableThreads()
public static long getTimeBeforeAnotherThreadIsRunnable()
public static long getTimeMicros()
public static long getTimeMillis()
public static void haltVM(int code)
code
- the exit status code.public static void invokeMain(String className, String[] args) throws ClassNotFoundException
className
- the name of the class whose main method is to be runargs
- the arguments to be passed to the main method
ClassNotFoundException
- if the class is not foundpublic static boolean isArray(Object o)
o
- object to test
public static boolean isCurrentIsolateInitialized()
public static boolean isHosted()
public static boolean isVerbose()
public static boolean isVeryVerbose()
public static void outPrint(long val)
val
- long to printpublic static void outPrint(PrintStream stream, long val)
stream
- stream to print onval
- long to printpublic static void outPrint(PrintStream stream, String str)
stream
- stream to print onstr
- string to printpublic static void outPrint(String str)
str
- string to printpublic static void outPrintBC()
public static void outPrintln()
public static void outPrintln(PrintStream stream)
stream
- stream to print onpublic static void outPrintln(PrintStream stream, String str)
stream
- stream to print onstr
- string to printpublic static void outPrintln(String str)
str
- string to printpublic static void print(char x)
x
- the valuepublic static void print(double x)
x
- the valuepublic static void print(float x)
x
- the valuepublic static void print(int x)
x
- the valuepublic static void print(long x)
x
- the valuepublic static void print(String x)
x
- the stringpublic static void print(boolean b)
b
- the valuepublic static void printAddress(Address val)
val
- the address to printpublic static void printAddress(Object val)
val
- the address to printpublic static Throwable printExceptionAndTrace(Throwable exc, String msg)
exc
- excption to reportmsg
- message to print before exception.
public static Throwable printExceptionAndTrace(Throwable exc, String msg, boolean printUsingThrowable)
exc
- excption to reportmsg
- message to print before exception.printUsingThrowable
- if true, try to use Throwable.printStackTrace(), otherwise use VM routines...
public static void printObject(Object obj)
obj
- the object whose toString() result is to be printedpublic static void printOffset(Offset val)
val
- the offset to printpublic static void printUWord(UWord val)
val
- the word to printpublic static void println()
public static void println(char x)
x
- the valuepublic static void println(double x)
x
- the valuepublic static void println(float x)
x
- the valuepublic static void println(int x)
x
- the valuepublic static void println(long x)
x
- the valuepublic static void println(String x)
x
- the stringpublic static void println(boolean x)
x
- the valuepublic static Object putKeyedGlobal(int key, Object value)
synchronized (VM.getGlobalsMutex()) {
// access/manipulate globals here ...
}
key
- value
-
public static void setAsDaemonThread(Thread t)
t
- The threadpublic static void setProperty(String name, String value)
name
- property namevalue
- property valuepublic static int setStream(int stream)
stream
- the stream to use for the print... methods
public static void setSystemThreadPriority(Thread t, int level)
t
- The threadlevel
- the system priority level (currently supports normal priorities as well as 11, and 12)
IllegalArgumentException
- If the priority is not in the
range MIN_PRIORITY
to
MAX_SYS_PRIORITY
.public static Object shallowCopy(Object original)
original
- the iobject to copy
public static void startTracing()
public static void stopVM(int code)
code
- the exit status code.Isolate.addLifecycleListener(com.sun.squawk.Isolate.LifecycleListener, int)
public static void unregisterSuite(String uri)
uri
- the suite to unregister.public static boolean userGCAllowed()
public static boolean usingTypeMap()
public static long waitForDeepSleep(long minimumDeepSleepTime)
minimumDeepSleepTime
- the minimum time (in millis) that it's worth deep sleeping
public static void waitForInterrupt(int irq) throws IOException
irq
- mask for interrupt
IOException
|
SunSPOT API V4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |