|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.VM
public final class VM
This class provides access to many of the internal structures of the leJOS virtual machine. In particular it provides Java level access to the classes, methods fields etc. that make up the currently executing program. These structures are used by the VM to create the in memory program. They are similar to the class file format used by a standard JVM, but with much of the detail stripped away. The structures fall into two genral types. Those that are contained within Java objects (and so can be made directly available to a user program) and those that are simply raw data. To allow access to the second type of data we create Java objects with a copy of the data in them. In some cases we also do this even for tables/etc. that are available as objects as wrapping the class in this way may make it easier to manipulate. NOTE: Many of the structures in this file are a direct mapping to internal data within the VM. Changes to the VM structures must also be reflected here. Take care when editing this code to ensure that changes do not modify this mapping. Also many of the tables use byte fields that really should be treated as unsigned values. We have to take great care when converting these to integers.
Nested Class Summary | |
---|---|
class |
VM.VMClass
Provide access to the internal class data |
class |
VM.VMClasses
Provide access to a series of class records |
static class |
VM.VMClone
This class is used to create a Java class from in memory data. |
class |
VM.VMConstants
This class allows access to all of the constant values. |
static class |
VM.VMElements
|
static class |
VM.VMException
An exception record |
static class |
VM.VMExceptions
Class to provide access to a series of exception records |
class |
VM.VMFields
|
class |
VM.VMImage
The image header for the currently active program. |
static class |
VM.VMItems<E>
This class provides the ability to iterate through a series of in memory structures and returns a Java accessible clone of the structure. |
class |
VM.VMMethod
Provide access to information about a method |
class |
VM.VMMethods
Provide access to a series of method records |
class |
VM.VMStackFrame
|
class |
VM.VMStackFrames
|
static class |
VM.VMStaticFields
This class can be used to gain access to all of the static fields. |
class |
VM.VMThread
Internal version of a thread structure |
class |
VM.VMThreads
Provide access to a series of internal thread records |
static class |
VM.VMValue
Class that represents a value within the VM. |
Field Summary | |
---|---|
static int |
VM_ASSERT
|
static int |
VM_BOOLEAN
|
static int |
VM_BYTE
|
static int |
VM_CHAR
|
static int |
VM_CLASS
|
static int |
VM_DOUBLE
|
static int |
VM_FLOAT
|
static int |
VM_INT
|
static int |
VM_LONG
|
static int |
VM_OBJECT
|
static int |
VM_OBJECTARRAY
|
static int |
VM_SHORT
|
static int |
VM_TYPECHECKS
|
static int |
VM_VOID
|
Method Summary | |
---|---|
static void |
enableRunTimeTypeChecks(boolean on)
Enable/Disable strict run time type checking for some operations within the Virtual Machine. |
static void |
executeProgram(int progNo)
leJOS allows several "programs" to be linked into a single nxj file the system by default will start execution of program 0. |
static Class<?> |
getClass(int clsNo)
Return the class for the specified primitive type. |
Class<?> |
getClass(Object obj)
Return the Class object for the provided object. |
static int |
getClassNumber(Class<?> cls)
|
VM.VMElements |
getElements(Object obj)
|
VM.VMFields |
getFields(Object obj)
Provide access to the fields of an object |
VM.VMImage |
getImage()
Return the image header for the currently running program |
VM.VMMethod |
getMethod(int methodNo)
Return data about the specified method number |
static VM |
getVM()
Obtain access to the single instance of the VM class. |
VM.VMClass |
getVMClass(Class<?> cls)
Return a VMClass object for the provided class object. |
VM.VMClass |
getVMClass(int clsNo)
Return a VMClass object for the provided class number. |
VM.VMClass |
getVMClass(Object obj)
Return a VMClass object for the provided object. |
static int |
getVMOptions()
Return the currently operating Virtual Machine options. |
VM.VMThread |
getVMThread(Thread thread)
|
VM.VMThreads |
getVMThreads()
Returns access to all of the current internal thread objects |
boolean |
isArray(Object obj)
Return true if the specified object is an array |
static boolean |
isAssignable(Class<?> src,
Class<?> dst)
Check to see if it is allowed to assign an object of class src to an oobject of class dst. |
static void |
resumeThread(Object thread)
Resume a thread. |
static void |
setVMOptions(int options)
Control the run time operation of the leJOS Virtual Machine. |
static void |
suspendThread(Object thread)
Suspend a thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VM_OBJECT
public static final int VM_CLASS
public static final int VM_BOOLEAN
public static final int VM_CHAR
public static final int VM_FLOAT
public static final int VM_DOUBLE
public static final int VM_BYTE
public static final int VM_SHORT
public static final int VM_INT
public static final int VM_LONG
public static final int VM_VOID
public static final int VM_OBJECTARRAY
public static final int VM_TYPECHECKS
public static final int VM_ASSERT
Method Detail |
---|
public static VM getVM()
public VM.VMImage getImage()
public static int getClassNumber(Class<?> cls)
public static boolean isAssignable(Class<?> src, Class<?> dst)
src
- The src class.dst
- The destination class.
NullPointerException
- if either class is null.public Class<?> getClass(Object obj)
obj
- the object for which the class is required
public VM.VMClass getVMClass(Object obj)
obj
- the object for which the class is required
public static Class<?> getClass(int clsNo)
clsNo
-
public final VM.VMClass getVMClass(Class<?> cls)
cls
-
public final VM.VMClass getVMClass(int clsNo)
clsNo
-
public final VM.VMMethod getMethod(int methodNo)
methodNo
-
public final boolean isArray(Object obj)
obj
- object to test
public final VM.VMFields getFields(Object obj)
obj
- the object to obtain the fields for
public final VM.VMElements getElements(Object obj)
public final VM.VMThreads getVMThreads()
public final VM.VMThread getVMThread(Thread thread)
public static final void suspendThread(Object thread)
thread
- public static final void resumeThread(Object thread)
thread
- public static final void executeProgram(int progNo)
progNo
- program number to callpublic static final void setVMOptions(int options)
options
- Bit flags.public static final int getVMOptions()
public static void enableRunTimeTypeChecks(boolean on)
on
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |