annotate lab4/mach.ml @ 1:b5139af1a420 tip basis

Fixed permissions on compile scripts
author Mike Spivey <mike@cs.ox.ac.uk>
date Fri, 13 Oct 2017 17:27:58 +0100
parents bfdcc3820b32
children
rev   line source
0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
1 (* lab4/mach.ml *)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
2 (* Copyright (c) 2017 J. M. Spivey *)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
3
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
4 (* |metrics| -- target representation of data object *)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
5 type metrics =
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
6 { r_size: int; (* Size of object *)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
7 r_align: int } (* Address must be multiple of this *)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
8
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
9 let int_rep = { r_size = 4; r_align = 4 }
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
10 let char_rep = { r_size = 1; r_align = 1 }
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
11 let bool_rep = { r_size = 1; r_align = 1 }
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
12 let void_rep = { r_size = 0; r_align = 1 }
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
13 let addr_rep = { r_size = 4; r_align = 4 }
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
14 let proc_rep = { r_size = 8; r_align = 4 }
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
15 let param_rep = { r_size = 4; r_align = 4 }
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
16 let max_align = 4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
17
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
18 (*
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
19 Frame layout:
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
20
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
21 arg n \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
22 ... > Stored by caller
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
23 arg 4 /
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
24 arg 3 \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
25 > Saved by prolog
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
26 +40 arg 0 /
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
27 ----------------
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
28 +36 return address
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
29 +32 saved sp
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
30 +28 dynamic link
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
31 +24 static link
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
32 +20 saved r9
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
33 ...
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
34 +4 saved r5
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
35 fp: saved r4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
36 ----------------
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
37 -4 local 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
38 ...
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
39 local m
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
40 ----------------
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
41 outgoing arg a
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
42 ...
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
43 +4 outgoing arg 5
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
44 sp: outgoing arg 4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
45 *)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
46
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
47 let param_base = 40
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
48 let local_base = 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
49 let stat_link = 24
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
50 let nregvars = 3
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
51 let share_globals = true
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
52
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
53 let comment = "@ "