At 11:11 -0500 on 07/09/2011, Tom Marchant wrote about Re: Annoyance with the IEZJSAB macro:

On Fri, 8 Jul 2011 17:39:55 -0400, Robert A. Rosenberg <hal9...@panix.com> wrote:

The fact that the contents of R14-R1 not remaining unchanged across a
macro invocation is not the issue. The issue was a USING not
remaining unchanged across the macro invocation. Since the user is
restoring R1 after the macro the expectation is that the use of the
macro should not have changed the environment. The destruction of the
USING by the macro voids this expectation.

If a macro changes, e.g., register 4 (with an appropriate save) and issues
a USING for register 4, there would be no disagreement.  In that case
PUSH USING/POP USING would be needed.

However, I am not convinced that it would be correct for a macro to
re-establish the USING for register 1 when the contents of register 1
are known to have been changed.

While I agree with your statement about R4 (and protecting any USING that references R4) since the normal registers that are subject to being used by a macro (or subroutine) are only R14-R1, that usage is about the register contents being altered NOT about USINGs pointing to the register (which must be restored due to the non-standard usage of R4 via a USING).

If the macro takes it upon itself to issue a USING on one of the 4 linkage registers [instead of just using the usual Value-DSECT(Register) displacement addressing] it should clean up after itself by using PUSH/POP to restore any existent USINGs on these 4 registers that were in effect when it was called or at least document that it will destroy not only the pre-call Register Contents (as it is allowed to do due to the designation of R14-R1 as Linkage Registers) but any pre-call USINGs that were in effect.

Just as you save the contents of other registers (as with R4 in your example) or at least document this usage, it should either document or preserve the USINGs. Changing the R14-R1 contents across a Macro Call/Use is normal - Making use of a USING is not and thus should be done within a PUSH/POP. Issuing a PUSH/POP within the Macro when none of the 4 registers were the subject of a USING at macro call time is harmless and just good programming (as others have pointed out).

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to