Annonce
Annonce
Data Structures in Digitek's FORTRAN IV DMI
Compiler for the SDS 900 Series
Robert W. Floyd
The FORTRAN IV compiler for the SDS 910=920»930=940 uses a set of data
structure conventions together with interpretive operations for some of the
data manipulations. According to the conventions, there are a fixed set of
25 lists numbered 0 » 24. They serve various purposes: one is a symbol table
for fixed point scaler identifiers, others for floating, array, and dummy varie
able identifiers, One holds the stack of exits for recursive calls. One holds
generated pieces of machine code awaiting tearrangement. One, the work list,
plays a special role as a push-down accumulator,
Each list occupies a contiguous block of storage, (See Figurel)
Stacked
tables
START, _—_— ee Y
Empty
Top, iaa |
| Current
BOTTOM, mm Lo Jable
~~ Empty
BASE, he À
Figure 1
The list is a push.down list of tables, each of which can be used both as a last.
in-first-out and as a firstein-first-out stack, For the list aumbered L, there
are four pointers to its block of storage.
(1) BASE, points to the word before the list. Thus the ¡Eh word
of the list is in location BASE + Lo
(2)
(3)
(5)
START, points to the last word of the pushed-dow tables,
the word before the region available to the current table.
TOP
L points to the word before the current table.
BOTTOM, points to the last word of the current table,
BASE, +1
the region allocated to the next list. We must therefore
always have BASE, < START, < ТОР, < BOTTOM, < BASE, y.
serves as a limit on List, . It is the word before
We now describe some of those interpretive operations (POPs; programmed
operators) which use only the current table of a list. We use M as the effece
tive memory address of an instruction, after indirect addressing and indexing,
and m or [M] as the contents of that address. We shall designate the work list
by W.
(2)
(3)
(4)
(5)
(6)
FET M (Fetch a). BOTTOM, « BOTTOM, + 1, [BOTTOM ] em.
This stacks m on the bottom of the work list.
ADR M (Address М). Stack Mon the bottom of the work list.
SOB M (Save on bottom of M). Stack the contents of the harde
ware accumslator on the bottom of Listy.
MON M (Move onto M). Unstack the bottom word of the work list
and stack it as the bottom word of List.
MOF M (Move off M). Unstack the bottom word of List, and
stack it on the bottom of the work list,
CLA* BOTTOM + L (A hardware instruction). Bring to the hard=
ware accumulator the word from the bottom of List. The aster-
isk signifies indirect addressing,
(7) TOT M (Take off top of M). Unstack the top word of the cur-
rent table of Liste and save it on the bottom of the work
list. TOP, «TOP, + i; BOTTOM e- BOTTOM + 1; [BOTTOM] TOP, ].
(8) SKR BOTTOM + L (4 hardware instruction). Unstack the bottom
word of List,. BOTTOM « BOTTOM, - 1.
(9) MIN TOP + L (/ hardware instruction). Unstack the top word
of the curreiit table of List, . TOP, « TOP + 1.
(10) LCFM (Load Central from M). Load words CTL] and CTL2 with
the two words from the top of the current table of List.
(11) LCOM' (Load Ceitral off M). Same as LCF, except that the
to vords are :nstacked from Listy.
(12) MCOM (Move Central onto M). Stack the two words CTL!
and CTL2 on the bottom of List.
Observe that words ee added to a list at the bottom, but may be taken off
at the bottom (lasteinefirsteout; a stack) or the top (firsteinefirsteout; a
Cueue). All operations ‘hich add words to a list use the SOB operation, which
checks whether the allocated space is full (BOTTOM, = BASE 417» and if so calis
on a storage allocator to move the lists and change the pointers.
It is possible to create a new current table T, on a list without harm to
the previous current table То» which will again become the current table when
I, is released. This Is done by means of two operations:
(1) RSV M (Reserve M). Stack START, = BASE, and TOP. BASE, on the
current table of Listy, then START +-BOTTOM TOP e BOTTOM,
creating a new(empty)current table on List.
Thus if the previous appearance of List, was as shown
in Figure 2
reel
ortl 1
| Stacked
tables
: B+1
Empty
TOR, —— ] ети
у+! Current
| tabl
BOTTOM == » 6 ce
6+1
Figure 2
we would now have the situation shown in Figure 3.
ee. TH
Stacked
tables
B |
p+l To
Empty
у :
+ |
5 x
a 6 | : 9
5+1 | Bou
START, —0 vou
TOP Е
poro, | |
|
Figure 3
After several uses o£ SOB,, and TOT
which move the entire list without changing its contents, we
might have, where r is a relocation constant, the situation
of Figure 4.
and possible
M, a memory reallocations
BASE, —————d "y
ore |
Stacked ;
tables
48
+1
Empty
rHy+l |
%
{ Empty |
TOP, — 3
| № т
Fig ure 4
(2) RLS M (Release M) .
BOTTOM, <- START = 2,
TOP, [START] + BASE,» ~
START, « [START = 1}-+ BASE.
We now have BOTTOM, = r +8,
TOP к + y, START, = x+B;
BASE, = т +, so that the original status of the list with To
as the current table has been restored.
Because lists are constantly subject to relocation, it is not useful to
save absolute addresses of words stored on lists. Instead, one stores a pointer;
a word one of :whose fields is the number of the list, tie other being the loca=
tion of the word relative to the base of the list.
BOP M (Bottom pointer of M) saves on the work list a pointer to the
bottom word on list M,
CNT M (Count M) saves on the work list the size of the current table
on Liat.
SAL M (Save a list M) saves on the save list START, - BASE, ,
TOP, - BASE, and BOTTOM, - BASE,.
REC M (Recover M) is inverse to SAL, and restores START, ТОР, and
BOTTOM, to their earlier values,
| of item
Each list has a atandard “ire (one to five vords), stored on it, For example,
a list of floating point constants might have two as its standard item length,
In addition, lists such as symbol tables have items which begin with a one or
two=word key, the symbol itself, followed by other informatiom.
SER M (Search M), Search the list M for an item which has key equal
to CIL2, or equal to the two-word pair (CTL1, CTL2), depending on what
the key=length of M is. Save on the work list the pointer to the
matching item,
Control Structures
The program is organized as a set of recursive subroutinea, Exits are saved
on one of the lists, the exit list, The programmed operators are implemented
by recursive subroutines so that they can use themselves and each other, Apart
from those subroutines accessed by the programmed operators, a recursive sub.
routine may be reached by
JES M (Jump to recursive subroutine M).
At each level of subroutine estiry an answer bit is kept, and used to
record the results of tests.
JAT M (Jump, if answer is true, to M)
JAF M (Jump, 1f answer ís false, to M)
Many of the operators described earlier set the answer true or false. For example,
the programmed operators which remove items from lists set the answer false if the
source list is empty. The search instruction sets the answer false if no match
is found, We also have:
CSA M (Character scan or alternative).
If the next imput character equals m, scan over it and set the answer
true; otherwise do not scan, set the answer false.
SNE. M (Set non-empty). Set the answer true if the current table of
List, is nonsempty, othervise false.
SCC M (Sat on character). Set the ensuar true if the next input
character has, in ita entry in a certe.n table, a flag bit set in the
same position as the bit set in М. This instruction can be used, for
example, to ask "Is the next chara-ter za alphanumeric?”.
SOF M (Set on flag M). Same as SOC, but testing the bottom word on
the work list, rather than the ner: input character.
SOL M (Set out of limit), Set tha answer true if ihe absolute value
of the double precision hardwars accumulator is not g-ester than the
double precision limit M,
In order to do backtracking, there are the followings
TRY M. Enter the recursive subroutine M. If it is left normally,
by a transfer to EXIT, control returns to the instruction following
the TRY with the answer set to TRUE, If an exit occurs by a trans-
fer to FAIL, control returns with the answer set to FALSE, and with
the list pointers reset to their values at the time TRY was executed.
FEX M (Fail exit M). After execution of this instruction, a transfer
to FAIL will cause control to go to M, with lists restored to their
state uhen TEL was executed,
CSF M (Character scan or fail), If the next input character is M, scan
it; otherwise go to FAIL,
QSF M (Quote scan or fail). Scan on the input string the string
stored at M, or go to FAIL.
">
/
Download
Bare en venlig påmindelse. Du kan se dokumentet lige her. Men vigtigst af alt har vores AI allerede læst det. Den kan forklare komplekse ting i enkle vendinger, besvare dine spørgsmål på ethvert sprog og hjælpe dig med hurtigt at navigere selv de længste eller mest komplicerede dokumenter.
Annonce