<< Previous exercise (5.31) | Index | Next exercise (5.33) >>
We can use variable? to identify the optimization and then go directly to ev-variable. ev-application (save continue) (assign unev (op operands) (reg exp)) (assign exp (op operator) (reg exp)) (test (op variable?) (reg exp)) ; check if a variable (branch (label ev-appl-operator-lookup)) ; --> to lookup (save env) ; do need eval (save unev) ; so do need to save (assign continue (label ev-appl-did-operator-eval)) (goto (label eval-dispatch)) ev-appl-operator-lookup ; peform lookup (assign continue (label ev-appl-did-operator-lookup)) (goto (label ev-variable)) ev-appl-did-operator-eval ; return here if we eval'ed (restore unev) (restore env) ev-appl-did-operator-lookup ; return here if we looked up (assign argl (op empty-arglist)) (assign proc (reg val)) ...
meteorgan