# IBM Real Time Application Execution Optimizer for Java

## Sean Foley

Sean_Foley@ca.ibm.com

May 20, 2009

## To run

Run the jar file with:
java -jar <jar file>
or
java -cp <jar file> AppExecOptimizer

Running it with no options produces help information.

## Technologies

The tool provides the following technologies:

- escape analysis on a per method-invocation basis
- control flow analysis that splits an application into archives according to thread accessibility
- control flow analysis that detects potental occurrences of runtime errors MemoryAccessError, IllegalAssignmentError, IllegalThreadStateException
- control flow analysis that determines entry points into an application
- removal of unwanted attributes from Java™ class files
- addition of stackmaps to Java class files
- verification of Java class files
- auto-generation of classes that when initialized will load and initialize all other classes within the same archive
- specialized packaging of Java applications into deployable archives by packaging all referenced classes from a dual class path

## Description

The tool eases development and deployment of Java applications. It aids with the verification of the integrity of a compiled Java application while preparing the application for optimized deployment in specific environments.

The tool performs the following functions for optimized deployment and application behaviour:

1. While loading the application, all classes needed for deployment of the application are identified and loaded recursively by the tool. Also identified are all unresolved references (classes, methods or fields that cannot be found) to ensure no application components are missing. While loading it checks each class for all possible class format, resolution, and verification errors that would be identified by a virtual machine at run-time, which can be helpful to verify classes that are not produced by standard compilers.

2. It verifies the integrity of real-time Java memory usage in the application, by detecting the potential run-time errors MemoryAccessError, IllegalAssignmentError and IllegalThreadStateException which are common errors that are difficult to eliminate when developing real-time Java.

3. It separates application classes and resources into the following categories:

- NoHeapRealtimeThread (NHRT) accessible classes
- RealtimeThread accessible classes
- regular thread accessible classes
- inaccessible: classes not accessible to any thread
- resources

The separated items are written to separate archives on disk.

4. It can determine the persistent memory characteristics of allocated objects on a per-invocation basis with the use of escape analysis. For each method, an escape analysis determines whether the objects created by invocations of the method can persist. This helps identify memory requirements for the heap, for scopes, and for other memory areas in use.

5. The tool can identify all possible entry points into the application (which are all classes, methods or fields that can be accessed from outside the application classes). For example, it will detect methods that can be invoked in application classes from external classes because they override external methods.

6. When writing classes the tool can remove unwanted class file attributes (such as attributes needed only for debugging, reducing run-time memory usage), and it can add stackmaps to classes to improve class load times for Java classes compiled for Java 5 or earlier.

7. The tool can add to each archive an auto-loader class that when loaded, will load and initialize all other classes within the same archive, in order to trigger early class initialization for an application.

## Trademarks

IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both.

Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Other company, product, or service names may be trademarks or service marks of others.