On May 27, 2012, at 00:08, Jon Perryman wrote:
> A literal in the literal pool should never be modified and the assembler is
> enforcing that rule where possible. The problem is that multiple =C'WOMBAT' in
> your program would only generate a single entry in the literal pool. Can
> each occurrence handle this modification of the value? The assembler is just
> stopping a bad coding practice and potential problems where possible.
>
Thanks. I had been unaware that the assembler enforced that
quite reasonable rule -- I had never tried storing into the
literal pool. But this was a test to see how well the assembler
evaluates length attributes. And I was aware of the warnings
of RENT violations, so I did this assembly NORENT. With the
code modified, I get (Isn't this about as bad a coding practice
as storing into the literal pool?):
Loc Object Code Addr1 Addr2 Stmt Source Statement
1 MACRO
2 &L SS2 &OP,&A1,&A2
3 &L &OP &A1.(L'&A2),&A2
4 MEND
5 *
6 PRINT GEN
000000 00000 00021 7 FUNCS CSECT
R:C 00000 8 USING FUNCS,12
9 MACCLC SS2 CLC,=C'WOMBAT',=C'FOO'
000000 D502 C018 C01E 00018 0001E 10+MACCLC CLC =C'WOMBAT'(L'=C'FOO'),=C'
11 * ---------------
12 MACMVC SS2 MVC,TARGET,=C'FOO'
000006 D202 C00C C01E 0000C 0001E 13+MACMVC MVC TARGET(L'=C'FOO'),=C'FOO'
14 *
00000C E6D6D4C2C1E3 15 TARGET DC C'WOMBAT'
16 END
000018 E6D6D4C2C1E3 17 =C'WOMBAT'
00001E C6D6D6 18 =C'FOO'
On May 27, 2012, at 00:18, Jon Perryman wrote:
> I think that John is asking for an example where the existing BIF's do not
> satisfy your situation and what length would expect it to return.
>
Largely, I was puzzled by the complexity of John's solution:
Macro
&Lab MVC2 &Target,&Source
&Lab CLC 0(0,0),&Source X'D500 0000',S(&Source)
Org *-6 Back up to first byte of instruction
LA 0,&Target.(0) X'4100',S(&Target),S(&Source)
Org *-4 Back up to first byte of instruction
DC AL1(X'D2',L'&Source-1) First 2 bytes of instruction
Org *+4 Step to next instruction
... What's accomplished by overwriting the instruction 3 times,
and using a hex opcode? (And I believe this would allow modifying
the literal pool which we agree is a Bad Thing. Safer to use ST
in place of the LA.)
AIF (L'&Target ge L'&Source).Done
MNote *,'MVC2: Length of ''&Source'' greater than length of ''&*
Target''.'
.Done MEnd
The check on target length could still be performed after simply the:
&Lab MVC &Target.(L'&Source),&Source
(Is explicitly specifying index register 0, as on the LA considered
good coding practice? It seems superfluous.)
Thanks,
gil