HP 9000 Computer Systems HP Pascal/HP-UX Release Notes Version A.10.06 HP 9000 Series Workstations and Servers ABCDE HP Part No. 5965-0719 Printed in U.S.A. June 1996 E0696 FINAL TRIM SIZE : 7.5 in x 9.
The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and tness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material.
Summary of Technical Changes The new features available with HP Pascal/HP-UX Release 10.20 include: New architecture options for optimization and portability New scheduling option for PA-RISC 2.0 New architecture and scheduling defaults New or changed optimization options to enhance performance: +Odataprefetch +Oentrysched +Ofltacc +Oloop_unroll New +help option for ld. These release notes also describe the changes that were made in Release 10.01, 10.0, and Release 9.0 Version A.09.12.
FINAL TRIM SIZE : 7.5 in x 9.
Contents 1. New and Changed Features Release 10.20 Changes . . . . . . . . . . . . . . . . . . . Optimization Levels . . . . . . . . . . . . . . . . . . . . Optimization Parameters . . . . . . . . . . . . . . . . . Combining Optimization Options . . . . . . . . . . . . . Obsolete Optimizer Options . . . . . . . . . . . . . . . Memory Consumption When Compiling at Optimization Level 4 Pro le-Based Optimization (PBO) . . . . . . . . . . . . . Invoking PBO . . . . . . . . . . . . . . . . . . . . .
File Control Block List . . . . . . . . . . . File Control Blocks . . . . . . . . . . . . . Heap Management . . . . . . . . . . . . . . Other Libraries (Trap and Unwind Libraries) . . . Referencing Shared-Library Data (+k Option) . . . Four-Byte Extended UNIX Code (EUC) . . . . . . System V Release 4 (SVR4) File Layout . . . . . . Environment Variables Used by HP Pascal/HP-UX . LPATH . . . . . . . . . . . . . . . . . . . MANPATH . . . . . . . . . . . . . . . . . NLSPATH . . . . . . . . . . . . . . . . . .
2. Installation Information 3. Relevant Documentation 4. Problem Descriptions and Fixes HP Pascal/HP-UX Language Manuals . . . . . . . . . . . . Other Manuals . . . . . . . . . . . . . . . . . . . . . . Additional Documentation . . . . . . . . . . . . . . . . . Problems Encountered with Combining Options +DA2.0 and +O2 . . . . . . . . . . . . . . . . . . . . . . . . . Operating System and Compiler Information . . . . . . . . . 3-1 3-1 3-2 4-1 4-2 Contents-3 FINAL TRIM SIZE : 7.5 in x 9.
Tables 1-1. 1-2. 1-3. 1-4. 1-5. 1-6. 1-7. 1-8. 1-9. 1-10. Optimization Levels . . . . . . . . . . . . . . General Optimization Options . . . . . . . . . Advanced Optimization Options . . . . . . . . Location of Files . . . . . . . . . . . . . . . Exponent Values . . . . . . . . . . . . . . . HP Pascal/HP-UX Data Types . . . . . . . . . Command-Line Options Speci c to Series 300/400 Command-Line Options Speci c to Series 700/800 Compiler Options Speci c to Series 300/400 . . .
1 New and Changed Features This chapter describes the new and changed features for HP Pascal/HP-UX in Release 10.0, 10.01, and 10.20. Because the HP Pascal/HP-UX Reference Manual and HP Pascal/HP-UX Programmer's Guide are not being updated at this time, this chapter also reviews the changes that were made in Release 9.0 Version A.09.12. The Release 10.20 changes are marked with change bars in the outside margins. Release 10.20 Changes The Release 10.
New +help option for ld|to invoke online help for the HP linker and libraries. Optimization Levels HP Pascal/HP-UX supports ve levels of optimization. The corresponding command-line options are summarized in Table 1-1. Note 1-2 HP Pascal/HP-UX does not support some of the +O3 and +O4 optimization features that are available in other compilers. New and Changed Features FINAL TRIM SIZE : 7.5 in x 9.
Table 1-1. Optimization Levels Option Meaning +O0 Minimal optimization, including constant folding and simple register assignment. This is the default. +O1 Branch optimizations, instruction re-scheduling, faster register allocation, and other block-level optimizations. At this level of optimization, programs compile quickly and still realize some execution speed-up.
Optimization Parameters Additional general and speci c/advanced parameters allow you to enable or disable certain types of optimization techniques according to their e ect on code size, compilation time, run-time performance, and other user-visible e ects. In addition to the general parameters that control types of optimizations, there are speci c parameters that control optimizations within those types.
Table 1-2. General Optimization Options General Option +O[no]aggressive Levels 2, 3, 4 Optimization Performed +Oaggressive enables optimizations that can result in signi cant performance improvement, but can change a program's behavior. These optimizations include newly released optimizations and the optimizations invoked by the following advanced optimization parameters (see Table 1-3): +Oentrysched +Onofltacc +Olibcalls +Onoinitcheck +Oregionsched +O[no]all Level 4 The default is +Onoaggressive.
Table 1-2. General Optimization Options (continued) General Option +O[no]entrysched Levels 2, 3, 4 Optimization Performed The +Oentrysched option optimizes instruction scheduling on a procedure's entry and exit sequences. Enabling this option can speed up an application. The option has unde ned behavior for applications which handle asynchronous interrupts. The option a ects unwinding in the entry and exit regions.
Table 1-3. Advanced Optimization Options Advanced Option +O[no]fastaccess Levels 0, 1, 2, 3, 4 Optimization Performed +Ofastaccess optimizes for fast access to global data items. Use +Ofastaccess to improve execution speed at the expense of longer compile and link times. At all optimization levels, except level 4, the default is +Onofastaccess. At optimization level 4, the default is +Ofastaccess.
Table 1-3. Advanced Optimization Options (continued) Advanced Option +O[no]initcheck Levels 2, 3, 4 Optimization Performed The initialization checking feature of the optimizer has three possible states: on, o , or unspeci ed. When on (+Oinitcheck), the optimizer initializes to zero any local, scalar, non-static variables that are uninitialized with respect to at least one path leading to a use of the variable.
Table 1-3. Advanced Optimization Options (continued) Advanced Option Optimization Performed +O[no]loop_unroll The +Oloopunroll option turns on loop unrolling. When you [=unroll factor] use +Oloopunroll , you can also use the unroll factor to control the code expansion. The default unroll factor is 4, that is, four Levels 2, 3, 4 copies of the loop body. By experimenting with di erent factors, you may improve the performance of your program. The default is +Oloopunroll .
Table 1-3. Advanced Optimization Options (continued) Advanced Option +O[no]regreassoc Levels 2, 3, 4 Optimization Performed +Onoregreassoc turns o register reassociation. Use +Onoregreassoc to disable register reassociation if this optimization hinders the optimized application performance. The default is +Oregreassoc. Combining Optimization Options One use of the optimization parameters is to turn o a speci c optimization that may not be appropriate for your program.
Obsolete Optimizer Options The following optimizer options are no longer supported by the HP Pascal/HP-UX compiler: +Obb (replaced by +Onosize) +Os (replaced by +Onopipeline) $OPTIMIZE 'BASIC_BLOCKS num '$ $OPTIMIZE 'BASIC_BLOCK_FENCE num '$ If you use these options, the compiler issues a warning stating that the options are unrecognized. New and Changed Features FINAL TRIM SIZE : 7.5 in x 9.
Memory Consumption When Compiling at Optimization Level 4 When you link a program, the compiler brings all modules that were compiled at optimization level 4 into virtual memory at the same time. Depending on the size and number of the modules, compiling at +O4 can consume a large amount of virtual memory. If you are linking a large program that was compiled with the +O4 option, you may notice a system slow down. In the worst case, you can get an error indicating that you have run out of memory.
Profile-Based Optimization (PBO) Pro le-based optimization (PBO) is a set of code-improving transformations that are based on feedback concerning the run-time characteristics of an application. Run-time pro le data is collected during program execution. This information is fed back to the optimizer, which performs a variety of optimizations based upon how frequently certain code is executed and how frequently calls are made between di erent code segments.
you use the +I compile-line option to compile source les, instrumentation can be added within the code for each subroutine in that le. In the following example, the source le sample.p is compiled, instrumented, and linked into sample.inst: pc -o sample.inst -O +I sample.p Collecting Execution Profile Statistics To collect execution pro le statistics, run your program using reasonably representative data. The pro le database le, flow.
Maintaining Multiple Profile Data Files By default, PBO logs the pro le statistics in a le called flow.data. You can specify another name with the +df compile-line option. The name of the executable le used during pro ling is the name under which the pro le data is stored in the database le. If you specify a di erent executable output le name during the optimization phase, you need to use the +pgm option to specify the program name used during pro ling.
+DA Command-Line Option +DAmodel Generates object code for a particular version of the PA-RISC architecture. Also speci es which version of the HP-UX math library to link in when you have speci ed -lm. (See the HP-UX Floating-Point Guide for more information about using math libraries.) Object code generated for PA-RISC 2.0 will not execute on PA-RISC 1.1 systems. Note To generate code compatible across PA-RISC 1.1 and 2.0 workstations and servers, use the +DAportable option.
For More Information: See \Compiling for Di erent Versions of the PA-RISC Architecture" below. See the le /usr/lib/sched.models for model numbers and their architectures. Use the command uname -m to determine the model number of your system. model Parameter model can be either a model number of an HP 9000 system (such as 730, 877, F20, or I50); PA-RISC architecture designations 2.0 or 1.1; or the term portable. Use the +DAportable compiler option to generate code compatible across 1.1 and 2.
Compiling in Networked Environments When compiles are performed using diskless workstations or NFS-mounted le systems, it is important to note that the default code generation and scheduling are based on the local host processor. The system model numbers of the hosts where the source or object les reside do not a ect the default code generation and scheduling. 1-18 New and Changed Features FINAL TRIM SIZE : 7.5 in x 9.
+DS Command-Line Option +DSmodel Performs instruction scheduling tuned for a particular implementation of the PA-RISC architecture. Object code with scheduling tuned for a particular model will execute on other HP 9000 systems, although possibly less e ciently. If you do not specify this option, the default instruction scheduling is for the system you are compiling on. If you plan to run your program on both PA-RISC 1.1 and 2.0 systems, use the +DS2.0 designation.
Using +DS to Specify Instruction Scheduling Instruction scheduling is di erent on di erent implementations of PA-RISC architectures. You can improve performance on a particular model or processor of the HP 9000 by requesting that the compiler use instruction scheduling tuned to that particular model or processor. Using scheduling for one model or processor does not prevent your program from executing on another model or processor.
HP Pascal/HP-UX Built-In Functions Two built-in functions are available in HP Pascal/HP-UX. roundlong The roundlong function returns the longint value of the argument, rounded to the nearest integer. If x is positive or zero, roundlong(x ) is equivalent to trunclong(x +0.50); otherwise, roundlong(x ) is equivalent to trunclong(x -0.50). It is an error if the result is greater than 263 -1 or less than -263 . Syntax roundlong (x) where x is any real or longreal expression.
Debugging Optimized Code (DOC) In conjunction with the HP Distributed Debugging Environment (DDE), the HP Pascal/HP-UX compiler now provides support for debugging optimized code. This support includes: Tracebacks with line-number annotation. Setting breakpoints and single-stepping at the source statement level. Mapping between source statements and machine instructions. Viewing and modifying global variables at procedure call boundaries. Viewing and modifying parameters on procedure entry.
Making Thread-Safe HP Pascal/HP-UX Routines There are four major areas of concern when using HP Pascal/HP-UX multithreaded applications. These concerns are: Outer block limitations Input/output Heap management Other libraries (Trap and Unwind libraries) Not all Pascal routines and constructs that use these features are thread-safe. For example, Pascal I/O procedures such as APPEND, CLOSE, READLN, and WRITELN are not thread-safe.
Input/Output Because of the language de nition of various Pascal I/O statements, it is impossible to make them completely thread-safe. For example, WRITELN(f,a,b,c); is replaced by WRITE(f,a); WRITE(f,b); WRITE(f,c); WRITELN(f); and READDIR(f,k,x); is replaced by SEEK(f,k); READ(f,x); In a threaded application, the input or output could be interspersed. Because of the language design limitation, you must do your own locking for each le or use a separate le for each thread.
File Control Blocks The le control blocks themselves are not protected. There is a control block for each opened le. Reading, writing, and other operations on a le search the list and update the le's control block or return information from the control block. Each control block contains its own bu er for le reading and writing. The le control blocks must reside in a shared data area.
The only other construct that is important to note is that certain string manipulation operators and functions use the heap for temporary storage. This is thread-safe but may cause a performance problem. You can use the $STRINGTEMPLIMIT$ compiler option to allocate space in the stack. 1-26 New and Changed Features FINAL TRIM SIZE : 7.5 in x 9.
Referencing Shared-Library Data (+k Option) The HP Pascal/HP-UX compiler now can generate long-displacement code sequences for referencing global data. This behavior is triggered by the +k command-line option and con icts with generating Position Independent Code (PIC). Compiling with +k becomes necessary in the rare case when a program references a very large number of distinct variables that are de ned in shared libraries.
Table 1-4. Location of Files File or Library Driver Compiler Linker Instrumented startup Normal startup gprof startup prof startup Debugger end info C library Pro led C library Math library Common les that span multiple products 1-28 Location /opt/pascal/bin/pc /opt/pascal/lbin/pascom /usr/ccs/bin/ld /opt/langtools/lib/icrt0.o /opt/langtools/lib/crt0.o /opt/langtools/lib/gcrt0.o /opt/langtools/lib/mcrt0.o /opt/langtools/lib/end.o /usr/lib/libc.a /usr/lib/libc.sl /usr/lib/libp/libc.a /usr/lib/libcl.
Environment Variables Used by HP Pascal/HP-UX HP Pascal/HP-UX Release 10.0 uses the following environment variables somewhat di erently than it previously did: LPATH MANPATH NLSPATH PATH HP Pascal/HP-UX Release 10.01 uses a new environment variable to determine how the runtime library processes oating-point number string format: PASRUNOPTS The following sections describe how HP Pascal/HP-UX uses each variable. Some of these variables may be set appropriately by the system login routines.
PATH To invoke pc, set PATH to include /opt/pascal/bin. PASRUNOPTS PASRUNOPTS is a new Pascal runtime variable that determines how the runtime library processes oating-point number string format. This variable can be used to increase the portability of PASCAL to other languages and vendors. Description The table for this variable (see Table 1-5)is divided into three columns; currently only column 1 is supported. The value speci ed in column 1 determines what exponent is printed for LONGREAL output.
Note The way the compiler recognizes its constants is not a ected (i.e., only \L" is valid for LONGREAL). Example PASRUNOPTS="E"; export PASRUNOPTS program prog(output); begin writeln(1.0L+200) end. The output from this example is 1.0E+200. The variable is only fetched from the environment once, the rst time that it is needed. Changing the environment will not have an e ect on the runtime library.
585 MESSAGE CONDITIONAL USE OF UNINITIALIZED VARIABLE '!' (585) W CAUSE The local variable mentioned in the message may be uninitialized when used in this procedure or function. ACTION It may be initialized in a THEN clause and not the ELSE clause. Or it may not appear in all statements of a CASE. Or it may be in a FOR or WHILE loop that might never execute. Ensure that the variable is initialized before use.
Porting HP Pascal/HP-UX Programs If you plan to run your programs only on HP computers, the e ort to port your programs between HP computers is minimal and the extra features that HP Pascal/HP-UX provides will make your programming much easier. However, if you plan to port your programs to another vendor's computer, the e ort to do so will be proportional to your use of nonstandard HP Pascal/HP-UX extensions.
Table 1-6.
Control Constructs The TRY/RECOVER construct is supported on all HP-UX implementations. Escape codes for errors di er signi cantly between the implementations. The mark and release procedures are supported on all HP-UX implementations. There are minor di erences in behavior but code is essentially portable. Input/Output Series 300/400 and 700/800 di er in the way each allows association with an HP-UX le descriptor in the reset procedure. The association is not similar in the associate procedure.
Assignment to Procedure Variables Assignment to a procedure variable has a di erent syntax on each of the two architectures. Maximum String Size On the Series 300/400, the maximum string size is 255 characters. By specifying the LONGSTRINGS compiler option, maximum string size is virtually unlimited. The string size on Series 700/800 is unlimited. ANYVAR Parameters ANYVAR is supported on all HP-UX implementations. Series 300/400 does not perform checks to see if ANYVAR values are legitimate.
Other Features Program parameters have slight semantic di erences between Series 300/400 and Series 700/800. Arguments for the + operator with strings di er between Series 300/400 and Series 700/800. For example, chr cannot be used with + on Series 700/800. Series 300/400 and Series 700/800 each generate di erent listings. Features Supported only on Series 300/400 You can use the addr function to get the address of a constant. A procedure alias is evaluated before addr(alias ) is performed.
You must compile with $STANDARD_LEVEL 'EXT_MODCAL'$ to convert a pointer to an integer with ord(pointer type ), packed array of char requires a lower bound of one. Command-Line Options Table 1-7 summarizes the command-line options that are available only on the Series 300/400 or that behave di erently on the Series 700/800. Table 1-7. Command-Line Options Specific to Series 300/400 Command Option 1-38 E ect +A Use 2-byte alignment rules. +bfpa A ect oating-point operations.
Table 1-8 summarizes the command line compiler options that are available only on the Series 700/800 or that behave di erently on the Series 300/400. Table 1-8.
Compiler Options The HP Pascal/HP-UX compilers support a wide range of compiler options. Some options are identical on all systems. Some options are unique to a particular system. Some options have di erent semantics and slightly di erent syntax from one system to the other. For portable code, keep compiler options to a minimum and avoid options that a ect the semantics of the language or enable system level programming extensions. For example, avoid using the $SYSPROG$ option on the Series 300/400.
Table 1-9. Compiler Options Specific to Series 300/400 (continued) Compiler Option E ect LINES1 Speci es number of lines per page on a listing. Default value is 60. LITERAL_ALIAS1 Determines the case-sensitivity of an alias name. LONGSTRINGS Extends the maximum length of strings from 255 characters to virtually any length. RANGE1 Does run-time checks for range errors. SAVE_CONST Controls scope of structured constants. SEARCH1 Speci es les to be used to satisfy IMPORT declarations.
Table 1-10 lists options that are speci c to Series 700/800 as well as options that have the same name on Series 300/400 but di erent semantics. Table 1-10. Compiler Options Specific to Series 700/800 Compiler Option E ect ALIGNMENT Changes storage alignment for types other than strings and le types. ANSI1 The compiler issues an error message when it encounters a feature in the source code that is illegal in ANSI Standard Pascal. $ANSI ON$ is equivalent to $STANDARD_LEVEL 'ANSI'$ .
Table 1-10. Compiler Options Specific to Series 700/800 (continued) Compiler Option E ect EXTERNAL Used in conjunction with the GLOBAL option, EXTERNAL enables you to compile one program as two or more compilation units. EXTNADDR Speci es long pointer accessing. GLOBAL Used in conjunction with the EXTERNAL option, GLOBAL enables you to compile one program as two or more compilation units. GPROF Generates code for pro ling.
Table 1-10. Compiler Options Specific to Series 700/800 (continued) Compiler Option LITERAL_ALIAS1 E ect $LITERAL_ALIAS ON$ causes the compiler to di erentiate between uppercase and lowercase letters for aliases. $LITERAL_ALIAS OFF$ causes the compiler to downshift aliases. LOCALITY Causes a locality name to be written to the object le for performance. MLIBRARY Speci es an alternate le into which the module export text is to be written.
Table 1-10. Compiler Options Specific to Series 700/800 (continued) Compiler Option E ect SUBPROGRAM Causes the compiler to emit code for speci ed level-one routines only. This option enables you to compile selected routines of a program. SYMDEBUG Emits debugger information for xdb. SYSINTR Speci es the intrinsic le to be searched for information on intrinsic routines. TABLES1 When used with LIST ON, the listing includes an identi er map for each compilation block.
FINAL TRIM SIZE : 7.5 in x 9.
2 Installation Information Read this entire document, and any other Release Notes or READMEs you may have before you begin an installation. After loading the HP-UX 10.20 or later operating system, you can install HP Pascal/HP-UX. To install your software, run the SD-UX swinstall command. It will invoke a user interface that will lead you through the installation.
FINAL TRIM SIZE : 7.5 in x 9.
3 Relevant Documentation HP Pascal/HP-UX Language Manuals HP Pascal/HP-UX Reference Manual (92431-90005) HP Pascal/HP-UX Programmer's Guide (92431-90006). pc (1) online manual entry Other Manuals HP-UX Floating-Point Guide (B3906-90004) HP-UX System Administration Tasks (B2355-90079) Programming With Threads on HP-UX (B2355-90060) Procedure Calling Conventions Reference Manual (09740-90015) PA-RISC 1.
Additional Documentation ALLBASE/SQL Pascal Application Programming Guide (36217-90007) HP C Programmer's Guide (92434-90002) HP-DDE Debugger Online Help Refer to the discussion on basic-style (not advanced-style) debugging of optimized code in the HP/DDE debugger online help. HP-UX Linker and Libraries Online User Guide To access the HP Linker and Libraries Online User Guide use the command: ld +help The HP Linker and Libraries Online User Guide online guide replaces the manual Programming on HP-UX .
The +help option may not work on systems running HP CDE. If it does not work, ensure the environment variable DTHELPSEARCHPATH is set. (It may not be set if you rlogin to a system, for example.) If it is not set, use the following command to set it: eval $(dtsearchpath) Ensure the LANG environment variable is set, typically LANG=C.
FINAL TRIM SIZE : 7.5 in x 9.
4 Problem Descriptions and Fixes Problems Encountered with Combining Options +DA2.0 and +O2 The following problems relate to the use of +DA2.0 with the optimization option +O2. (This problem does not a ect the use of +DS2.0.) It is recommended that you use +DA1.1 if any of the following errors occur. They are all related to speci c optimizations made for PA-RISC 2.0 systems dealing with 64-bit register support.
Incorrect results occur when using MOD by a non-power of 2 constant for LONGINT or BIT52. Incorrect aliasing will degrade performance of LONGINT or BIT52 and probably negate any bene t of +DA2.0 for Pascal. Operating System and Compiler Information For information on HP Pascal/HP-UX product problems and xes, refer to the Software Status Bulletin or the Software Release Bulletin . The product number to assist you in nding SSB and SRB reports for HP Pascal/HP-UX on the Series 700 and 800 is 92431A.