beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 32

background image

Developing Compaq COBOL Programs
1.1 Compaq COBOL and Alpha Architecture System Resources

1.1 Compaq COBOL and Alpha Architecture System Resources

For many user applications, the Compaq COBOL compiler requires significantly
more system resources than Compaq COBOL for OpenVMS VAX. In fact, unless
you have adjusted your system resource parameters accordingly, the attempt
to compile may fail because of insufficient virtual memory. Also, for very large
programs (greater than 10,000 lines), you might experience extremely long
compile times. Knowing why Compaq COBOL requires more memory can help
you take actions to avoid resource problems.

1.1.1 Compilation Performance

The Alpha architecture is a RISC (reduced instruction set computer) architecture.
Many other processor architectures, including the VAX, are CISC (complex
instruction set computer) architectures. The main distinguishing characteristic of
a RISC machine is that it has few instructions and each instruction does a small
amount of work. A CISC machine generally has many instructions, most of which
perform many complicated operations in one step.

By reducing the amount of work that is done in each instruction (and by reducing
the number of instructions), the complexity of the hardware is reduced. These
hardware changes, plus others, result in an increase in the number of instructions
per second that can be completed. The result is much faster overall system
performance.

A tradeoff of RISC systems is that compilers for these architectures generally
must do a great deal more work than a corresponding compiler for a CISC
architecture. For example, the compiler must compute the best way to use all of
the functional units of the processor, and it must determine how to make the best
use of registers and on-chip data cache because reads and writes to main memory
are generally slow compared to the speed of the processor.

The code generation portion of the Compaq COBOL for OpenVMS VAX compiler
examines one COBOL statement at a time, determines the VAX instructions to
be constructed to execute that statement, and then moves on to the next one.
This tactic works well for a CISC architecture like the VAX. Compaq COBOL for
OpenVMS VAX does ‘‘peephole’’ optimization.

The Compaq COBOL compiler, in contrast, is a globally optimizing compiler
based on the Alpha RISC architecture as well as mathematical concepts. The
compiler constructs an internal representation of the entire COBOL program,
and repeatedly traverses this structure at compile time, so that it can produce
the most efficient machine code for the program. This results in very high
performance code, to the benefit of your users at run time. Although the Compaq
COBOL compiler requires more resources than some other compilers to do this
additional work at compile time, this cost is offset by better performance during
the many run times that follow.

To reduce this impact on system resources, do the following:

Use /NOOPTIMIZE or

-O0

on the compile command line when initially

developing and testing programs. The optimizer is one of the heaviest users
of system resources in the COBOL compiler and is turned on by default. Also,
the higher the optimization level, the more memory required by the compiler.

Check system tuning. Because the Compaq COBOL compiler often needs
a great deal of virtual memory, you may need to increase virtual memory
for developers who use the compiler. This results in decreased paging and
improvements in compile time.

1–2 Developing Compaq COBOL Programs