|
@@ -3057,6 +3057,26 @@ the element at index $0$ of the 1-tuple.
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
+% reveal-functions
|
|
|
+% * differentiate variables and function names
|
|
|
+% * differentiate primitive operations and function application
|
|
|
+% flatten
|
|
|
+% * function-ref not simple, why? have to use the leaq instruction
|
|
|
+% to put the function label in to a register.
|
|
|
+% select-instructions
|
|
|
+% * (assign lhs (function-ref f)) => (leaq (function-ref f) lhs)
|
|
|
+% * (assign lhs (app f es ...))
|
|
|
+% - pass some args in registers, rest on the stack (stack-arg)
|
|
|
+% - need to keep track of how large the stack needs to grow across
|
|
|
+% all the function calls in the body of a function
|
|
|
+% - indirect-callq f; movq rax lhs
|
|
|
+%
|
|
|
+% uncover-live
|
|
|
+% * free-vars: function-ref, stack-arg
|
|
|
+% * read-vars: leaq, indirect-callq
|
|
|
+% * write-vars: leaq, indirect-callq (all caller save!)
|
|
|
+% * uncover-live: treat functions like the main program.
|
|
|
+
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
\chapter{Lexically Scoped Functions}
|
|
|
\label{ch:lambdas}
|