This page needs to be proofread.
40
name1: JUMP-IF-NIL reg1, name1a
RETURN ;return the value in reg2
name1a: GOTO name2
name2: <code for b> ;result in reg1
LOAD regZ,[name4] ;[name4] is the closure for name4
GOTO name3
name3: JUMP-IF-NIL reg1,name3a
RETURN ;return the value in reg1
name3a: GOTO name4
name4: <code for c> ;result in reg1
LOAD reg2,[name6] ;[name6] is the closure for name6
GOTO name5
name5: JUMP-IF-NIL reg1,name5a
RETURN ;return the value in reg1
name5a: GOTO name6
name6: LOAD reg1,'NIL ;constant NIL in reg1
RETURN
The construction [foo] indicates the creation of a closure for foo in the current environment. This will actually require additional instructions, but we shall ignore the mechanics of this for now since analysis will remove the need for the construction in this case. The fact that the only references to the variables Rl, RZ, and R3 are function calls can be detected and the unnecessary LOAD instructions eliminated. (Once again, this would actually be determined ahead of time, and no LOAD instructions would be generated in the first place. All of this is determined by a general pre-analysis, rather than a peephole post-pass.) Moreover, a GOTO to a tag which immediately follows the GOTO can be eliminated.