AJACS Java Compiler Evaluation Release
======================================

 This is a release of the Java Compiler JACK (Java Ajacs Compiler from
Karlsruhe) in the AJACS (Applying Java to Automotive Control Systems) Project
(www.ajacs.org).

 This compiler was developed to give the oppprtunity to the embedded system
programmer to write his programs with the language Java(TM). Therefore some
changes were done to fulfill the requirements of the embedded environment.
Furthermore there are some restrictions, because some topics are not
implemented.

 As a matter of fact, the compiler JACK generates ANSI C code as a portable
assemblerform. So, the processor and the operating system are the
implementation of the JVM. In the project the operating system is OSEK/VDX.
Nevertheless, the generated C code can be compiled and run on quite any machine
if special OSEK/VDX functions are empty. Eg, the compiler was developed and
tested on a Linux workstation.

 JACK uses the jikes frontend. Jikes is copyright (C) 1996, 1999 International
Business Machines Corporation and others. All Rights Reserved.


Optimizations
-------------

 The compiler performs a lot of optimizations. Standard optimizations are:
    - common subexpression elimination
    - constant folding
    - dead code elimination
    - elimination of empty basic blocks

 High level optimizations are:
    - replace polymorphic calls by monomorphic calls
    - method inlining
    - compression of dispatch tables


Changes
-------

 The main basics of embedded software development in Java are the RealTime Core
Extension (RTCE) and the High Integrity Profile for Automotive Control (HIPA).
This specification define a special behaviour of the compiled program. Some
topics of this behaviour are:
	- static class initialization (all classes are initialized at the
	  program start)
	- root class replacement (the class Object is replaced by the class
	  CoreObject, etc)
	- a fast Java/native interface
	- special synchronization protocol
	- romization
	- no garbage collection
	- please read the technical documents on the web for further
	  information


Restrictions
------------

 This release does not support every Java features. Currently unsupported
features are:
	- exceptions (only some overhead is generated for measurement)
	- packages (ignored)
	- multi dimensional arrays
	- instance intializer blocks
	- synchronization of static methods
	- nested synchronization

 If the compiler detects the usage of an unsupported feature it will stop and
and print a message like "xyz not implemented". Please report this to
compiler-bugs@ajacs.org and it will be implemented as soon as possible.


Contents
--------

 This package contains:
	- Java compiler jikes in the AJACS version
	- some core classes (CoreObject, CoreArray, CoreIntArray, etc
	  but the implementation will change)
	- a simple batch file (jant.bat) to run the Java compiler
	- some small Java test programs, make that sure they work
	- ajacslib.c, a small interface for printing
	- this ReadMe


How to use
----------

 The environment variable CLASSPATH should be set to the directory where the
org/ directory is. This is currently the test/ directory, but it can be placed
anywhere. Only the library classes in org/rtwg are used. In the AJACS world
there are no libraries java.lang or java.util!
 Modify the batch file jant.bat (where is the java compiler, etc). Read the
instructions in the batch file. The batch file must be in a path of executable
programs. In the test/ directory you can compile the java programs (e.g.
..\jant.bat Sieve.bat if the batch file was not moved).
 AjacsIO.java is a small example that shows how to use the native interface.
Most testprograms use this class for printing to the console.


Options
.......

 Several flags activate optimizations or print some debug information.
A flag is activated with the option +IPDx.y where x is the flag and y its
value. This is a description of all flags and the possible values (a
combination of values is the sum of the values):

/* flag = 1, intermediate representation
 * 0 : do not generate any vcg graph - this is the default
 * 1 : generate firm vcg graphs before lowering
 * 2 : generate firm vcg graphs after lowering
 * 3 : generate firm vcg graphs after additional optimizing
 * value are exclusive
 */
/* flag = 2, code generator
 * 0 : do not generate any vcg graph - this is the default
 * 1 : generate vcg graphs with rewrite sequences
 * 2 : generate vcg graphs after searching
 * values can be combined
 */
/* flag = 3, optimizations
 * 0 : no optimization
 * 1 : dead node elimination by copying
 * 2 : common subexpression elimination and reassociation
 * 4 : constant folding and unreachable code elimination
 * 8 : inlineing for small methods
 * 16: global cse and code placement (EXPERIMENTAL)
 * 32: generate dominator tree (EXPERIMENTAL)
 * 64: compress dispatch tables
 * values can be combined
 */
/* flag = 4, AJACS
 * 1 : do generate a main() routine
 * 2 : Enforce Java restrictions for Ajacs project, reject long, float, double
 * values can be combined
 */
/* flag = 5, 
 * 0 : no verbose printing at all
 * 1 : top level AJACS verbose print
 * 2 : generation of additional FIRM code
 * 4 : tables stuff
 * 8 : type stuff
 * 16 : vcg_classhierachy
 * 32 : transformation from AST to FIRM
 * values can be combined
 */
/* flag = 6
 * 0 : do not print any statistic at all
 * 1 : print maximal heigth of expresssion
 * values can be combined
 */
