Next: compiler optimisation, Previous: compiler dircalls, Up: compiler [Index]
letrec
and letrec*
formsVicare’s compiler offers multiple algorithms to implement and
optimise the core language forms letrec
, letrec*
and
library-letrec*
, whose syntax is:
(letrec ((?lhs ?rhs) ...) ?body) (letrec* ((?lhs ?rhs) ...) ?body) (library-letrec* ((?lhs ?loc ?rhs) ...) ?body)
notice that the ?body is a single form. The transformations for
letrec*
and library-letrec*
are equal; the difference
between the two lies in the implementation of allocations, references
and assignments to the ?lhs.
When this compiler pass is applied to the recordised code, the forms have already been transformed into:
(recbind ((?lhs ?rhs) ...) ?body) (rec*bind ((?lhs ?rhs) ...) ?body)
where instances of the structure recbind
represent
letrec
forms and instances of the structure rec*bind
represent letrec*
and library-letrec*
forms.
After this compiler pass has been applied: recbind
and
rec*bind
structs are no more present in the returned code,
having been substituted with bind
and fix
structs.
So in the returned code: every prelex
struct represents a
binding defined either by bind
or fix
.
• compiler letrec algo: | Introduction to the algorithms. | |
• compiler letrec api: | Transformations programming interface. | |
• compiler letrec notes: | General notes on the context of
letrec optimisations.
| |
• compiler letrec basic: | The basic transformation algorithm. | |
• compiler letrec wsd: | The WSD transformation algorithm. | |
• compiler letrec scc: | The SCC transformation algorithm. |