![]() |
![]() HP OpenVMS Systems |
![]() |
DEC Ada
|
Previous | Contents | Index |
This chapter covers the following topics:
In DEC Ada on OpenVMS and on DIGITAL UNIX systems, each graphic character corresponds to a unique code of the ISO standard 8859/1, commonly known as Latin--1. This character set contains 256 values.
The characters included in each of the categories of basic graphic characters are the ISO seven-bit characters plus additional characters. The effect is to allow the use of the additional uppercase and lowercase characters in forming identifiers and to allow the use of all the additional graphic characters in forming character literals and string literals.
By implementing characters as the ISO Latin--1 character set, DEC Ada also allows the additional 96 characters afforded by the eight-bit representation.
The characters allowed in the text of a program are the graphic characters and format effectors. The characters allowed in comments are the graphic characters, the escape character, and the horizontal tabulation character. DEC Ada does not provide pragmas or other means for locally defining the graphic characters used in identifiers and string literals.
The maximum number of characters allowed in a source line is 255. This also limits the length of identifiers to 255 characters.
The broken bar is not allowed as a replacement for the vertical bar.
10.2 Run-Time System Issues
The following sections describe a variety of implementation details
that have an effect at run time.
10.2.1 Inclusion of the Run-Time Library with the Product Kit
Generally on OpenVMS systems, a DEC Ada Run-Time Library (SYS$SHARE:ADARTL.EXE) is included in the DEC Ada kit. DIGITAL supplies a run-time library (RTL) with necessary bug fixes beyond the RTL supplied by the operating system. A DEC Ada RTL is not always part of the kit. This has the following implications:
A subheap is allocated for each collection associated with an access type. Fixed-size blocks with bit-map allocation techniques are used for access types whose denoted type is fixed-size, and variable-length blocks with first-fit allocation techniques are used for access types whose denoted type is not fixed-sized.
Collections are deallocated when the scope of the parent access type is
left. The predefined generic procedure UNCHECKED_DEALLOCATION is
supported. Automatic garbage collection within a subheap is not
provided.
10.2.3 Subprogam Call Parameter Handling
Parameter-passing and result mechanisms are chosen based on the types of parameters and the language specified. In addition, the user can specify a nondefault mechanism for parameters and results. Optional compiler-generated compilation notes report on the mechanisms chosen.
Within a DEC Ada program, the conventions used are much like those for a mixed-language program with language Ada specified.
For Ada programs, arrays and records are passed by reference except in circumstances where a byte-aligned copy of a record is required (for bit-aligned components of arrays and records, for example).
The allocation rules of the compiler are such that a record can be bit-aligned (not byte-aligned) only when its size is static and less than 32 bits (on OpenVMS VAX and ULTRIX systems) or 64 bits (on OpenVMS Alpha and DIGITAL UNIX systems). Therefore, copying of record values for the purposes of parameter passing is never an expensive operation.
Function results that fit in a register are generally returned in a
register. For other cases involving fixed-size function results, the
caller or callee generally allocates storage for the result and the
address or a descriptor is passed as an additional parameter.
10.3 Mixed-Language Programming
To write mixed-language programs in any environment, the following topics need to be understood:
In general, all systems support the same interfaces for mixed-language programming. However, when mixing code from different programming languages, consider the following:
10.4 User Interface
The user interface is designed in the style of the host operating
system.
DEC Ada source files are compiled and linked on the host system in the context of one or more program libraries, which are managed by the DEC Ada program library manager. This context defines where the results of a compilation are stored and which previously compiled units are considered in subsequent operations.
A DEC Ada program library is a dedicated directory that contains a set of files for each compilation unit successfully processed. The compiler and program library manager use that set of files to maintain information about the compilation unit.
When the program library context contains multiple libraries, DEC Ada views these libraries as an ordered list. This ordered list, together with the library search rules used by the compiler and program library manager, identifies which previously compiled units are considered and which library to modify with the results of the compilation or program library manager operation.
DEC Ada program libraries can be organized to suit the needs of any project. Features are provided that allow projects to perform the following:
For references that will provide more information about working with
libraries and with the DEC Ada program library manager, see
Appendix A, Table A-1.
10.5 Compiler Performance
There is no simple way to indicate the DEC Ada compilation rate because there are no accepted standards for this measure. Package specifications, which typically involve little or no code generation, tend to compile quickly. On the other hand, extensive use of generics and inline expansion can greatly slow the compilation rate. The compiler performs better on larger compilation units than on small ones. In addition, compiler performance improves if you follow these guidelines:
DEC Ada provides several features and capabilities that specifically support the development of large Ada programs. These features and capabilities are licensed separately under the Professional Development Option (PDO). The PDO includes the following features:
To write DEC Ada programs that compile and execute efficiently, it is
important to be aware of certain compiler and language features that
can affect code size, as well as program compilation and execution
times.
10.5.1 Compiler Optimizations
The DEC Ada compiler performs a number of standard optimizations to improve the quality of the generated code. The following is a list of these optimizations:
In addition, the compiler performs the following Ada-specific optimizations:
Optimization is controlled at the command-line level. However, the user interface to each system is different. The relevant documentation must be consulted to determine which qualifier or option to specify.
Subprograms that are declared in a package but not used are loaded with the package.
In statements such as the following, the address of A(I) is evaluated only once:
A(I) := A(I) + 1; |
With matrix computations like the following, the address calculation for A(I,J) is optimized:
for I in 1 .. N loop for J in 1 .. M loop A(I,J) ... end loop; end loop; |
10.5.2 Improving Performance with Pragma INLINE
To expand subprograms inline and decrease the amount of time spent in
making subprogram calls, the Ada language provides the pragma INLINE.
The pragma INLINE can affect a program in one of two ways:
The pragma INLINE is supported in most cases. Routines may not be expanded inline at the place of a call if they contain the following:
The result of instantiating a generic subprogram is also inlinable under the same conditions.
The compiler expands local routines inline without the pragma INLINE
being specified where heuristics indicate that the size of the expanded
call will be approximately the same as the call it replaces (or only a
little larger). This inline expansion can be suppressed with the
appropriate optimization option.
10.5.3 Improving Performance of Programs Using Generics
DEC Ada offers a number of features to improve the compilation time and performance of programs that use generics. For example:
There is a relatively small and fixed overhead associated with locating and opening the program library file for each unit named in a with clause (independent of the size of that library unit). Also, for each library unit, it is necessary to transitively locate and open the program library file for each unit named in its with clauses. The occurrence of a unit in a with clause, of itself, has only this small initial overhead. Thereafter, additional incremental cost is incurred whenever needed information is first loaded from that unit.
For subunits, there is overhead required for locating and loading information about each ancestor unit up to and including the parent library unit, after which compilation proceeds at a rate comparable to any other unit.
Compilation performance is highly dependent upon the amount of physical memory present.
If the system does not have sufficient physical memory, the compiler pages excessively and the compilation speed is slowed considerably. However, all supported processors can be configured with enough memory so that there is a high limit on the size of a program unit that can be compiled.
There are no specific restrictions on the numbers of items of various kinds in a unit (identifiers, strings, nesting, and so on).
Tasks that are acting as monitors are not recognized as such and do not result in special code generation.
Predefined input-output packages are implemented using asynchronous techniques so that other tasks can execute while one task is waiting for input-output to complete.
On OpenVMS systems, the run-time libraries are shareable, which means that a single copy of library is used by all executing Ada programs on a particular system. The DEC Ada library is also used by the Ada compiler.
On DIGITAL UNIX systems, the run-time libraries can be either shareable or nonshareable.
On DIGITAL UNIX or on ULTRIX systems, when an Ada program is linked
with a nonshareable run-time library, the size of the run-time system
depends on which language features are used by the Ada program. For
example, code to support tasking is not loaded for nontasking programs.
Therefore, the size of the run-time system for nontasking programs will
be smaller than in tasking programs.
10.6 Implementation-Dependent Characteristics
The DEC Ada compiler supports address representation clauses for objects and imported subprograms but does not support address representation clauses for packages or tasks. The compiler supports address representation clauses for entries as follows:
The DEC Ada compiler provides additional constant declarations in the predefined package SYSTEM as shown in Table 10-1.
Number | Value | Platform |
---|---|---|
MIN_INT |
--2
31
--2 63 |
VAX, ULTRIX
Alpha |
MAX_INT |
2
31 --1
2 63 --1 |
VAX, ULTRIX
Alpha |
MAX_DIGITS |
33
15 |
VAX
Alpha, ULTRIX |
MAX_MANTISSA | 31 | VAX, Alpha, ULTRIX |
MEMORY_SIZE |
--2
31--1
2 63--1 |
VAX
Alpha |
FINE_DELTA | 2.0 -31 | VAX, Alpha, ULTRIX |
The value of the constant LARGEST_INTEGER is a range of MIN_INT .. MAX_INT.
SYSTEM.TICK represents the smallest unit of time used by the operating system in its time-related system services. Table 10-2 table shows the value of the system-dependent named number SYSTEM.TICK.
Platform | Value | Value in Seconds |
---|---|---|
VAX | 10.0 -2 | 10 milliseconds |
Alpha | 10.0 -3 | 1 millisecond |
ULTRIX | 3.906*10.0 --3 | 3.906 milliseconds |
The following table lists implementation limits for DEC Ada.
Limit | Value |
---|---|
In a subprogram or entry declaration, maximum number of formal parameters that are of an unconstrained record type | 32 |
Maximum identifier length (number of characters) | 255 |
Maximum number of characters in a source line | 255 |
Maximum collection size (number of bytes) 1 | 2 31--1 |
Maximum number of discriminants for a record type | 245 |
Maximum number of formal parameters in an entry or subprogram declaration | 246 |
Maximum number of dimensions in an array type | 255 |
Maximum number of library units and subunits in a compilation closure 2 | 4095 |
Maximum number of library units and subunits in an execution closure 3 | 16383 |
Maximum number of objects declared with the pragma COMMON_OBJECT or PSECT_OBJECT | 32757 |
Maximum number of enumeration literals in an enumeration type definition | 65535 |
Maximum number of lines in a source file | 65534 |
Maximum number of bits in any object | 2 31--1 |
Maximum size of the static portion of a stack frame (approximate) | 2 30 |
Previous | Next | Contents | Index |