Pristine Ack-5.5
[Ack-5.5.git] / doc / em / ispace.nr
1 .bp
2 .P1 "INSTRUCTION ADDRESS SPACE"
3 The instruction space of the EM machine contains
4 the code for procedures.
5 Tables necessary for the execution of this code, for example, procedure
6 descriptor tables, may also be present.
7 The instruction space does not change during
8 the execution of a program, so that it may be
9 protected.
10 No further restrictions to the instruction address space are
11 necessary for the abstract and assembly language level.
12 .PP
13 Each procedure has a single entry point: the first instruction.
14 A special type of pointer identifies a procedure.
15 Pointers into the instruction
16 address space have the same size as pointers into data space and
17 can, for example, contain the address of the first instruction
18 or an index in a procedure descriptor table.
19 .QQ
20 There is a single EM program counter, PC, pointing
21 to the next instruction to be executed.
22 The procedure pointed to by PC is
23 called the 'current' procedure.
24 A procedure may call another procedure using the CAL or CAI
25 instruction.
26 The calling procedure remains 'active' and is resumed whenever the called
27 procedure returns.
28 Note that a procedure has several 'active' invocations when
29 called recursively.
30 .PP
31 Each procedure must return properly.
32 It is not allowed to fall through to the
33 code of the next procedure.
34 There are several ways to exit from a procedure:
35 .IP -
36 the RET instruction, which returns to the
37 calling procedure.
38 .IP -
39 the RTT instruction, which exits a trap handling routine and resumes
40 the trapping instruction (see next chapter).
41 .IP -
42 the GTO instruction, which is used for non-local goto's.
43 It can remove several frames from the stack and transfer
44 control to an active procedure.
45 (see also MES~11 in paragraph 11.1.4.4)
46 .PP
47 All branch instructions can transfer control
48 to any label within the same procedure.
49 Branch instructions can never jump out of a procedure.
50 .PP
51 Several language implementations use a so called procedure
52 instance identifier, a combination of a procedure identifier and
53 the LB of a stack frame, also called static link.
54 .PP
55 The program text for each procedure, as well as any tables,
56 are fragments and can be allocated anywhere
57 in the instruction address space.