MZLINK and MZLINT may trigger garbage collection.
A link area is a vector of links outside any dynamic store,
with all its links pointing to one particular store,
consisting of NS
structural links followed by
NR
reference links.
Either NS
or NR
may be zero.
We distinguish two kinds of link areas:
A permanent link area is initialized once at the steering level and stays alive for the whole program; it consists of just the vector of links.
A temporary link area is requested and de-activated by lower-level code any number of times. Each such area has two words pre-fixed to the link-vector for efficiency:
A link area must be in COMMON storage; if it is in local storage there is a danger that Fortran optimization causes a register to preserve the old value of a link across a relocation operation, for garbage collection, but also for simple updating with MZDROP, ZSHUNT, etc.
As for links in banks, a structural link may only contain zero or the valid address of a bank; it must never contain garbage.
To initialize a permanent link area, one calls once, and once only for this area:
CALL MZLINK (IXSTOR,chNAME,!LAREA,!LREF,!LREFL)
with
IXSTOR index of the store into which the links will point, (IXDIV of any division in this store allowed) zero for the primary store chNAME name of the Fortran Common in which the link area resides, for printing purposes, 8 characters maximum !LAREA first word of the link area, being also the first link of this area !LREF first reference link, if any; last structural link, if no reference links !LREFL last reference link, if any, if none: give LAREA in this parameter position
MZLINK will clear the links to zero.
Examples:
mixed link area: COMMON /LAMIX/ LS1,...,LSN, LR1,...,LRN CALL MZLINK (0,'/LAMIX/',LS1,LR1,LRN) structural link area: COMMON /LASTR/ LS1, ..., LSN CALL MZLINK (0,'/LASTR/',LS1,LSN,LS1) reference link area: COMMON /LAREF/ LR1, ..., LRN CALL MZLINK (0,'/LAREF/',LR1,LR1,LRN)
Note that in a permanent link area with exactly one link this link cannot be a reference link.
MZLINK prints at log level zero (or above) an initialization
message on unit IQLOG
.
To activate a temporary link area, one calls with:
CALL MZLINT (IXSTOR,chNAME,LAREA,!LREF,!LREFL)
with
IXSTOR index of the store, as for MZLINK chNAME name of the link area, as for MZLINK LAREA first word of the link area, with: LAREA(1) the user flag word LAREA(2) system word LAREA(3) the first link of the area !LREF first reference link, if any, as for MZLINK !LREFL last reference link, if any, as for MZLINK
MZLINT will clear the links to zero,
set the flag-word LAREA(1)
to be non-zero,
and set the system-word LAREA(2)
on first contact.
To de-activate a temporary link-area the user sets LAREA(1)=0
.
From then on the links in this area are no longer relocated,
and hence will be meaningless.
To re-activate the area the user could set LAREA(1)=1
,
but he must then clear the contents of the links himself;
it is safer to call MZLINT, which will do the necessary.
Examples:
mixed link area: COMMON /LAMIX/ LAMIX(2), LS1,...,LSN, LR1,...,LRN CALL MZLINT (0,'/LAMIX/',LAMIX,LR1,LRN) structural link area: COMMON /LASTR/ LASTR(2), LS1, ..., LSN CALL MZLINT (0,'/LASTR/',LASTR,LSN,LASTR) reference link area: COMMON /LAREF/ LAREF(2), LR1, ..., LRN CALL MZLINT (0,'/LAREF/',LAREF,LR1,LRN)
MZLINT prints a log message at level 1 for initialization and at level 2 for re-initialization.