Compiler : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)
The CurrCon Java Applet displays prices on this web page converted with today’s exchange rates into your local international currency, e.g. Euros, US dollars, Canadian dollars, British Pounds, Indian Rupees… CurrCon requires an up-to-date browser and Java version 1.8, preferably 1.8.0_131. If you can’t see the prices in your local currency, Troubleshoot. Use Firefox for best results.

Compiler
A program that digests Java source code and produces JVM-format class files, or *.exe executables containing native machine code.

The Four Types of Execution

There is only one kind of compiler, but four basic things you can do with the resulting class file.

You use a static compiler such as Oracle’s javac.exe to create platform-independent, binary, JVM (Java Virtual Machine) byte code. Then you can either:

  1. Run the code on hardware that directly supports the JVM byte code instruction set. Oracle’s Picojava chip is dead, but there are others.
  2. Feed the class file to an interpreter JVM such as Oracle’s java.exe -Xint which executes the byte code instruction by instruction, simulating a machine that uses the Java byte code instruction set.
  3. Feed the class file to a JIT (Just In Time) JVM such as Oracle’s HotSpot java.exe which translates it a class at a time to native machine code. It procrastinates the translation until the class is first used, or until after it has watched it for a while in interpreted mode to find out which code is most often executed.
  4. Feed the class file to a static optimising native compiler such as JET that converts the whole thing to a native executable.
Compiler classifications
Code Letter Meaning Advantages and Disadvantages
I Interpreter Interpreters are easy to write. Thus they appear on any new platform first. They start execution instantly. The code is compact. However, they are usually the slowest to execute. The lines between software interpreter, firmware interpreter and microchip that runs byte codes directly is blurry. The more hardware assist you have, the faster the execution and the smaller the package you can squeeze everything into. With sufficient hardware assist, this is the fastest approach.
N AOT (Ahead Of Time) Static Native code, complied to machine code at the developer site from byte codes. Sometimes called AOT AOT compilers. Native code compilers do all their work long before the execution starts. They take a long time to study the code. They figure out what can be precalculated, what tests were not really necessary, which objects can be safely stack allocated for speed. They inline aggressively. They study the program as whole globally optimising, not just method by method. They unravel in ways no assembler programmer would have the patience for. The result is a standard platform-dependent executable. These now rival C++ in speed and are getting better daily. The catch is you need to buy a different compiler for every native platform. And you have to distribute a different executable for every platform and sometimes a fat runtime library as well. Happily, you can use these tools even when you don’t have the source. They work with the class or jar files as input. This means you as customer can use them to speed up programs you buy. The author of the program need not ever know you used them. Their main weakness is dealing with any sort of on-the-fly newly created or imported classes that were not present at compile time. Either such classes have to be disallowed or not optimised. The other main disadvantage is high cost. Native code, especially highly optimised native code, is considerably more difficult to reverse engineer than Java byte codes, even obfuscated ones. So you might consider using a native compiler for protecting the secrets of your source code.
J JIT compiles every time needed at the client site. Good for executing platform-independent byte codes freshly downloaded off the web, e.g. An Applet. Does a rough and ready quick compilation and gets on with execution quickly. The code is not particularly fast to execute though.
H Hotspot (starts off interpreting and gradually compiles the hotspots). This is good primarily for servlets. The disadvantage is the several minutes the servlet womb takes to warm up. The advantage is the system responds to real life bottlenecks, not to theoretical ones. The optimiser has more information about how the code is actually used than on that did all its work before execution started. It can deal with code changing on the fly or being generated on the fly as in JSP (Java Server Pages). Static native code optimisers cannot. For example it can presume all non-overridden methods are final and do inlining, then change its mind later and undo that if a dynamic class load overrides one of those methods. It leaves rarely used code in compact byte code form.
W Wrapper This technique looks superficially like native code, but what actually is happening is the class files are bundled with a little kickoff program. The actually running may be by interpretation or by a JIT. Microsoft’s Jexegen was the originator of this technique.

Real Word Compilers

I have ordered the compilers with the ones good for debugging at the top and good for optimising at the bottom. Each tool is designed for a different purpose. If you use the wrong tool, don’t blame the tool!
Real World Compilers
Vendor Compiler Name How Run Notes
IBM AS400 N 128-bit address space.
IBM Eclipse I Incremental compiler keeps compiling as you edit. Windows, others?
JSmooth JSmooth W Wraps Jar in a standard windows executable.
IBM Java 2 ? 64-bit, Itanium under Linux
IBM Java 2 ? 64-bit, Itanium under Linux
NaturalBridge BulletTrain N defunct
webGAIN Café JW IDE (Integrated Development Environment) that comes in Pro and database editions. Includes source code level debugger that lets you evaluate arbitrary expressions that can include method calls. Formerly by Symantec, now called webGAIN Studio. Defunct.
Metroworks CodeWarrior N Runs on Linux, Macintosh, Solaris, Windows 95/98/NT.
Wind River Systems Diab FastJ N For embedded Systems.
Microsoft J++ IW Works with Microsoft’s variant of the Java language that does not have RMI (Remote Method Invocation), JNI (Java Native Interface) etc and has some extra keywords. May be useful for writing Windows-only applications.
Oracle/Sun/JavaSoft javac I or J or H Comes with various JDKs (Java Development Kits).
GNU gcj I or N Compiler that accepts either java or class files and emits either class or native object files.
Inprise (née Borland) Jbuilder J IDE.
Excelsior JET (Just Enough Time) N jetbanner logo Just an optimser and native code generator. Needs somebody else’s compiler to produce the byte codes. Very simple to use! Just give it a jar file or some class files and it hands back an equivalent tiny self-contained EXE that runs so fast it will make your head spin. Free evaluation download. The install is very unfriendly, making your machine completely unusable for an hour or so. On my old clunker it took about 18 hours! Do it just before you go to sleep. To deploy you must install both the precise matching JRE (Java Runtime Environment) and some DLLs (Dynamic Link Libraries) on the client machine. For non-GUIs, you don’t even need that.
IBM (International Business Machines) Alphaworks Jikes I. Use Oracle’s or other’s runtime very fast compilation, good error messages, works very well with the SmartJ front end. SmartJ is a convenient front end to the compiler and runtime that makes them much smarter and forgiving.
Instantiations Jove N highly optimised. Very expensive. Unfortunately, no longer available.
KOPI KJC I written in pure Java. GNU (Gnu’ Not Unix!) opensource.
Microsoft MSIL ? Java Language to IL compiler: The Java language converter is the Java equivalent of a C++ language compiler for .NET. It will take Java source files and create the .NET assemblies containing the IL and metadata that can run on the .NET runtime.
Dobysoft NativeJ W $40.00 USD standard edition,
$80.00 USD professional edition,
Not a compiler. Wraps class files to look like a standard windows executable, even a service.
Pizza Pizza ? opensource
Tower Technology TowerJ N heavy duty optimisation. Generates native code for Solaris, HP/UX, Windows, Linux, Tru64, DG/UX, AIX (Advanced Interactive eXecutive) and SGI (Silicon Graphics Inc), including Itanium. Defunct.
IBM VAJ (Visual Age for Java) I and N SCID that offers very good code browsing and source code debugging of multithread apps. Terrible help files. Runs under AIX, OS/2, OS/390, Windows 98 and Windows NT.

Conversion to C or C++

Newbies often ask for a compiler that converts Java to C or C++ thinking somehow that would give them the reputed advantages of C++ coding. The advantages of C/C++ come when you manually tweak memory allocation, addressing modes, turn off safety checking, inline objects in arrays etc. A Java compiler would still be constrained to generate code that used automatic garbage collection, subscript bounds checking etc. A Java compiler has greater freedom to optimise when it outputs JVM byte code or machine code. Further, Java is not just the language, but a giant, platform-independent class library with customised implementations for each platform. The C/C++ code generated would still be dependent on the Java native classes in that library for any given platform. The other problem is C/ C++ itself is no longer platform independent. It would requires different code generation for each platform. The code would no longer be portable, the main reason people write in Java in the first place. Further C/C++ is missing features needed to support Java such as dynamic class loading. To run interesting programs, you would need a way to turn JVM bytes codes to C/ C++ on the fly, compile the C/ C++ on the fly and dynamically invoke the freshly compiled code, which then could change the meaning of classes already loaded. C/C++ was just not designed for dynamic loading. It wants all the code in finished from before it even starts to load.

Going the other way from C to Java is also difficult. There is a program C2J that can do an approximate translation of simple C programs to Java. Many of the low-level things you can do in C, such as unions, have no equivalent in Java.


This page is posted
on the web at:

http://mindprod.com/jgloss/compiler.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\compiler.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.145.89.181]
You are visitor number