Native Mode Arithmetic Traps (new) [ Introduction to MPE XL for MPE V Programmers Migration Guide ] MPE/iX 5.0 Documentation
Introduction to MPE XL for MPE V Programmers Migration Guide
Native Mode Arithmetic Traps
(new)
The following modifications have been made to arithmetic trap handling in
the MPE XL NM Programming environment:
* Two trap conditions still available to MPE V/E and MPE XL CM
applications are not available in NM.
* Twelve new arithmetic trap conditions are available to NM
applications.
* NM compiler directives are available to disable arithmetic traps.
NM versions of the ARITRAP and XARITRAP intrinsics have been modified to
handle the new NM arithmetic trap handling environment. In addition, a
new NM intrinsic, HPENBLTRAP, lets you selectively enable or disable
arithmetic traps, providing you with more flexibility than the ARITRAP
intrinsic.
NOTE The following apply to various arithmetic trap conditions available
to NM applications (accessed through the HPENBLTRAP, ARITRAP, and
XARITRAP intrinsics):
* The results of disabling arithmetic traps on MPE XL are not
guaranteed to be identical to those on MPE V/E.
* NM supports two floating point formats: IEEE and 3000 Mode.
Both execute in NM, but 3000 Mode performs HP 3000-type
manipulations. Since it is possible to use both formats during
program execution, there are separate bits in the mask for
enabling/disabling traps of these formats.
* By default, all arithmetic traps except IEEE floating point
exceptions are enabled, and the system trap handler is armed.
Many floating point operations result in an inexact result.
Consequently, most compiler libraries doing floating point
operations will result in an inexact trap if the IEEE Inexact
Result trap is enabled. Therefore, you should enable the IEEE
Inexact Result trap only if absolutely necessary.
* Some of the new trap conditions are not strictly arithmetic
traps (for example, range errors, NIL pointers, and paragraph
stack overflow). However, they and many arithmetic traps are
caught by reserved instructions that raise the conditional
traps. For this reason, they are treated as arithmetic traps.
* Some of the instructions that raise conditional traps are
reserved to indicate some of the arithmetic trap conditions. A
nonreserved instruction is one not generated by a compiler. If
a nonreserved instruction causes a conditional trap, this is
reported as an Unimplemented Condition Trap.
Arithmetic Traps Not Available in Native Mode
The following arithmetic trap conditions are not handled by the NM
arithmetic trap-handling intrinsics, HPENBLTRAP, ARITRAP, and XARITRAP:
* Invalid Source Word Count
* Invalid Decimal Operand Length
These trap conditions continue to be handled by the CM versions of the
arithmetic trap handling intrinsics.
New Native Mode Arithmetic Traps
The new arithmetic trap conditions listed below are available to
applications executing in the NM programming environment of MPE XL.
* IEEE floating point divide by zero.
* IEEE floating point, inexact result.
* IEEE floating point underflow.
* IEEE floating point overflow.
* IEEE floating point, invalid operation.
* range errors.
* software-detected NIL pointer reference.
* result of software-detected pointer arithmetic misaligned, or error
in conversion from long pointer to short pointer.
* unimplemented condition traps.
* paragraph stack overflow.
* 3000 mode packed decimal error.
Using Compiler Directives to Disable Traps
Another way to disable arithmetic traps on MPE XL is to use NM compiler
directives, for example $ovflcheck off$ in HP Pascal/XL. When compiler
directives are used, the compiler generates arithmetic instructions that
do not trap on overflow. When compiler directives are not used, the trap
actually takes place, but the MPE XL trap subsystem recovers from the
trap and takes the action required to continue execution.
MPE/iX 5.0 Documentation