Argument list examples

All examples shown are for non-extended-mode enabled routines.

Example 1A: call Suba(l1,d,l2)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  R1                 0 |        l1...      | P1
                       ---------------------
  FP0                4 |        du...      | P2
                       ---------------------
                     8 |        dl...      | P3
                       ---------------------
  STACK             12 |        l2         | P4
                       ---------------------

Note that the compiler does not initialize the related argument slots in the argument area of the stack, although they are still allocated in case the callee needs them. Only one word is used in the corresponding argument slot in the argument area.

Example 1B: call Suba(d,l1,l2)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  FP0                0 |        du...      | P1
                       ---------------------
                     4 |        dl...      | P2
                       ---------------------
  GPR3               8 |        l1...      | P3
                       ---------------------
  STACK             12 |        l2         | P4
                       ---------------------
Example 1C: call Suba(&d,l1,&l2,&l3)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  GPR1               0 | address of d      | P1
                       ---------------------
  GPR2               4 |       l1          | P2
                       ---------------------
  GPR3               8 | address of l2     | P3
                       ---------------------
  STACK             12 | address of l3     | P4
                       ---------------------

The next examples illustrate the passing of argument areas by reference parameters.

Example 2: call Suba(e,l)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  FP0/FP2            0 |        euu...     | P1
                       ---------------------
                     4 |        eul...     | P2
                       ---------------------
                     8 |        elu...     | P3
                       ---------------------
                    12 |        ell...     | P4
                       ---------------------
  STACK             16 |         l         | P5
                       ---------------------
Example 3: call Suba(d1,d2,l)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  FP0                0 |        d1u...     | P1
                       ---------------------
                     4 |        d1l...     | P2
                       ---------------------
  STACK              8 |        d2         | P3
                       |                   |
                    12 |                   | P4
                       ---------------------
  STACK             16 |         l         | P5
                       ---------------------
Example 4: call Suba(l1,l2,d1,d2,l3)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  R1                 0 |         l1...     | P1
                       ---------------------
  R2                 4 |         l2...     | P2
                       ---------------------
  FP0                8 |        d1u...     | P3
                       ---------------------
                    12 |        d1l...     | P4
                       ---------------------
  STACK             16 |        d2         | P5
                       |                   |
                    20 |                   | P6
                       ---------------------
  STACK             24 |        l3         | P7
                       ---------------------
Example 5: call Suba(s,l1,e,l2)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       -----+----+----------
  R1                 0 |\\\\|\\\\|s...     |  P1
                       ---------------------
  R2                 4 |         l1...     |  P2
                       ---------------------
  FP0/FP2            8 |        euu...     |  P3
                       ---------------------
                    12 |        eul...     |  P4
                       ---------------------
                    16 |        elu...     |  P5
                       ---------------------
                    20 |        ell...     |  P6
                       ---------------------
  STACK             24 |         l2        |  P7
                       ---------------------
Example 6: call Subc (s1-l1-d1,l2,f2,d2)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ----------+----------
  R1                 0 |    s1   |////|////| <--- left justified or as
                       ---------------------      dictated by struc mapping
  R2                 4 |        l1...      | P2   rules in language
                       ---------------------
  R3                 8 |        d1u...     | P3
                       ---------------------
  STACK             12 |        d1l        | P4
                       ---------------------
  STACK             16 |        l2         | P5
                       ---------------------
  STACK             20 |        f2         | P6
                       ---------------------
  STACK             24 |        d2         | P8
                       |                   |
                    38 |                   | P9
                       ---------------------
Example 7: call Subb(l1, s1, l2, d1, f1, c1,s2,s3-l3-f2)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  R1                 0 |        l1...      | P1
                       -----+----+----------
  R2                 4 |\\\\|\\\\|s1...    | P2
                       ---------------------
  R3                 8 |        l2...      | P3
                       ---------------------
  STACK             12 |        d1         | P4
                    16 |                   | P5
                       ---------------------
  STACK             20 |        f1         | P6
                       -----+----+----+-----
  STACK             24 |\\\\|\\\\|\\\\| c1 |
                       ---------------------
  STACK             28 |\\\\|\\\\|   s2    |
                       ---------------+-----
  STACK             32 |    s3   |////|////| <--- left justified or as dictated
                       ---------------------      by struct mapping rules in
  STACK             36 |        l3         | P10  language
                       --------------------|
  STACK             40 |        f2         | P11
                       ---------------------           

Note that you can not pass single precision floating point to a language like C++, which, upon call, promotes all single precision value arguments to double precision, and get it to work reliably. The first floating argument might happen to work because it is in a register.

Example 8: call Suba(f1,1,l2,f2)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  FP0                0 |        f1...      | P1
                       ---------------------
  GPR2               4 |        l1...      | P2
                       ---------------------
  GPR3               8 |        l2...      | P3
                       ---------------------
  STACK             12 |        f2         | P4
                       ---------------------

Note that C++ on 390 always performs a promote of short floating values to long floating point. Thus, in some cases, C++ on 390 will not actually work as described above.

Start of change
Example 9: call Suba(v,l)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  VR24               0 |        vuu...     | P1
                       ---------------------
                     4 |        vul...     | P2
                       ---------------------
                     8 |        vlu...     | P3
                       ---------------------
                    12 |        vll...     | P4
                       ---------------------
  STACK             16 |        l...       | P5
                       ---------------------
End of change Start of change
Example 10: call Suba(l,d,v1,v2)

                        STORAGE MAPPING OF
 WILL BE PASSED IN:    ARG AREA ON THE STACK
                       ---------------------
  R1                 0 |        l...       | P1
                       ---------------------
  FP0                4 |        du...      | P2
                       ---------------------
                     8 |        dl...      | P3
                       ---------------------
  VR24              12 |     vluu...       | P5
                       ---------------------
                    16 |     vlu1...       | P6
                       ---------------------
                    20 |     vllu...       | P7
                       ---------------------
                    24 |     vlll...       | P8
                       ---------------------
  VR25              28 |     v2uu...       | P9
                       ---------------------
                    32 |     v2u1...       | P10
                       ---------------------
                    36 |     v21u...       | P11
                       ---------------------
                    40 |     v2l1...       | P12
                       ---------------------
                 
End of change

Start of changeA vector argument is full-word-aligned and occupies 16 bytes in the argument list.End of change