mod02 compilers

34
Compilers Compilers Module 2

Upload: peter-haase

Post on 07-Jul-2015

157 views

Category:

Technology


5 download

DESCRIPTION

Application Migration to HP NonStop H- und J-Series Operating Systems

TRANSCRIPT

Page 1: Mod02 compilers

CompilersCompilersModule 2

Page 2: Mod02 compilers

2 - Compilers 2

Tool TNS/R TNS/EpTAL compiler (Guardian) PTAL EPTAL

C compiler (Guardian) NMC CCOMP

C++ compiler (Guardian) NMCPLUS CPPCOMP

COBOL compiler (Guardian) NMCOBOL ECOBOL

C compiler (OSS) c89 c 8 9

C++ compiler (OSS) c89 c 8 9

COBOL compiler (OSS) nmcobol ecobol

Non-PIC linker nld Not supported

PIC linker ld eld

Loader (for DLLs) rld rld

Object File Utility noft enoft

(command line) Debuggers DEBUG Not supported

INSPECT EINSPECT

New Names for native CompileNew Names for native Compile

Page 3: Mod02 compilers

TNS/E COBOL CompilerTNS/E COBOL Compiler

◦ Guardian environment: ECOBOL/IN <src-file> [,OUT <list-file>] [options]/

[<obj-file>][;directives,…]

◦ OSS environment: ecobol myProg.cbl –o myProg.exe

◦ Creates code 800 linkfile Executable if RUNNABLE directive used

2 - Compilers 3

Page 4: Mod02 compilers

Obsolete DirectivesObsolete Directives◦ NON-SHARED — Ignored. All code is now position-independent code (PIC).

◦ LARGEDATA: Ignored, warning generated.◦ LESS-CODE: Ignored, warning generated.

◦ LD: Error generated, Replaced by ELD◦ NLD: Error generated, Replaced by ELD

2 - Compilers 4

Page 5: Mod02 compilers

Changed Directives and ClausesChanged Directives and Clauses◦ UL: Indicates code for a dynamic-link library (DLL).

◦ SYNCHRONIZED Applies to 01 and 77 level items . May now align to a 8-byte boundary,

if item is 4 or more bytes long.

◦ OPTIMIZE — Level 2 provides more.

◦ RENAMES — of an 01 item now correctly gives error (use REDEFINES instead)

2 - Compilers 5

Page 6: Mod02 compilers

New FeaturesNew Features◦ Support for some COBOL-2002 standard

features: BASED

No storage allocated for item

ALLOCATE Obtain dynamic memory

FREE Release dynamic memory

New reserved words Requires STANDARD 2002 directive

2 - Compilers 6

Page 7: Mod02 compilers

File Name ChangesFile Name ChangesGuardian API declarations:◦ NMCOBEXx changes to ECOBEXx

Where x is 0: Latest 1: Next to latestT: Oldest

Might appear inCONSULTSEARCHSPECIAL-NAMESCALLENTER

2 - Compilers 7

Page 8: Mod02 compilers

Other ChangesOther Changes◦ IEEE Floating point now used for certain

intrinsic functions: Trigonometric and Logarithmic Better performance Results differ from Tandem_floating point

◦ Linkfiles can be flagged as NEUTRAL_FLOAT Useable in programs of either format

2 - Compilers 8

Page 9: Mod02 compilers

ScreenCobol CompilerScreenCobol Compiler Optional use of Pathtcp4◦ Context-sensitive support:

DIALOG-BEGIN Start a dialog with single server process Optionally sends data

DIALOG-SEND Continue dialog

DIALOG-ABORT Cancel dialog

DIALOG-END Perform Clean-up operations No data sent to server

◦ Allows >32k bytes of data per transaction Server:◦ New system message: –121, PATHSEND DIALOG ABORT

2 - Compilers 9

Page 10: Mod02 compilers

TNS/E C/C++ CompilerTNS/E C/C++ Compiler◦ The TNS/E C/C++ compiler complies with the

following standards: C - ANSI X3J11/88-159 ISO/IEC 9899:1990 (E) C++ - ISO/IEC 14882 1998-09-01

◦ Guardian C: CCOMP/IN <src-file> [,OUT <list-file>] [options]/

[<objfile>][;directives,…]

◦ Guardian C++: CPPCOMP/IN <src-file> [,OUT <list-file>] [options]/

[<objfile>][;directives,…]

◦ OSS C/C++: c89 myProg.c –o myProg.exe –Wtarget={TNS/E|TNS/R} OSS defaults to current platform

2 - Compilers 10

Page 11: Mod02 compilers

Obsolete PragmasObsolete Pragmas◦ EXTERN_DATA: (GP-relative addressing) not supported.◦ NON_SHARED: Ignored.

All code is now position-independent code (PIC).

◦ LD: Error generated, replaced by ELD◦ NLD: Error generated, replaced by ELD

◦ VERSION1 — Not supported; VERSION3 is the default (the MIGRATION_CHECK pragma can be used with the VERSION2 pragma to aid in converting to VERSION3).

◦ SRLxxxx — SRLs obsoleted by DLLs. TNS/R C/C++ provided a number of SRL-related pragmas. Since TNS/E does not support SRLs, these pragmas are obsolete and not supported by the TNS/E C/C++ compiler.

2 - Compilers 11

Page 12: Mod02 compilers

Changed PragmasChanged Pragmas

◦ IEEE_FLOAT — Is now the default ◦ TANDEM_FLOAT — Is still available

◦ Linkfiles can be flagged as NEUTRAL_FLOAT Useable in programs of either format

2 - Compilers 12

Page 13: Mod02 compilers

New PragmasNew PragmasNEUTRAL◦ Compiler pragma

-Wbuilding_neutral_library◦ Command line option

◦ For creating a C++ version2/version3 independent DLL◦ Cannot use objects marked MODEL_DEPENDENT

MODEL_DEPENDENT◦ Used in C++ standard headers only

2 - Compilers 13

Page 14: Mod02 compilers

New PragmasNew PragmasMAXALIGN◦ Applies to the definition of a composite type.

C applies to array types, struct types, and union types. C++ applies to classes as well. TNS/E: 16 bytes alignment Does not affect the layout or alignment of the

components of the composite type. It only affects the overall alignment for the composite type.

To control the layout of the components of a class, struct, or union, the FIELDALIGN pragma must still be specified in addition to the MAXALIGN pragma.

2 - Compilers 14

Page 15: Mod02 compilers

New FeaturesNew Features

New data type

◦ unsigned long long TNS/E C/C++ supports an unsigned 64 bit integer type, Range is 0 .. 18446744073709551615. The suffixes for unsigned long long literals are ULL and ull.

unsigned long long var = 18446744073709551615ULL;

◦ intmax for Preprocessor Expressions Preprocessor expressions are evaluated using intmax_t and uintmax_t. Intmax_t and uintmax_t are defined in <stdint.h> to be long long and

unsigned long long, respectively.◦ Supporting functions:

strtoll: char string to signed long long strtoull: char string to unsigned long long wcstoll: wide-char string to signed long long wcstoull: wide-char string to unsigned long long

2 - Compilers 15

Page 16: Mod02 compilers

New FeaturesNew Features

C99 support:

◦ __func__ Identifier

◦ Universal Character Names

Usable in identifiers etc. to designate characters that are not in the basic character set

A universal character name has the form: \unnnn or \Unnnnnnnn (where n is a hexadecimal digit)

◦ Digraph Characters Two-character sequences that represent a single character

2 - Compilers 16

Page 17: Mod02 compilers

New FeaturesNew Features

C99 support (continued):

◦ Aggregate initialization Designators initialize the components of an array or struct.

◦ Nonconstant Aggregate Component Initializers The initializer expression for an automatic composite

variable can contain nonconstant subexpressions.

2 - Compilers 17

Page 18: Mod02 compilers

New FeaturesNew Features

C99 support (continued):

◦ Mixed Statements and Declarations Declarations can appear within a block.

◦ New Block Scopes for Selection and Iteration Statements All selection statements (if, if/else, and switch statements) and

iteration statements (while, do/while, and for statements) and their associated substatements are considered to be blocks.

2 - Compilers 18

Page 19: Mod02 compilers

New FeaturesNew Features C99 support (continued):

◦ Variadic Macros Variadic function-like macros with a variable number of

arguments. Example

#define debug (...) fprintf (stderr, __VA_ARGS__)

debug ("flag"); // expands to: fprintf (stderr, "flag");

debug ("x = %i\n", x); // expands to: fprintf (stderr, "x = %i\n", x);

2 - Compilers 19

Page 20: Mod02 compilers

Other ChangesOther Changes

CEXTDECS file◦ Uses int data type for 32-bit values◦ Previously used long data type◦ Gives warning during compilation

New Exception handler architecture (C++)◦ Better performance

2 - Compilers 20

Page 21: Mod02 compilers

Other ChangesOther Changes

Compiler order of evaluation◦ TNS/E compiler evaluates in different order ◦ Incorrect code that worked on TNS/R may

not work on TNS/E char * ptr; ... ptr = strcpy(ptr, "string") + strlen(ptr);

2 - Compilers 21

Page 22: Mod02 compilers

Documentation ChangeDocumentation Change

2 - Compilers 22

Library File Names

Page 23: Mod02 compilers

Using Conditional CompilationUsing Conditional Compilation Test macros are available to control conditional compilation:◦ _TNS_E_TARGET, _TNS_R_TARGET

#ifdef _TNS_E_TARGET /* TNS/E specific code goes here */ #else /* TNS/R specific code goes here */ #endif

◦ _TANDEM_ARCH_: 0: TNS, 1: TNS/R, 2: TNS/E

#if _TANDEM_ARCH_ = 2 /* TNS/E specific code goes here */ #else /* TNS or TNS/R specific code goes here */ #endif

2 - Compilers 23

Page 24: Mod02 compilers

TNS/E epTAL CompilerTNS/E epTAL Compiler

◦ Guardian environment: EPTAL/IN <src-file> [,OUT <list-file>] [options]/ [<obj-

file>][;directives,…]

◦ Creates code 800 linkfile

2 - Compilers 24

Page 25: Mod02 compilers

Obsolete DirectivesObsolete Directives◦ ?SAVEGLOBALS — Gives error◦ ?USEGLOBALS — Gives error

◦ ?BEGINCOMPILATION — Ignored◦ ?[NO]CALL_SHARED — Ignored◦ ?SRL — Ignored

◦ ?[NO]GP_OK — Ignored◦ ?PUSHGP_OK — Ignored◦ ?POPGP_OK — Ignored

2 - Compilers 25

Page 26: Mod02 compilers

Changed DirectivesChanged Directives

◦ ?NOOVERFLOW_TRAPS Now the default

◦ ?OPTIMIZEFILE Some conditions now cause warnings:

File does not exist, cannot be opened, is not code 101 Same procedure appears multiple times Procedure is unknown Invalid optimize level

2 - Compilers 26

Page 27: Mod02 compilers

Other ChangesOther Changes

◦ INTERRUPT procedure attribute not supported

◦ AUTO and PLATFORM perform same alignment in eptal

2 - Compilers 27

Page 28: Mod02 compilers

Function ChangesFunction Changes$AXADR Not supported Replace with standard interface

(see ref. manual)

$EXECUTIO Not supported Remove from the program

$FREEZE Allowed as DEFINE name

Replace with the $TRIGGER (new in TNS/E)

$HALT Allowed as DEFINE name

Replace with the $TRIGGER (new in TNS/E)

$INTERROGATE[H]IO Not supported Remove from the program

$LOCATESPTHDR Not supported Remove from the program

$LOCKPAGE Not supported Remove from the program

$READBASELIMIT Not supported Remove from the program

$READSPT Not supported Remove from the program

$STACK_ALLOCATE Behavior change Address and size rounded up to 16-bytes (was 8 bytes)

$UNLOCKPAGE Not supported Remove from the program

$WRITEPTE Not supported Remove from the program

2 - Compilers 28

Page 29: Mod02 compilers

RETURN and RETURNSCCRETURN and RETURNSCC

TNS/E behavior

The TNS/E pTAL compiler issues a warning whenever a pTAL procedure returns both a traditional function value and a condition code value.

Read the migration guide for details on how to migrate such a procedure

2 - Compilers 29

Page 30: Mod02 compilers

New epTAL FeatureNew epTAL Feature

STRUCTALIGN (MAXALIGN) for 16-byte aligned data

◦ Certain NonStop H-series functions require data to be aligned on 16-byte boundaries. TNS/E pTAL requires such data to be declared in a structure template that provides this 16-byte alignment. STRUCTALIGN (MAXALIGN) causes data to be aligned on the maximum alignment defined for the platform, which is 16 bytes for the TNS/E platform.

◦ GETPOOL and POOL_GETSPACE_ 16-byte alignment vs. 4-byte alignment on TNS/R

2 - Compilers 30

Page 31: Mod02 compilers

New Guardian Procedure CallsNew Guardian Procedure Calls◦ PROCESS_DELAY_ : Supercedes DELAY

◦ TIMER_START_ : Allows microseconds in time period

◦ TIMER_STOP_◦ TS_NANOSECS_ : Nanoseconds since last coldload

◦ TS_UNIQUE_CREATE_ Create network-wide 128-bit unique timestamp

◦ TS_UNIQUE_COMPARE_◦ TS_UNIQUE_CONVERT_TO_JULIAN_

Convert 128-bit timestamp to 64-bit Julian timestamp

2 - Compilers 31

Page 32: Mod02 compilers

Changed Guardian ProceduresChanged Guardian Procedures◦ New return values for:

PROCESSORTYPE PROCESSOR_GETNAME_ PROCESSOR_GETINFOLIST_

can also report number of IPUs

(REMOTE)TOSVERSION

◦ DEBUG and PROCESS_DEBUG_ Invoke NonStop H-series debuggers

2 - Compilers 32

Page 33: Mod02 compilers

Questions ?Questions ?

33

Page 34: Mod02 compilers

2 - Compilers 34