HP OpenVMS Systems

Content starts here

DEC Ada
Technical Overview and Comparison on DIGITAL Platforms


Previous Contents Index


Chapter 11
Comparison Summaries

When working with multiple targets or considering a port between platforms, it is important to know which parts of the code are target-specific and which are target-dependent and how big an effect a change in the target can have. The following sections discuss topics related to program portability and target dependence.

11.1 Determining DEC Ada Program Portability

On OpenVMS systems to determine if a DEC Ada program uses certain potentially nonportable features, use the /SHOW=PORTABILITY qualifier with any of the following DEC Ada compilation commands:

  • DCL ADA
  • ACS COMPILE
  • ACS RECOMPILE

The /SHOW=PORTABILITY qualifier (which is the default for all of the compilation commands) causes the compiler to include a portability summary in the compilation listing file. (The /LIST qualifier must also be specified.)

On DIGITAL UNIX systems, use a "p" in the ADALISFLAGS environment variable to cause a portability summary to be included with the compilation listing file with any of the following DEC Ada compilation commands:

  • ada
  • amake

The -v switch must also be specified with these commands.

The following sections discuss the factors affecting the portability of a DEC Ada program and identify those features that may appear in the portability summary.

11.2 Factors Affecting Portability

A program's portability depends on the set of available implementations that are appropriate for the program. For example, the Ada standard does not specify the range of digits for floating-point types that must be supported by an implementation.

If an implementation can support the requested accuracy and implied range, then the program should be portable with respect to that implementation. If the implementation cannot support the requested accuracy, then it will produce an error during compilation (rather than allowing the program to compile and then execute with unacceptable results). The use of an implicit underlying type---in this case, the DEC Ada predefined type LONG_FLOAT (and either a D-floating or G-floating representation)---is not relevant to whether or not the program is portable.

The explicit use of a predefined type, such as LONG_FLOAT, also may or may not be portable. For example:


type REAL is new LONG_FLOAT;

The fact that some other implementation may support a predefined type LONG_FLOAT (as described in the Ada standard) does not ensure that the program is portable to that implementation. In particular, the accuracy provided by that implementation may be less than the accuracy provided by DEC Ada---which may or may not be significant to the program. This can differ even on DEC Ada platforms.

The DEC Ada portability summary does not list implicit uses of the type LONG_FLOAT. It does list explicit uses of the type LONG_FLOAT.

The abstraction properties of the Ada language imply that even when a particular construct is defined by a nonportable construct, uses of that particular construct are not necessarily also nonportable. For example, an unchecked conversion from the INTEGER to the type ADDRESS could be implemented across a large number of Ada implementations in various ways. However, it is the conversion declaration, not the conversion call, that should be examined when porting a program that uses the conversion function.

Another example of this concept occurs in the DEC Ada implementation of the predefined package TEXT_IO. The private part of TEXT_IO's specification uses some implementation-defined pragmas, such as the pragma IMPORT_PROCEDURE. The package body uses even more nonportable constructs, such as the type ADDRESS, the implementation-defined attribute TYPE_CLASS, and other DEC Ada features. However, the portability of programs that use the package TEXT_IO is not compromised.

Another consideration is that pragmas (which, as required by the Ada standard, cannot affect the legality of a program) may or may not be relevant to a program's correct operation, portability, or both. For example, a program may work correctly only if the pragma SHARED is supported by an implementation or only if the pragma PRIORITY is supported with a certain range of priorities. For this reason, the portability summary shows the use of many of the language-defined pragmas as well as the use of all of the implementation-defined pragmas.

11.3 Features Listed in the Portability Summary

The portability summary lists one or more of the features or constructs shown in Table 11-1. The summary briefly describes the feature or construct and follows each description with the line numbers where the use of the feature or construct occurs. Features or constructs that are implementation-specific are marked with an asterisk (*). For example:



PORTABILITY SUMMARY
----------- -------
Source program elements which may effect porting this program to other
targets and the source line numbers where these elements were detected.
Please refer to the manual in ADA$EXAMPLES:DEC_ADA_OVERVIEW_AND_COMPARISON.*.


Type STANDARD.FLOAT defaults to F_FLOAT on OpenVMS and IEEE_*_FLOAT on UNIX
                96

Type STANDARD.LONG_FLOAT defaults to G_FLOAT on OpenVMS, and IEEE_DOUBLE_FLOAT
on DIGITAL UNIX
                97

Type STANDARD.LONG_LONG_FLOAT defaults to H_FLOAT on VAX, G_FLOAT on OpenVMS
Alpha, and IEEE_DOUBLE_FLOAT on UNIX
                98

Type STANDARD.LONG_INTEGER is 32 bits on VAX and 64 bits long on Alpha targets
                95

Predefined package SYSTEM contains entities which may not be implemented on
other targets
                92

Subtype SYSTEM.PRIORITY may vary on other non-DIGITAL Ada targets
               123   125

SYSTEM.INTEGER_*  integer types may not be portable to non-DIGITAL Ada targets*
               119   120   121

        where * indicates an implementation-defined feature

Italicized text is used in Table 11-1 to explain some of the features or constructs. The text does not appear in the actual portability summary.

Table 11-1 Features or Constructs That May Appear in a Portability Summary
Implementation-Defined Types in the Package STANDARD
  predefined SHORT_INTEGER or SHORT_SHORT_INTEGER
  predefined FLOAT, LONG_FLOAT or LONG_LONG_FLOAT (that is, explicit rather than implicit uses of these types, as discussed previously)
  predefined LONG_INTEGER
Entities in the Predefined Package SYSTEM
  with SYSTEM (that is, use of predefined SYSTEM in a with clause)
  ADD_ATOMIC, AND_ATOMIC, or OR_ATOMIC
  predefined NAME (includes type NAME and any of its enumerals)
  predefined named number (such as MAX_INT)
  predefined PRIORITY
  predefined integer types (INTEGER_*) in the package SYSTEM*
  predefined floating-point types in the package SYSTEM*
  predefined ADDRESS (includes type ADDRESS and constant ADDRESS_ZERO)
  instantiation of FETCH_FROM_ADDRESS or ASSIGN_TO_ADDRESS*
  predefined TYPE_CLASS* (includes type TYPE_CLASS and any of its enumerals)
  predefined AST_HANDLER* (includes type AST_HANDLER and constant NO_AST_HANDLER)
  predefined NON_ADA_ERROR*
  predefined type, subtype, or special operator for VAX storage (such as UNSIGNED_LONGWORD)*
  predefined conversion for VAX storage (such as TO_BIT_ARRAY_32)*
  predefined read or write input-output register*
  predefined read or write processor register*
  predefined function IMPORT_VALUE, IMPORT_ADDRESS, or IMPORT_LARGEST_VALUE*
  predefined ALIGNED_WORD, ALIGNED_INTEGER, or ALIGNED_LONG_INTEGER*
  predefined ADD_INTERLOCKED, SET_INTERLOCKED, CLEAR_INTERLOCKED*
  predefined INSQ_STATUS or REMQ_STATUS*
  predefined INSQHI, INSQTI, REMQHI, REMQTI*
  predefined H_FLOAT, F_FLOAT, D_FLOAT, G_FLOAT
  predefined IEEE_SINGLE_FLOAT and IEEE_DOUBLE_FLOAT
Predefined Procedure UNCHECKED_DEALLOCATION
  with UNCHECKED_DEALLOCATION (that is, use of predefined UNCHECKED_DEALLOCATION in a with clause)
  instantiation of UNCHECKED_DEALLOCATION
Predefined Function UNCHECKED_CONVERSION
  with UNCHECKED_CONVERSION (that is, use of predefined UNCHECKED_CONVERSION in a with clause)
  instantiation of UNCHECKED_CONVERSION
Entities in the Predefined Package MACHINE_CODE
  predefined unit defined only on OpenVMS systems:
  • AUX_IO_EXCEPTIONS,
  • CDD_TYPES,
  • CLI,
  • CONDITION_HANDLING,
  • CONTROL_C_INTERCEPTION,
  • GENERIC_ELEMENTARY_FUNCTIONS,
  • GENERIC_PRIMITIVE_FUNCTIONS,
  • LBR,
  • NCS,
  • RMS_ASYNCH_OPERATIONS,
  • SOR,
  • STARLET,
  • SYSTEM_RUNTIME_TUNING,
  • TASKING_SERVICES
  predefined unit defined only on DIGITAL UNIX systems:
  • ERRNO,
  • MAIN_PROGRAM_ARGUMENT_LIST,
  • SET_TASK_PRIORITY,
  • TIME_CONVERSION
Representation Clauses
  address representation clause
  enumeration representation clause
  length SIZE representation clause
  length STORAGE_SIZE representation clause
  length SMALL representation clause
  record representation clause
Attributes
  attribute ADDRESS
  attribute AST_ENTRY*
  attribute BIT*
  attribute MACHINE_SIZE*
  attribute NULL_PARAMETER*
  attribute SIZE
  attribute STORAGE_SIZE
  attribute TYPE_CLASS*
Pragmas
  unknown pragmas ( that is, any pragma not recognized by DEC Ada)
  unsupported pragmas ( that is, any pragma supported by another Ada implementation)
  pragma AST_ENTRY*
  pragma CALL_SEQUENCE_FUNCTION*
  pragma CALL_SEQUENCE_PROCEDURE*
  pragma COMMON_OBJECT*
  pragma COMPONENT_ALIGNMENT*
  pragma COMPLEX_REPRESENTATION*
  pragma DIRECT_INTERRUPT*
  pragma EXPORT_EXCEPTION*
  pragma EXPORT_FUNCTION*
  pragma EXPORT_OBJECT*
  pragma EXPORT_PROCEDURE*
  pragma EXPORT_VALUED_PROCEDURE*
  pragma FLOAT_REPRESENTATION*
  pragma IDENT*
  pragma IMPORT_EXCEPTION*
  pragma IMPORT_FUNCTION*
  pragma IMPORT_OBJECT*
  pragma IMPORT_PROCEDURE*
  pragma IMPORT_VALUED_PROCEDURE*
  pragma INTEGER_SIZE*
  pragma INTERFACE
  pragma INTERFACE_NAME*
  pragma INLINE_GENERIC*
  pragma LEVEL*
  pragma LINK_OPTION*
  pragma LONG_FLOAT*
  pragma MAIN_STORAGE*
  pragma MEMORY_SIZE
  pragma PACK
  pragma PASSIVE*
  pragma PRIORITY
  pragma PSECT_OBJECT
  pragma SHARED
  pragma SHARE_GENERIC*
  pragma STORAGE_UNIT
  pragma SUPPRESS
  pragma SUPPRESS_ALL*
  pragma SYNCHRONIZE*
  pragma SYSTEM_NAME
  pragma TASK_STORAGE*
  pragma TIME_SLICE*
  pragma TITLE*
  pragma VOLATILE*

11.4 Porting Between Specific Platforms: Comparison Tables

The following sections discuss briefly the factors affecting portability between specific platforms. They include a table for each platform pair highlighting issues when porting and indicating where, in this guide, more information is located.

11.4.1 Porting from DEC Ada for OpenVMS VAX Systems to OpenVMS Alpha Systems

The 64-bit Alpha architecture provides many benefits, particularly in the areas of data representation, data access, and data alignment. However, porting from the 32-bit VAX architecture involves various issues. Table 11-2 highlights the portability issues with pointers to additional information in this guide and notes.

Table 11-2 DEC Ada on OpenVMS VAX and OpenVMS Alpha: Pointers and Notes
Topic Pointers and Notes
Integer types Section 2.1, Table 2-1

Size of LONG_INTEGER differs between platforms.

Floating-point numbers and
representations
Section 2.2, Table 2-2, Table 2-3

Different floating-point representations are available.

Pragma FLOAT_REPRESENTATION Section 2.2.1, Table 2-4

On VAX systems, the default and allowable value is VAX_FLOAT. On OpenVMS Alpha, a choice can be made between VAX_FLOAT and IEEE_FLOAT.

Pragma LONG_FLOAT Section 2.2.2

For this pragma to have effect on OpenVMS Alpha, pragma FLOAT_REPRESENTATION must have a value of VAX_FLOAT.

Representation attributes for floating-point types Section 2.2.3

The values of the representation attributes for floating-point types are summarized in Table 2-5.

Model numbers The model numbers for each floating-point type can be found in Table 2-6.
Safe numbers The safe numbers for each floating-point type can be found in Table 2-7.
Operations on fixed-point types Section 2.3

Unless specified otherwise, handled as follows:

  • On VAX, results are truncated towards 0.0 when the 'SMALL of the fixed-point type is a power of 2. If the 'SMALL of the fixed-point type is not a power of 2, results are rounded.
  • On Alpha, all results are rounded.
Component alignment Section 2.10

Default alignments differ across systems.

Size specification for discrete types Section 2.1, Section 2.3, Section 2.11.1
Record representation clause alignment Section 2.5, Section 2.10
Pragmas Chapter 3

DIGITAL supports a similar set of pragmas across platforms. For specific details, see Chapter 3.

Pragma SYSTEM_NAME Chapter 3

Takes an enumeration literal as its single argument as follows:

  • On VAX, VAX_VMS
  • On Alpha, OpenVMS_AXP
Shared variables Section 4.6.3

See this section for differences in the implementation of the pragma SHARED on VAX and Alpha systems.

Delay statements and related issues Section 4.6.2

This section covers platform differences relating to delay statements, type DURATION, SYSTEM.TICK, type TIME, and function CLOCK.

Tasking Chapter 4

This chapter should be read in its entirety to understand the differences in the implementation of tasking on these two platforms.

Threads/DECthreads Section 4.1

OpenVMS Alpha uses DECthreads to implement tasking. DECthreads routines can be called from DEC Ada programs running on OpenVMS Alpha systems.

On VAX, the Ada RTL has its own threading system. DECthreads routines cannot be called from DEC Ada programs running on VAX systems.

Task ID assignment Section 4.1.1
Task scheduling Section 4.3

On OpenVMS Alpha systems, the operating system schedules Ada tasks along with other threads that are currently running. On OpenVMS VAX systems, the operating system issues the process and the Ada RTL divides up tasks within the process.

Scheduling strategies Section 4.3.1

On VAX, the default is FIFO with preemption. On Alpha systems, the default is round-robin with preemption.

Assigning and controlling task priorities Section 4.3.3
Shared variables Section 4.6.3
Library of predefined units Chapter 6

See the introduction to the chapter for differences in the creation of new program libraries.

Package SYSTEM differences Section titled Package SYSTEM Platform Differences in Chapter 6
Implementation-defined packages Section 6.2

See this section for lists of packages common to all platforms, available on OpenVMS only, and available on DIGITAL UNIX only.

Bindings Section 6.4

The same bindings are available in VAX and Alpha systems.

Compiler and program structure issues Chapter 7, Section 7.1

The program library management commands and their resulting actions are identical on VAX and Alpha systems. However, other details differ and are of interest; for example, the value of SYSTEM_NAME.

Mixed-language programming Section 10.3

In general, all systems support the same interface. However, when you mix code from different languages, some details differ, for example:

  • On VAX systems, C expects data to be byte-aligned.
  • On Alpha systems, C expects data to be naturally aligned.
Product restrictions The following are not supported on Alpha systems:
  • ADA$FROM_CDD
  • Translating VAX Ada images to run on Alpha systems
  • Calling translated images written in other languages


Previous Next Contents Index