# 今日の英語 - Control flow analysis in scheme その5

ルールは以下の通り。思うように進まない。文章構造を意識できていないと思う。

• トピックセンテンスは {{ }} で囲む
• シグナルワードは == ==
• パラグラフのトピックは必ず書く。
• サポート情報のスタイルを書く
• 列挙には(1)(2)(3)と振る
• 対比には (A)(a) のように目印
• 例示は何に対するサポートかを一言書き添える
• 原因・結果には => を

#### difference between closures and functions

{{What we are doing here is willfully confusing closures with
lambda expressions.}} A lambda expression is not a function;
it must be paired with an environment to produce a function.
When we speak of "calling a lambda expression l," we really
mean: "calling some function f which is a closure of lambda
expression l." An ==alternate== view is that we are reducing a
potentially infinite set of functions to a finite set by ‘folding’
together the environments of all functions constructed from the
same lambda expression. This issue will be dealt with in detail
in a later section.

4.2 Handling Primops

#### We have to handling call sites innards of primops

It can be seen from the definition of Defs that we are
flowing information about which lambdas are called from
which call sites. ==But== this is not the whole story. Not
all function calls happen at call sites. Consider the fragment
(+ a b (lambda (s) (f a s))). Where is
(lambda (s) (f a s)) called from? It is called from
the innards of the + primop; there is no corresponding call site
in the program syntax to mark this. {{We need to endow primops
with special internal call sites to mark calls to functions that
happen internal to the primop.}} Different primops have different
calling behavior with respect to their arguments: + calls its
third argument only. %if calls its second and third arguments.
Y has even more complex behavior. So we model each primop
specially.

#### internal call sites for primops

{{For each call to each primop c : (primop arg, . . . ) , we associate
a related set of internal call sites ic1, . . . , icn. for the
primop's use.}} Most normal primops, e.g. +, have a single
internal call site, which marks the call to the primop’s continuation.
%if has two internal call sites, one for the consequent
continuation, and one for the alternate continuation.
Let icj{p,c} be the jth internal call site for the primop p called
at call site c.

#### internal call site of ordinary primop

{{An ordinary primop - e.g. +, cons, aref -takes its
single continuation as its last argument}}. Any lambda which
that last argument could evaluate to, then, can be called
from the internal call site of the primop. That is, in call
c : (primop arg, . . . cont) ,

#### internal call sites of %if

{{%if is a special primop, in that it takes two continuations as
arguments, either of which can be branched to from inside the
%if. %if has two internal call sites, the ==first ==for the consequent
continuations, and the ==second=={列挙} for the alternate continuations.}}
So there are two propagation conditions for an occurence of
%if, c : ( %if pred cons ah). Any lambda the consequent
continuation can evaluate to can be called from the lirst internal
call site:
Any lambda the alternate continuation can evaluate to can be
called from the second internal call site:

#### internal call sites of Y operator

{{The propagation condition for the Y operator is more complicated.}}
The Y primop is not available to the user; it is only introduced
during CPS conversion of labels expressions. The
CPS transformation for labe Is expressions turns

(labels *1
body)

with continuation kont into:
(Y (lambda (huaskt f g c)
(c (lambda (k) body)
f-lambda
g-lambda) ) )
(lambda (bodyfun hunoz hukairz)
(bodyfun kont))

where hunoz. hukairz, and huaskt are unreferenced -
ignored dummy variables.

#### assumptions about the Y operator makes it relaxed.

{{Since Y is only introduced into the program text in a controlled
fashion, we can make particular assumptions about the
syntax of its arguments.}} ==In particular==. we can assume that
f-lambda and g-lambda are lambda expressions, and not variables.
This restriction can be relaxed with the addition of a
small amount of extra machinery.

#### Y's propagation condition

We call the functional which is Y's second argument the
fixpointerer. {{Y's propagation condition has three parts}}. For an
occurence of the Y primop:
1. Y calls the tipointer from its internal continuation call
site:
2. Y’s continuation is passed to the fixpointer as its continuation
argument:
3. Extract the args to the call to kz, i.e. the definitionsf; of
the label functions Vi, and for each lambda&:, pass M}
in as the Expointer’s ith argument:

*1:f f-lambda) (g g-lambda