KOPI | ||
---|---|---|
Prev | Chapter 2. The KOPI Kopi Java Compiler | Next |
KJC is not the first freely available Java compiler but it provides some new features not previously available. These features are:
a GNU compiler and thus can be integrated in GNU projects;
great extensibility;
auditing that helps you to maintain your code;
an optimizing compiler.
There are mainly two other compilers for Java freely available: Javac and jikes. Javac is error-proof and has a role of reference, and jikes is extremly fast. This table shows the differences between these two compilers and KJC:
Table 2-1. Comparison with other compilers
Feature | Javac | Jikes | KJC |
---|---|---|---|
License model | Community Source Code | Jikes Public license | GNU Public License |
Language | Java | C++ | Java |
Supported platform | All platforms with a Java VM | Almost all | All platforms with a Java VM |
Speed | Slow | Very fast | - |
Extendability | Poor | Poor | Good |
Generated code | Good with -O | No optimizations | - |
Auditing | No | Poor with -warning | Still at an early level |
KJC is distributed under the term of a GNU public license and thus can be integrated freely in any other GNU project. The source code is part of the standard distribution and will help you understand the behavior of the program. It will also allow you to extend it.
This Java compiler written in Java is easily extensible. We have developed a lot of tools over KJC like XKJC and VKJC. These tools generates classfiles without any knowledge of the underlying Java bytecode convention (Stack size, verifier convention, ...).
An auditing tool helps you follow the Java code convention and avoid common errors that can be easily detected by a compiler. We have started to extend KJC with warnings to enforce the respect of this convention. This part of KJC is still in an early development stage, but will be our main focus for the next release (1.4).
KJC can read a .Java file and rewrite it following the Java Code Conventions. This can be useful when you get some source files from someone else and want to convert them into something readable. It is also useful for tools extending KJC to generate 100% pure Java code.
The code generation is based on at.dms.classfile and at.dms.optimizer. This last package is focused on bytecode optimization and will be improved in the next release. It already supports multi-pass optimizations, dead code removal and peephole optimization.
Prev | Home | Next |
The KOPI Kopi Java Compiler | Up | Usage |