Java Reference
In-Depth Information
Relocatable Binary Format
Most production-quality compilers do not generate assembly language; direct
generation of target code (in relocatable or absolute binary format) is more ef-
ficient and allows the compiler more control over the translation process. It is
nonetheless beneficial for the compiler's output to be open to scrutiny. Compil-
ers that produce binary format typically can also produce a pseudoassembly
language listing of the generated code. Such a listing shows the instructions
generated by the compiler with annotations to document storage references.
Relocatable binary format is essentially the form of code that most as-
semblers generate. This format can also be generated directly by a compiler.
External references, local instruction addresses, and data addresses are not
yet bound. Instead, addresses are assigned relative either to the beginning of
the module or to some symbolically named locations. The latter alternative
makes it easy to group together code sequences or data areas. A linkage step
is required to incorporate any support libraries as well as other separately
compiled routines referenced from within a compiled program. The result is
an absolute binary format that is executable.
Both relocatable binary and assembly language formats allow modular
compilation : the decomposition of a large program into separately compiled
pieces. They also allow cross-language support : incorporation of assembler
code and code written and compiled in other high-level languages. Such code
can include I
O, storage allocation, andmath libraries that supply functionality
regarded as part of the language's definition.
/
Absolute Binary Format
Some compilers generate an absolute binary format that can be directly ex-
ecuted when the compiler is finished. This process is usually faster than the
other approaches. However, the ability to interface with other code may be
limited. In addition, the program must be recompiled for each execution un-
less some means is provided for archiving the memory image. Compilers
that generate an absolute binary format are useful for student exercises and
prototyping use, where frequent changes are the rule and compilation costs
far exceed execution costs. It also can be useful to avoid saving compiled for-
mats to save file space or to guarantee the use of only the most current library
routines and class definitions.
Summary The code format alternatives and the target code alternatives dis-
cussed here show that compilers can di
er quite substantially while still per-
forming the same sort of translation task. Some compilers use a combination of
the articulated alternatives. For example, most Java compilers emit bytecodes
ff
 
Search WWH ::




Custom Search