User guide
9.1. DESIGNING FOR COMPACTNESS 157
Operation
Executions Static count
Loading a local var ia b l e 3777408 1479
Updating a local variable
1965885 1098
Loading a global variable
5041968 1759
Updating a global variable
796761 363
Using a positive constant
4083433 1603
Using a negative constant
160224 93
Conditional jumps (all)
2013013 488
Conditional jumps on zero
494282 267
Unconditional direct jump
254448 140
Unconditional indirect jumps
152646 93
Procedure calls
1324206 1065
Procedure returns
1324204 381
Binary chop switches
43748 12
Label vector switches
96461 17
Addition
2135696 574
Subtraction
254935 111
Other expression operations
596882 74
Loading a vector element
1356315 429
Updating a vector element
591268 137
Loading a byte vector element
476688 53
Updating a byte vector element
405808 29
Table 9.1: Counts from the BCPL self com p i la t io n test
pointer and, as one would expect, small numbered locals are used far more frequently
than the others, so operations on low numbered l ocals often have single byte codes.
Although not shown here, other statistics, such as the distribution of rel at i ve ad-
dressing offsets and operand values, influenced the design of Cintcode.
9.1.1 Global Variables
Global variables are referenced as frequently as locals and therefore have many function
codes to handl e them. The size of the global vector in most programs is less than 512,
but Cintcode allows this to be as large are 65536 words. Each operation that refer s to a
global var i abl e is provided with three related instructi ons. For instance, the instructions
to load a global into register A are as follows: