Action
Function Header
=O,Count Header
=
A,Count
ADDTO LIST Store the first word of the header into
(the incoming location A. store the address A into the
element is at first word of the header. Decrement the
location A) second word of the header by one.
DELETEFROM The list is empty. Set the first word of the
LIST header to the value of
the contents of location
A. Use element A.
The following routines
code to perform the
manipulation described
chart.
allow enabled
free-pool-list
in the above
ADDTO FREE LIST Routine:
Initial Conditions:
GR2 contains the address of the element
to be added.
GR4 contains the address of the header.
ADDQ LM0,1,0(4) GRO,GRI = contents
of the headerTRYAGN ST 0,0(2) Point the new ele-
ment to the top
of the list
LR 3,1 Move the count to
GR3
BCTR3,0 Decrement the count
CDS0,2,0(4) Update the header
BC7,TRYAGN DELETE FROM FREE LIST Routine:
Initial conditions:
GR4 contains the address of the header.
DELETQ LM2,3,0(4) GR2,GR3 = con-
tents of the
headerTRYAGN LTR 2,2 Is the list
empty?
BC8,EMPTY Yes, get help
L0,0(2) No, GRO = the
pointer from
the first
element
LR 1,3 Move the count
to GRICDS 2,0,0(4) Update the
header
BC7,TRYAGN USE [Any instruction] The address of
the removed
element is in
GR2
Note that the LM(LOAD MULTIPLE) instructions at locations ADDQ and
DELETQ would have to be CDS (COMPAREDOUBLE AND SWAP) instructions if it were
not for the rule concerning storage
operand consistency. This rule requires
theLOAD MULTIPLE instructions to fetch
an eight-byte operand aligned on a
doubleword boundary such that, if anoth
erCPU changes the doubleword being
fetched by an operation which is also at
least doubleword-consistent, either the
entire new or the entire old value of
the doubleword is obtained, and not a
combination of the two. (See the
section "Storage-Operand Consistency" in
Chapter5, "Program Execution.")
Appendix A. Number Representation and Instruction-Use Examples A-47
Function Header
=
=
A,Count
ADD
(the incoming location A. store the address A into the
element is at first word of the header. Decrement the
location A) second word of the header by one.
DELETE
LIST header to the value of
the contents of location
A. Use element A.
The following routines
code to perform the
manipulation described
chart.
allow enabled
free-pool-list
in the above
ADD
Initial Conditions:
GR2 contains the address of the element
to be added.
GR4 contains the address of the header.
ADDQ LM
of the header
ment to the top
of the list
LR 3,1 Move the count to
GR3
BCTR
CDS
BC
Initial conditions:
GR4 contains the address of the header.
DELETQ LM
tents of the
header
empty?
BC
L
pointer from
the first
element
LR 1,3 Move the count
to GRI
header
BC
the removed
element is in
GR2
Note that the LM
DELETQ would have to be CDS (COMPARE
not for the rule concerning storage
operand consistency. This rule requires
the
an eight-byte operand aligned on a
doubleword boundary such that, if anoth
er
fetched by an operation which is also at
least doubleword-consistent, either the
entire new or the entire old value of
the doubleword is obtained, and not a
combination of the two. (See the
section "Storage-Operand Consistency" in
Chapter
Appendix A. Number Representation and Instruction-Use Examples A-47