JVMpublic class JVM extends Object
Fields Summary |
---|
public static final int | REMOVE_CLASSES_FROM_JARIf this flag is defined and the romization is successful, class
files are removed from the JAR file(s) after the romization
process. This parameter is ignored for source romization. | public static final int | STATUS_CANCELLEDReturned by getAppImageProgress() to indicate that the last image
creation process has was cancelled before it was completed. | public static final int | STATUS_FAILEDReturned by getAppImageProgress() to indicate that the last image
creation process has failed before it was completed. | public static final int | STATUS_VIRGINReturned by getAppImageProgress() to indicate that no image
creation process has ever been started since the VM was bootstraped. | public static final int | STATUS_STARTAny value returned by getAppImageProgress() that.s greater or equal to
STATUS_START, but lower than STATUS_SUCCEEDED, means that the
image creation is still taking place. | public static final int | STATUS_SUCCEEDEDReturned by getAppImageProgress() to indicate that the last image
creation process has succeeded. | public static final int | STATUS_VERIFY_NOTHINGReturned by verifyJar() to indicate no classes verification
has ever been started since VM didn't find any classes in JAR. | public static final int | STATUS_VERIFY_SUCCEEDEDReturned by verifyJar() to indicate all JAR classes were
successfully verified. | public static final int | STATUS_VERIFY_FAILEDReturned by verifyJar() to indicate JAR classes verification
failed by some reason. |
Methods Summary |
---|
public static native void | cancelImageCreation()If an image creation process is underway, cancel it. This will
force createAppImage() to delete all temporary files, as well as
the output image file, and return immediately. A future call to
getAppImageProgress() will return STATUS_CANCELLED.
If an image creation process is not underway, this method has no
effect.
| private static void | createAppImage(char[] jarFile, char[] binFile, int flags)Creates an application image file. It loads the Java classes
from the jarFile into the heap, verify the class
contents, and write the classes to an Application Image file as
specified by binFile . This function is typically
executed by the Application Management Software (AMS)
immediately after a JAR file is downloaded to the device.
This function must be called with a clean VM state -- i.e., if a
Java application is executing, you must exit the Java application
before running the Converter.
In MVM mode, this method should not be called only from within
a clean Isolate.
Interaction with classpath and shared libraries:
In the context of the VM (or current Isolate), the classpath
may be specified to additional shared libraries. These shared
libraries are loaded first, before jarFile is loaded. All shared
libraries specified on the classpath must be binary image files
and must be be JAR files.
Note that if the image creation process was cancelled, no exception
is thrown. A subsequent call to getAppImageProgress() will return
STATUS_CANCELLED.
startAppImage(jarFile, binFile, flags);
for (;;) {
if (!createAppImage0()) {
break;
}
}
| public static void | createAppImage(java.lang.String jarFile, java.lang.String binFile, int flags)
createAppImage(jarFile.toCharArray(), binFile.toCharArray(),
flags);
| private static native boolean | createAppImage0()Returns true if the image creation process has completed or
been concelled.
| private static native void | createSysImage()This method is used by the source romizer to create ROMImage.cpp.
| public static native int | getAppImageProgress()
| public static native void | loadLibrary(java.lang.String libName)This method is used to load binary library into the VM.
It allows to call native function implementations from this library.
| private static native void | startAppImage(char[] jarFile, char[] binFile, int flags)
| public static void | unchecked_byte_arraycopy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int length)Copy an array from the specified source array, beginning at the
specified position, to the specified position of the destination array.
Impose the following restrictions on the input arguments:
dst is not null .
src is not null .
- The
srcOffset argument is not negative.
- The
dstOffset argument is not negative.
- The
length argument is not negative.
srcOffset+length is not greater than
src.length , the length of the source array.
dstOffset+length is not greater than
dst.length , the length of the destination array.
- any actual component of the source array from position
srcOffset through srcOffset+length-1
can be converted to the component type of the destination array
The caller is responsible that these restrictions are not violated.
If any of the restrictions above is violated, the behavior is undefined.
System.arraycopy(src, srcOffset, dst, dstOffset, length);
| public static void | unchecked_char_arraycopy(char[] src, int srcOffset, char[] dst, int dstOffset, int length)
System.arraycopy(src, srcOffset, dst, dstOffset, length);
| public static void | unchecked_int_arraycopy(int[] src, int srcOffset, int[] dst, int dstOffset, int length)
System.arraycopy(src, srcOffset, dst, dstOffset, length);
| public static void | unchecked_long_arraycopy(long[] src, int srcOffset, long[] dst, int dstOffset, int length)
System.arraycopy(src, srcOffset, dst, dstOffset, length);
| public static void | unchecked_obj_arraycopy(java.lang.Object[] src, int srcOffset, java.lang.Object[] dst, int dstOffset, int length)
System.arraycopy(src, srcOffset, dst, dstOffset, length);
| public static int | verifyJar(java.lang.String jar, int chunkSize)Verifies all classes of the given JAR package within the current
VM instance. The JAR path should be included into classpath(s) of
the VM.
int nextChunkID = 0;
int status = STATUS_VERIFY_NOTHING;
try {
do {
nextChunkID = verifyNextChunk(jar, nextChunkID, chunkSize);
Thread.yield();
} while (nextChunkID > 0);
// OK, just all files verified
if (nextChunkID == 0) {
status = STATUS_VERIFY_SUCCEEDED;
}
} catch (Throwable t) {
//do we need it?
t.printStackTrace();
status = STATUS_VERIFY_FAILED;
}
return status;
| private static native int | verifyNextChunk(java.lang.String jar, int nextChunkID, int chunkSize)
|
|