I just want to confirm that your understanding below is also my understanding.  
I'm not sure what others think call by value is, but I don't believe it matches 
with what C means when the term "call by value" is used.  Or COBOL or PL/I, for 
that matter.
________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
Bernd Oppolzer <[email protected]>
Sent: Thursday, March 30, 2023 3:39 PM
To: [email protected] <[email protected]>
Subject: Re: ASM call by value

Am 30.03.2023 um 21:32 schrieb Paul Gilmartin:
> What code does the compiler generate when a long scalar such as
> _Decimal128 is
> passed by value?

The C compiler - at least - puts the long scalar in the reg1 list where
it uses more than 4 bytes.
"call by value" in my understanding means, that values are passed, not
addressed.
With the mainframe (or z/OS and CMS) linkage convention, this means,
that values
and not addresses are in the reg1 parameter list.

> Of course, the compiler can be guided by function prologues and rely on the 
> function
> to copy from a passed address to automatic storage.
>
> Does C use the CALL VL convention?

see above. Because the values entered into the reg1 list "by value" can
be negative integers
(or other types, which need more that 4 bytes), the VL convention cannot
be used by C callers
or C routines being called. The VL convention is not present in the more
"modern"
calling conventions like 64-bit parameter passing and XPLINK - maybe for
this reason.

The original z/OS linkage convention, honestly, restricts the parameter
passing mechanism to
call by reference. That's why it was changed - or enhanced - in the last
(20) years. In the 1960s
and 1970s, when z/OS linkage was first defined, there was only PL/1 and
Fortran (and COBOL,
of course), and they all had call by reference.

HTH, kind regards

Bernd

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to