WellFounded Touch

Optimization for Futures

Cormac Flanagan

Matthias Fel leisen

Rice COMP TR

Octob er

Department of Computer Science

Rice University

PO Box Houston TX

c

Copyright by

Cormac Flanagan and

WellFounded Touch Optimization for Futures

Cormac Flanagan Matthias Felleisen

Department of Computer Science

Rice University

Houston TX

Abstract

The future annotations of MultiLisp provide a simple metho d for taming the implicit par

allelism of functional programs but require touch op erations within all placeholderstrict prim

itives to ensure prop er synchronization b etween threads These touch op erations contribute

substantially to program execution times We use an op erational semantics of future devel

op ed in a previous pap er to derive a program analysis algorithm and an optimization algorithm

based on the analysis that removes provablyredundant touch op erationsExp eriments with the

Gambit indicate that this optimization substantially reduces program execution times

Supp orted in part by NSF grant CCR and a sabbatical at Carnegie Mellon University

Contents

Futures Touches and Transparency

Review The Language and Its Parallel Semantics

Touch Optimization

Nontouching Primitives

The Touch Optimization Algorithm

SetBased Analysis for Futures

Deriving Set Constraints for Program Variables

Soundness of the Set Constraints

From Set Constraints to SetBased Analysis

Solving the Set Constraints

Exp erimental Results

Related Work

Conclusion

A Correctness Pro of for Abstract Representation

B Set Based Analysis Algorithm

Novemb er DRAFT

Futures Touches and Transparency

Programs in functional languages oer numerous opp ortunities for executing program comp onents

in parallel In a callbyvalue language for example the evaluation of every function application

could spawn a parallel thread for each argument expression However if such a strategy were applied

indiscriminately the execution of a program would generate far to o many parallel threads The

overhead of managing these threads would clearly outweigh any b enets from parallel execution

The future annotations of MultiLisp and its Scheme successors provide a simple metho d

for taming the implicit parallelism of functional programs If a programmer b elieves that the par

allel evaluation of some expression outweighs the overhead of creating a separate task he may

annotate the expression with the keyword future An annotated functional program has the same

observable b ehavior as the original program but the runtime system maycho ose to evaluate the

future expression in parallel to the rest of the program If it do es the evaluation will pro ceed as

if the annotated expression had immediately returned Instead of a prop er value though it returns

a placeholder which contains enough information for retrieving the actual result of the annotated

expression when needed When a program op eration requires sp ecic knowledge ab out the value

of some sub computation but nds a placeholder the runtime system p erforms a touch op era

tion whichsynchronizes the appropriate parallel threads and eventually retrieves the necessary

information

The standard way of implementing touch op erations on placeholders requires a mo dication

of all program op erations that need to know sp ecic asp ects of values For example pro cedure

application must know that the value of the rst subexpression is a pro cedure an ifexpression

demands a prop er value in the test p osition not only a placeholder and addition can only add

its inputs if they are numb ers Hence these op erations must b e mo died so that they rst check

whether the appropriate arguments are placeholders or prop er values and must p ossibly p erform

some synchronization

Past researchonfutures has concentrated on the ecient implementation of the underlying task

creation and on the extension of the concept to higherorder control constructs

Little eort has gone into the development of a semantic characterization of the idea or the

use of such a semantic framework for the optimization of task creation or co ordination In contrast

the driving force b ehind our eort is the desire to develop semantically wellfounded optimizations

for the execution of futures The sp ecic example wecho ose to consider is the developmentofan

algorithm that safely eliminates as many touch op erations as p ossible Other optimizations will b e

the sub ject of future eorts

In a previous pap er we develop ed a series of semantics for an idealized functional language

with future The last semantics is particularly suited to the develelopment of analysis and opti

mization algorithms since it exp oses appropriate details regarding program executions Wenow use

that semantics to derive a program analysis algorithm and a provablycorrect touch optimization

algorithm based on the analysis An implementation of the optimization on the Gambit Scheme

compiler pro duced signicant sp eedups on a standard set of b enchmarks We b elieve that this

development can b e extended to larger languages and other implementation techniques

The presentation of our results pro ceeds as follows The second section intro duces a sim

ple functional language with futures and recalls the lowlevel parallel abstract machine for the

language The third section discusses the cost of touch op erations and presents a provably cor

rect algorithm for eliminating unnecessary touch op erations The latter is based on the setbased

analysis algorithm of the fourth section The fth section describ es the implementation of these

algorithms on the Gambit compiler and compares the mo died compiler to the original compiler

on a standard set of b enchmarks The sixth section discusses related work

Novemb er DRAFT

Review The Language and Its Parallel Semantics

Given the goal of developing a semantics that is useful for proving the soundness of optimizations

we develop the denitional semantics for futures for an intermediate representation of an idealized

functional language Sp ecicallywe use the subset of Anormal forms of an extended calcu

luslike language that includes conditionals and a future construct see Figure

M x Terms

a

j let xV M

j let x future M M

j let x car y M

j let x cdr y M

j let x if yM M M

j let x apply yz M

V Value c j x j x M j xy Values

x Vars fxyzg Variables

Const ftrue false g Constants c

Figure The Anormalized Language

a

In a previous pap er we develop ed a series of abstract machines each sp ecifying the semantics

of futures at a dierent level of abstraction The last of these machines called the P CEK

machine is particularly suited to the development of program analyses since contains explicit

binding information relating program variables to their values The machine is also suited to the

developmentofatouch optimization algorithm since it exp oses the use of explicit placeholder

ob jects and p erforms touch op erations on these ob jects We use this machine dened in Figures

and as the basis for the development of this pap er

Notation We use the following notations throughout the pap er P denotes the p owerset con

structor f A B denotes that f is a total function from A to B f A B denotes that f

p

is a partial function from A to B M P denotes that the term M o ccurs in the program P and

har x M E i refers to either a normal activation record har x M E i or a tagged activation record

har y x M E i

Touch Optimization

The P CEKmachine p erforms touch op erations on arguments in placeholderstrict p ositions of all rst

mention of

program op erations These implicit touch op erations guarantee the transparency of placeholders

phstrict

whichmakes futurebased parallelism so convenient to use Unfortunately these compilerinserted

touch op erations imp ose a signicantoverhead on the execution of annotated programs For ex

ample an annotated doublyrecursiveversion of b p erforms million touch op erations during

the computation of b

Due to the dynamic typing of Scheme the cost of each touch op eration dep ends on the program

op eration that invoked it If a program op eration already p erforms a typ e dispatch to ensure that

Novemb er DRAFT

Evaluator

eval Answers ferror g

pcek

a

unload E x if hP i hx E i

pcek 

pcek





error if hP i error

pcek

eval P

pcek

if i N S State n m N such that



i pcek i i





n m

i i

m S hP i and S S

i i i

pcek

Data Sp ecications

S State hM E K ij errorflet pS S States

pcek

M Anf Language

a

E Env Vars Value Environments

pcek p pcek

V Value PValue j PhObj RunTime Values

pcek pcek

pcek

W PValue c j x j Cl j Pair Prop er Values

pcek pcek pcek

Cl hx M Ei Closures

pcek

Pair cons VV Pairs

pcek

PhObj hph p ijhph pVi Placeholder Values

pcek

K Cont jhar x M E iK jhar y x M E iK Continuations

pcek

F FinalState hx E ij error Final States

pcek

A Answers c j procedure j cons AA Answers

Auxiliary Functions

touch Value PValue fg

unload Value Answers

pcek pcek pcek

pcek

pcek

touch hph p i

unload c c

pcek

pcek

touch hph pVi touch V

unload hx M Ei procedure

pcek pcek

pcek

touch W W

unload cons V V cons V V

pcek

pcek  

 

where V unload V

pcek i

i

unload hph pVi unload V

pcek pcek

Placeholder Substitution S p V

pVi M p V M with all o ccurrences of hph p i up dated to hph



flet p S p V S if p p

 

flet p S S p V

 

flet p S p V S p V if p p

 

Figure The P CEKmachine Evaluator and Data Sp ecications

its arguments have the appropriate typ e eg car cdr apply etc then a touch op eration is free

Put dierently an implementation of car x in pseudoco de is

if pair x uncheckedcar x

error car Not a pair

Extending the semantics of car to p erform a touch op eration on placeholders is simple

if pair x uncheckedcar x

let y touch x if pair y uncheckedcar y error car Not a pair

The touch ing version of car incurs an additional overhead only in the error case or when x is a

placeholder For the interesting case when x is a pair no overhead is incurred Since the vast

Novemb er DRAFT

Transition Rules



hlet xc M EKi hM Ex cKi bindconst

pcek



hlet xy M EKi hM Ex E y Ki bindvar

pcek



hlet x y N M EKi hM Ex hy N EiKi bindlam

pcek



cons yz M EKi hM Ex cons E y E z Ki bindcons hlet x

pcek



hx E har y M E iK i hM E y E xKi return

pcek



hlet x car y M EKi

pcek



hM Ex V Ki if touch E y cons V V

 pcek  

car

error if touch E y Pair fg

pcek pcek



analogous to car cdr hlet x cdr y M EKi

pcek



hlet x if yM M M EKi

 

pcek



hM Ehar x M E iK i if touch E y ffalse g

 pcek

if

ar x M E iK i if touch E y false hM Eh

pcek 



hlet x apply yz M EKi

pcek



hN E x E z har x M E iK i if touch E y hx NE i

pcek

apply

error if touch E y Cl fg

pcek pcek



hlet x future N M EKi hN E har y x M E iK i future

pcek



hx E har y y M E iK i hM E y E xKi futureid

pcek



hM E K har y x N E iK i

 

pcek

FPK fork flet p hM E K i hN E x hph p iK i p FPE

  



flet p hx E i S S p E x join

pcek



flet p error S error joinerror

pcek



flet p flet p S S S flet p S flet p S S lift

         

pcek

FPS p

 

acb

flet pS S flet pS S paral lel

 

 

pcek

ab cd

if S S S



 

pcek pcek

S reexive S

pcek

acbd

S S transitive

pcek

ab cd

if S S S S a c

pcek pcek

Figure The P CEKmachine Transition Rules

Novemb er DRAFT

ma jorityofScheme op erations already p erform a typ edispatch on their arguments the overhead

of p erforming implicit touch op erations app ears to b e acceptable at rst glance

Unfortunately a standard technique for increasing execution sp eed in Scheme systems is to dis

able typ echecking typically based on informal correctness arguments or based on typ e veriers for

the underlying sequential language When typ echecking is disabled most program op erations

do not p erform a typ edispatch on their arguments Under these circumstances the source co de

car x translates to the pseudoco de

uncheckedcar x

Extending the semantics of car to p erform a touch op eration on placeholders is now quite exp ensive

since it then p erforms an additional checkonevery invo cation

if placeholder x uncheckedcar touch x uncheckedcar x

Performing these placeholder checks can add a signicantoverhead to the execution time Kranz

and Feeley estimated this cost at nearly of the sequential execution time and our ex

p eriments conrm these results see b elow

The classical solution for avoiding this o verhead is to provide a compiler switch that disables

the automatic insertion of touch es and a touch primitive so that programmers can insert touch

op erations explicitly where needed We b elieve that this solution is awed for several

reasons First it clearly destroys the transparentcharacter of future annotations Instead of an

annotation that only aects executions on some machines future is now a task creation construct

and touch is a synchronization to ol Second to use this solution safely the programmer must know

where placeholders can app ear instead of regular values and must add touch op erations at these

places in the program In contrast to the addition of future annotations the placementoftouch

op erations is far more dicult while the former requires a prediction concerning computational

intensity the latter demands a full understanding of the data ow prop erties of the program Since

we b elieve that an accurate prediction of data owby the programmer is only p ossible for small

programs we reject this traditional solution

A b etter approach than explicit touch es is for the compiler to use information provided by

a dataow analysis of the program to remove unnecessary touch es wherever p ossible This ap

proach substantially reduces the overhead of touch op erations without sacricing the simplicityor

transparency of future annotations

Nontouching Primitives

The current language do es not provide primitives that do not touch arguments in placeholderstrict

erify an algorithm that replaces touch ing primitives bynontouch ing p ositions To express and v

primitives we extend the language with nontouching forms of the placeholderstrict primitive

a

cdr if and apply resp ectively op erations denoted car

M

j let x car y M

y M j let x cdr

j let x if yM M M

j let x apply yz M

Two notable exceptions are ifwhich do es not p erform a typ edispatchonthevalue of the test expression and the

equality predicate eq whichistypically implemented as a p ointer comparison

Novemb er DRAFT

As their name indicates a nontouching op eration b ehaves in the same manner as the original

version as long as its argument in the placeholderstrict p osition is not a placeholder If the

argument is a placeholder the b ehavior of the nontouch ing variant is undened The extended

language is called

a

by extending the P CEKmachine with We dene the semantics of the extended language

a

the additional transition rules describ ed in Figure The evaluator for the extended language

is dened in the usual way cmp Figures and Unlike eval the evaluator eval eval

pcek pcek pcek

is no longer a function There are programs in for which the evaluator eval can either

a pcek

return a value or can b e unsp ecied b ecause of the application of a nontouch ing op eration to a

placeholder Still the twoevaluators clearly agree on programs in

a

P eval P Lemma For P eval

pcek a pcek

The Touch Optimization Algorithm

The goal of touch optimization is to replace the touching op erations car cdr if and apply by the

corresp onding nontouching op eration whenever p ossible without changing the semantics of pro

grams For example supp ose that a program contains let x car y M and we can prove that y is

never b ound to a placeholder Then we can replace the expression by the form let x car y M

which the machine can execute more eciently without p erforming a test for placeholdership on y

This optimization technique relies on a detailed dataow analysis of the program that deter

mines a conservativeapproximation to the set of runtime values for eachvariable More sp ecically

we assume that the analysis returns a valid set environment which is a table mapping program



variables to a set of runtime values that subsumes the set of values asso ciated with that variable

during an execution

Denition Set environments E j E S j E P j E Let P b e a program and let Vars

P

b e the set of variables o ccurring in P

A mapping E Vars PValue isaset environment for P

P pcek

E j E read E validates E ifforall x dom E E x Ex

The relation S j E read S validates E is dened inductively

hM E K ij E if E j E

flet pS S j E if S j E and S j E

 

S S j E P j E read P validates E ifforevery state S such that hP i

pcek

The basic idea b ehind touch optimization is now easy to explain If a valid set environment

shows that the argumentofatouch ing version of car cdr if or apply can never b e a placeholder

the optimization algorithm replaces the op eration with its nontouch ing version The optimization

algorithm parameterized over a valid set environment E is dened in Figure

The function sba describ ed in the next section always returns a valid set environment for

a program Assuming the correctness of of setbased analysis the touch optimization algorithm

preserves the meaning of programs For every transition step of a source program P there exists a

corresp onding transition step for the optimized program T P



Or a least a representation of this set that provides the appropriate information

Novemb er DRAFT

hM Ex V Ki if E y cons V V



  



unsp ecied if E y PhObj

car hlet x car y M EKi

pcek

pcek



error otherwise



hlet x cdr y M EKi analogous to car cdr

pcek

hM Ehar x M E iK i if E y false







if yM M M EKi unsp ecied if E y PhObj hlet x if

 

pcek

pcek



hM Ehar x M E iK i otherwise



hN E x E z





if E y hx NE i



har x M E iK i



yz M EKi appl y hlet x apply

pcek

unsp ecied if E y PhObj



pcek





error otherwise

Figure Nontouch ing transition rules

T

E a a

T x x

E

T let xc M let xc T M

E E

T let xy M let xy T M

E E

T let x y N M let x y T N T M

E E E

T let x cons yz M let x cons yz T M

E E

T let x future N M let x future T N T M

E E E



let x car y T M if E y PValue

E pcek

T let x car y M

E

let x car y T M if E y PValue

E pcek

T let x cdr y M analogous to car

E



yM M T M if E y PValue let x if

  E pcek

T let x if yM M M

E  

let x if yM M T M if E y PValue

  E pcek



yz T M if E y PValue let x apply

E pcek

T let x apply yz M

E

let x apply yz T M if E y PValue

E pcek

Figure The touch optimization algorithm T

Lemma Step Corresp ondence Let P beaprogram with E sba P and let S be a state

for which E is valid could use

anyvalid E

nm nm

Suppose S S Then T S T S

E E

pcek pcek

nm nm

Suppose T S S ThenS S where T S S

E E

pcek pcek

nm

Pro of We prove the rst part by induction on n and by case analysis of S S pcek

Novemb er DRAFT

We rst consider the case where S S via the transition rule car Then

pcek

S hlet x car y M EKi There are four subcases to consider dep ending

on whether or not T y contains placeholders and whether or not E y is a pair

E

Supp ose if E y PValue and touch E y cons V V Then

pcek pcek 

S hM E x V Ki

T E T K i T S hlet x car y T M

E E E E

touch T E y cons T V T V

E E E 

T S hT M T E x V T K i

E E E E

Hence T S T S via the rule car

E E

pcek

Supp ose if E y PValue and touch E y Pair fg Then

pcek pcek pcek

S herror i

T S hlet x car y T M T E T K i

E E E E

touch T E y Pair fg

pcek E pcek

T S herror i

E

T S via the rule car Hence T S

E E

pcek

PValue and touch E y cons V V Then Supp ose if E y

pcek pcek 

S hM E x V Ki

T S hlet x car y T M T E T K i

E E E E

E y cons V V



T E y cons T V T V

E E E 

T S hT M T E x V T K i

E E E E

Hence if E y PValue via the rule car

pcek

FinallysupposeE y PValue and touch E y Pair fg

pcek pcek pcek

Then

E y Pair fg

pcek

S herror i

T S hlet x car y T M T E T K i

E E E E

T E y Pair fg

E pcek

T S herror i

E

Hence T S T S via the rule car

E E

pcek

S via the rule car then T S T S via one of the rules Hence if S

E E

pcek pcek

car or car

The other cases are similar

The second part of the pro of pro ceeds in a similar manner by induction on n and by

nm

S case analysis of T S

E pcek

Novemb er DRAFT

Consider the case where T S S via the transition rule car

E pcek

y T M T E T K i T S hlet x car

E E E E

S hlet x car y M EKi by the denition of T

E

E y PValue

pcek

Supp ose that T E y cons T V T V Then

E E E 

S hT M T E x T V T K i

E E E E

E y cons V V



S hM E x V Ki

Hence S S via the rule car and T S S

E

pcek

Alternatively supp ose that T E y Pair Then

E pcek

touch E y Pair fg

pcek pcek

S herror i

S herror i

S S Hence S S via the rule car and T

E

pcek

The other cases are similar

The Step Corresp ondence Lemma implies that a touch optimized program exhibits the same

b ehavior as the corresp onding unoptimized program



eval T P eval P Theorem For P

pcek pcek

a

sba P 

Pro of Both the fact that eval is welldened on T P and that the equality holds follow

pcek

sba P 

from Lemma

In summary the touch optimization algorithm we presentremoves redundant touch op erations

from programs based on the information provided by setbased analysis This optimization al

gorithm is provablycorrect with resp ect to the semantics of future as sp ecied by the extended

evaluator eval Any implementation that realizes eval correctly can therefore make use of

pcek pcek

our optimization technique

SetBased Analysis for Futures

The development of a sound program analysis consists of two parts First we use the transition

rules of the P CEKmachine to derive constraints on the sets of runtime values that a variable

in a given program may assume Anysetenvironment satisfying these constraints is a valid set

environment Second we develop an algorithm for nding the minimal ie most accurate set

environment satisfying these constraints Our set constraints are similar to the constraints in

Heintzes work on setbased analysis for SML but our derivation diers from his

Novemb er DRAFT

Deriving Set Constraints for Program Variables

A set constraint is of the form

A

B

where A and B are statements concerning E andA also dep ends on the program b eing analyzed

A set environment E satises this constraint if whenever A holds for E then B also holds for E

Supp ose P is the program of interest and supp ose that the evaluation of P involves the transi

nm

S Wederive constraints on E sucient to ensure that S j E if S j E We pro ceed tion S

pcek

nm

by case analysis on the last transition rule used for S S and we present four representative

pcek

cases

Supp ose S S via the transition rule bindconst

pcek

hlet xc M EKi hM E x cKi

pcek

The transition pairs x with the constant c in the extended environment To ensure that the

set E x includes cweintro duce the constraint

let xc M P

P

C

c Ex

This constraint requires that for each term of the form let xc M o ccurring in P the

constant c must b e recorded in E as one of the p ossible values of the variable x

S via the transition rule apply In the interesting case y is b ound either Supp ose S

pcek

directly or via a placeholder ob ject to a closure hx NE i which implies that

hlet x apply yz M EKi hN E x E z har x M E iK i

pcek

to the value E z To ensure that E accounts for the binding of x to Then this rule binds x

E z we demand that E satisfy the constraint

let x apply yz M P V Ey

y

touch V hx NEi V Ez

pcek y

P

C



V Ex

Supp ose S S via the transition rule return

pcek

hM E y E xKi hx E har y M E iK i

pcek

To acount for transitions according to return our constraint system must ensure that E y

includes the value E x However a syntaxdirected program analysis cannot extract the

p ossible activation records that mayreceive the value of the nal variable in a pro cedure from

the variable or its immediate context However it will determine all p otential call sites of the

pro cedure and can enforce a relationship b etween the return variable of the pro cedure and

is a function the variable that receives the result of the function call Thus if FinalVar N

that determines the innermost result variable of N then the crucial constraint on this

variable is as follows

let x apply yz M P V Ey

y

touch V hx NEi V EFinalVar N

pcek y

P

C



V Ex

The denition of FinalVar is straightforward

Novemb er DRAFT

Denition FinalVar

FinalVar Vars

a

FinalVar x x

FinalVar let xV M FinalVar M

FinalVar let x future N M FinalVar M

FinalVar let x car y M FinalVar M

FinalVar let x cdr y M FinalVar M

FinalVar let x if yM M M FinalVar M



FinalVar let x apply yz M FinalVar M

The analysis for the transition rules futureid fork and join is analogous to the ab ove

P P

case The constraints C and C ensure that for each future expression in the program



the set environment E accounts for the bindings created byanyfutureid fork orjoin

transitions that corresp ond to that future expression

Examining each of the transition rules of the machine in a similar manner results in eleven

P P

programbased set constraints C C see Figure

Soundness of the Set Constraints

Proving the soundness of the set constraints requires showing that if a set environment E satises

the set constraints with resp ect to a given program P then E must b e valid for P

nm

P P

Assume that E satises C C To prove that P j E we need to show that hP i

pcek

S implies S j E The natural approach is to pro ceed by induction on n As part of the pro of we

will need to consider intermediate transitions starting from states other than hP i Therefore

we need to strengthen the induction hyp othesis to

nm

S j E and S S implies S j E

P P

pcek

where the relation S j E is an appropriately chosen relation This relation needs to assert a

P

numb er of prop erties ab out the state S in order to supp ort the pro of of the induction hyp othesis

First the relation needs to assert that the terms contained in S must o ccur in P ie the

evaluation of programs do es not involve the creation of new terms

Next the relation needs to assert that S can only contain values and environments that are

P and E written V E ifeach compatible with P and E Avalue V is compatible with

P

term in V o ccurs in P and eachenvironmentin V is compatible with P and E Similarlyan

environment E is compatible with P and E written E E ifeach binding in E o ccurs in E

P

and eachvalue in E is compatible with P and E

Denition V E E E

P P

The relation V E is the smallest relation satisfying the following clauses

P

c E if c o ccurs in P

P

hph p i E x E if x o ccurs in P

P P

hph pVi E if V E P and E E hx M Ei E if x M

P P P P

cons V V E if V E and V E

 P P  P

Novemb er DRAFT

let xc M P

P

C



c Ex

let xy M P V Ey

P

C



V Ex

let x y N M P x dom E Ex Ex

P

C



hy N EiEx

let x cons y y M P V Ey V Ey

     

P

C



cons V V Ex

 

let x car y M P V Ey touch V cons V V

y pcek y  

P

C



V Ex



let x cdr y M P V Ey touch V cons V V

y pcek y  

P

C



V Ex



let x apply yz M P V Ey

y

touch V hx NEi V Ez

pcek y

P

C



V Ex

let x apply yz M P V Ey

y

touch V hx NEi V EFinalVar N

pcek y

P

C

V Ex

let x if yM M M P V EFinalVar M EFinalVar M

   

P

C

V Ex

let x future N M P V EFinalVar N

N

P

C



V Ex hph pV iEx

N N

let x future N M P

P

C



hph p iEx

Figure Set Constraints on E with resp ect to P

E E holds if for all x dom E E x Ex and E x E

P P

The relation must also assert that E already contains the bindings that could b e created

during a subsequentreturn transition to an existing activation record This requirement

is necessary to supp ort the induction hyp othesis in the case of a return transition It is

P

enforced by C



Similarly the relation must assert that E already contains the bindings that could b e created

during a subsequentfutureid orjoin transition The formalization of this assertion refers

to the auxiliary function ResultVar The result of any state S will b e the p otential values of

the variable ResultVar S where ResultVar is the following function from states to variables

Novemb er DRAFT

Denition ResultVar

ResultVar State Vars

pcek

ResultVar hM E i FinalVar M

ResultVar hM E Khar x N E ii FinalVar N

ResultVar flet pS S ResultVar S

 

Finally to allow for error transitions the relation must hold for the error state error

The complete relation relation which asserts all of the ab ove prop erties is dened by induction

on the structure of states

Denition S j E

P



S j E S j E

P  P

flet pS S j E

 P

and V EResultVar S Sp V j E

 P



M P E E

P









and K har x M E i har x M E i



n n n









and x P M P E E for i n

i i i P







and E nalvar M Ex for i n

i i

hM E K ij E

P



and E nalvar M Ex ifn









and if K K har y x M E iK then













p iExand p PhVars hph







V EResultVar hM E K i hph pVi Ex

error j E

P

The invariant relation is a stronger relation than the validates relation ie if a states satises

the invariant relation for a set environment with resp ect to a given program then that state

obviously validates the set environment

Lemma S j E implies S j E

P

Our chosen invariant relation supp orts the pro of of the induction hyp othesis if the invariant

holds for a given state S thentheinvariant also holds for the successors of S

nm

P P

Lemma Suppose E satises C C Then S j E and S S implies S j E

P P

pcek

nm

Pro of By induction on n and by case analysis of the last transition rule for S S

pcek

and return indetail We present the cases for the transition rules car apply

Supp ose S S via the transition rule bindconst Then

pcek

S hlet xc M EKi

S hM E x cKi

Since S j E weknowthatlet xc M P E E and the conditions on

P P

P

K in the denition of the invariant are satised Because E satises C wehave

which implies that c Ex Also by denition c E Therefore E x c E

P P

that S j E P

Novemb er DRAFT

Supp ose S S via the transition rule apply Then

pcek

S hlet x apply yz M EKi

Since the analysis of the error case is trivial we only consider the case where y is

b ound either directly or via a placeholder ob ject to a closure hx NE iIn

this case

touch E y hx NE i

pcek

S hN E x E z har x M E iK i

It is easy to see that N P To show that the new environment E x E z is

compatible with P and E we pro ceed as follows

From the relation S j E weknow that E E ButE E implies that E y E

P P P P

which in turn implies E E Also from E E wehavethatE z Ez

P P

P

which since E satises C implies that E z Ex Finally E E implies

P



z Ex andE z E we that E z E Combining the facts E E E

P P P

have that E x E z E ie the new environment is compatible with P and

P

E

Finallywemust show that the appropriate conditions on the new continuation

P

and the har x M E iK hold That E FinalVar N Exfollows from C



remaining conditions on the continuation are implied by the relation S j E

P

Therefore the invariant holds for S

The nal case we consider is for the transition rule return For this case

S hx E har y M E iK i

S hM E y E xKi

That M P follows from the relation S j E To show that the new environment

P

E y E x is compatible with P and E we pro ceed as follows

From the relation S j E weknow that E E and hence E x E The

P P P

invariant also implies that E x Ey which in turn implies that E x Ey

Finally the invariant implies that E E Putting together the facts E x

P P

E E x Ey and E E wehave that E y E x E ie the new

P P

environment is compatible with P and E

The required conditions on K follow from the relation S j E Therefore the

P

invariant holds for S

The remaining cases have similar pro ofs

Since the invariant trivially holds for the initial state hP iitfollows that the set constraints are

sound ieif E satises the set constraints relativetoP then E is a valid set environment for P

P P

thenP j E C Theorem Soundness of Constraints If E satises C

nm

P P

Pro of Supp ose E satises C C Let S b e a state such that hP i S

pcek

By the denition of the invariant relation hP ij E Therefore Lemma implies

P

that S j E and hence by Lemma S j E The latter is true for any state derivable

P

P i hence P j E from the initial state h

In summaryany set environment satisfying the set constraints with resp ect to a program P is

a conservative approximation to the set of bindings created during the execution of P

Novemb er DRAFT

From Set Constraints to SetBased Analysis

The class of set environments for a given program P denoted SetEnv forms a complete lattice

P

under the natural p ointwise partial ordering v dened by

E vE if and only if x Vars E x E x

 P 

Smaller set environments corresp ond to more accurate approximations since they include fewer

extraneous p otential values p er variable Therefore we dene setbased analysis as a function that

returns the least set environment satisfying the set constraints

Denition sba

sba SetEnv

a P

P P

sba P ufE j E satises C C g

The function sba is welldened Since the set constraints are monotonic it follows that sba P

is a valid set environment for P Furthermore a value V is in sba P x if and only if from the

P P

we can prove that V Ex All that C assumption that a set environment E satises C

remains is to pro duce an algorithm for calculating sba P

Solving the Set Constraints

Since sba P typically maps variables to innite sets of p ossible values we need a nite represen

tation for these innite sets A systematic insp ection of the set constraints suggests that the set of

closures for a expression can b e represented by the expression itself that the set of closed pairs

for a consexpression can b e represented by the consexpression etc The actual sets of runtime

values can easily b e reconstructed from the representative terms and the set environment In short

we can take the set of abstract values for a program P to b e

V AbsValue c j x M j cons xy jhph x ijhph i

P P P P P

where the constant c the expression x M the pair cons xy and the variable x are

P P P P

all the resp ective subterms of P The size of AbsValue is O jP j where jP j is the length of P

P

Abstract values provide a nite representation for the innite set environments encountered in

E is a mapping from variables in P setbased analysis Sp ecicallyanabstract set environment

to nite sets of abstract values Each abstract value V in E x represents a set of runtime values

V dep ending on E according to the relation V in V and in a similar manner eachsetE xof

E

abstract values represents a set of machine values according to the relation V in x

E

c c in

p

E

x M x dom E Ex in x hx M Ei in

P

E E

cons V V in cons y y V in y

  i i

E E

hph pVi in hph y i V in y

P

E E

hph p i in hph i

E

V in x V E x with V in V

E E

Novemb er DRAFT

let xc M P

P

C



c E x

P

V E y let xy M P

P

C



V E x

let x y N M P

P

C



y N E x

P

let x cons y y M P E y E y

   

P

C



cons y y E x

  P

 

V E y cons z z touch E V V E z let x car y M P

y   P y 

P

C



V E x

 

V E touch E V V E

y cons z z z let x cdr y M P

  P  y y

P

C



V E x

let x apply yz M P V E y

y

 

x N touch E V V E z

P y

P

C



V E x

V E y let x apply yz M P

y

 

x N touch E V V E FinalVar N

P y

P

C

V E x

let x if yM M M P V E FinalVar M E FinalVar M

   

P

C

V E x

FinalVar N let x future N M P

V E

V

P

C



V E x hph FinalVar N iE x

V P

let x future N M P

P

C



hph i E x

Auxiliary Function

touch AbsEnv AbsValue PAbsValue

P P P



 

f V g if V c or V x M or V cons xy

P P P

 

touch E V

W j U E y and W touch E U g if V hph y i f

P

E with resp ect to P Figure Abstract Constraints on

The class of all abstract set environments for P given program is denoted AbsEnv Each abstract

P

set environment E is a nite representation of a p otentially innite set environment according to

the following function

F AbsEnv SetEnv

P P



F E x fV j V in xg

E

Reformulating the set constraints from Figure for abstract set environments pro duces the

P P

C C on E with resp ect to P see Figure We dene sba P to b e the abstract constraints

least abstract set environment satisfying the abstract constraints with resp ect to P

Novemb er DRAFT

Denition sba

sba AbsEnv

a P

P P

sba P ufEjE satises C C g

P P

Since each of the abstract constraints in monotonic sba P satises C C Furthermore

V sba P x if and only if we can prove based on the assumption that an abstract set environment

P P

E satises C C that V E x

The corresp ondence b etween set constraints and abstract constraints implies that sba P isa

nite representation for sba P

sba P Theorem Correctness of Abstraction sba P F

Pro of See App endix A



The class of abstract set environments forms a complete lattice of size O jP j under the natural

sba P in an iterative manner starting from pointwise partial order Therefore we can calculate

the empty abstract set environment E x and rep eatedly extending E with additional bindings

as required by the set constraints until E contains all the required bindings Since we can extend



E at most O jP j times this algorithm terminates Furthermore each time we extend E with a

new binding calculating the additional bindings implied by that new binding takes at most O jP j



time Hence the entire algorithm runs in O jP j time We include an implementation of this

algorithm in App endix B

sba P in a straightforward Optimization algorithms can interpret the abstract set environment

manner For example the query on sba P fromthe touch optimization algorithm

sba P y PValue

pcek

is equivalent to the following query on sba P

sba P y fc x M cons xy g

P P P

In a similar manner other queries on sba P can easily b e reformulated in terms of sba P

Exp erimental Results

We extended the Gambit compiler whichmakes no attempt to remove touch op erations

from programs with a prepro cessor that implements the setbased analysis algorithm and the

touch optimization algorithm The analysis and the optimization algorithm are as describ ed in



the previous sections extended to a suciently large subset of functional Scheme We used the

extended Gambit compiler to test the eectiveness of touch optimization on the suite of b enchmarks

contained in Feeleys PhD thesis on a GP sharedmemory multipro cessor Figure

describ es these b enchmarks

Eachbenchmark was tested on the original compiler standard and on the mo died compiler

touch optimized The results of the test runs are do cumented in Figure The rst two columns



Five of the b enchmarks include a small numb er one or two p er b enchmark of explicit touch op erations for co ordi

nating sideeects They do not aect the validity of the analysis and touch optimization algorithms

Novemb er DRAFT

Program Description

th

fib Computes the b onacci numb er using a doublyrecursive algorithm

queens Computes the numb er of solutions to the nqueens problem for n

rantree Traverses a binary with no des

mm Multiplies twoby matrices of integers

scan Computes the parallel prex sum of a vector of integers

sum Uses a divideandconquer algorithm to sum a vector of integers

tridiag Solves a tridiagonal system of equations

allpairs Parallel Floyds algorithm computes shortest path b etween all pairs in a no de graph

abisort Sorts integers using the adaptive bitonic sort algorithm

mst Computes the minimum spanning tree of a no de graph

qsort Uses a parallel Quicksort algorithm to sort integers

poly Computes the square of a term p olynomial and evaluates the resulting p olynomial

Figure Description of the Benchmark Programs

standard touch optimized

Benchmark touch es n touch es n sp eedup over standard

countK overhead countK overhead n n n

fib

queens

rantree

mm

scan

sum

tridiag

allpairs

abisort

mst

qsort

poly

Figure Benchmark Results

present the number of touch op erations p erformed during the execution of a b enchmark using the

standard compiler column and the sequential execution overhead of these touch op erations

column To determine the absolute overhead of touch we also ran the programs on a single

pro cessor after removing all touch op erations The next two columns contain the corresp onding

measurements for the touch optimizing compiler The touch optimization algorithm reduces the

number of touch op erations to a small fraction of the original numb er column thus reducing

the average overhead of touch op erations from approximately to less than column

The last three columns show the relative sp eedup of eachbenchmark for one four and

Novemb er DRAFT

pro cessor congurations resp ectively The numb er compares the running time of the b enchmarks

using the standard compiler with the optimizing compiler As exp ected the relative sp eedup

decreases as the numb er of pro cessors increases b ecause the execution time is then dominated

by other factors such as memory contention and communication costs For most b enchmarks

the b enet of our touch optimization is still substantial pro ducing an average sp eedup over the

standard compiler of on four pro cessors and of on pro cessors The exceptions are

the last three b enchmarks mst qsort and poly However even Feeley describ ed these as

p o orly parallel programs in which the eects of memory contention and communication costs

are esp ecially visible It is therefore not surprising that our optimizing compiler do es not improve

the running time in these cases

Related Work

Kranz et al briey describ e a simplistic algorithm for touch optimization based on a rst

order typ e analysis The algorithm lowers the touch overhead to from in standard

b enchmarks that is it is signicantly less eective than our touch optimization The pap er do es

not address the semantics of future or the wellfoundedness of the optimizations Knopp

rep orts the existence of a touch optimization algorithm based on abstract interpretation His pap er

terpretation He only rep orts the reduction of static presents neither a semantics nor the abstract in

counts of touch op erations for an implementation of with future Neither pap er

gives an indication concerning the exp ense of the analysis algorithms

At LFP Jaganathan and Weeks describ ed an analysis for explicitly parallel symb olic

programs which they intend to use in a forthcoming compiler They remark that the analysis could

b e used for touch optimizations Their semantics and their derivation of the analysis signicantly

dier from ours so that wehave not b een able to compare the two analyses in detail They do not

haveanimplementation of their algorithm for a full language like functional Scheme and they do

not have optimization algorithms that exploit the results of their analysis

Muchwork has b een done on the static analysis of sequential programs including abstract

interpretation and CFA Our analysis is most closely follows Heintzes work on setbased

analysis for the sequential language ML but the extension of this technique to parallel languages

requires a substantial reformulation of the derivation and correctness pro of Sp ecically Heintze

uses the natural semantics framework to dene a setbased natural semantics from whichhe

reads o safeness conditions on set environments He then presents set constraints whose solution

is the minimal safe set environment We start from an parallel abstract machine and avoid these

intermediate steps by deriving our set constraints and proving their correctness directly from the

abstract machine semantics

Other techniques for static analysis of sequential programs include abstract interpretation

and Shivers CFA The relationship b etw een abstract interpretation and setbased analysis

was covered by Heintze

Sequential optimization techniques such as tagging optimization and softtyping are

similar in character to touch optimization Both techniques remove the typ edispatches required

for dynamic typ echecking wherever p ossible without changing the b ehavior of programs in the

same fashion as weremove touch op erations However the analyses relies on conventional typ e

inference techniques



Itos group Ito p ersonal communication April rep orts an attempt at touch optimization based on abstract

interpretation His group abandoned the eort due to the exp onential cost of the abstract interpretation algorithm

Novemb er DRAFT

Conclusion

The development of a semantics for futures directly leads to the derivation of a p owerful program

analysis The analysis is computationally inexp ensive but yields enough information to eliminate

numerous implicit touch op erations We b elieve that the construction of this simple touch opti

mization algorithm clearly illustrates howsemantics can contribute to the development of advanced

Weintend to use our semantic characterization for the derivation of other program op

timizations in Gambit and for the design of truly transparent future annotations for languages

with imp erative constructs

Acknowledgments We thank Marc Feeley for discussions concerning touch optimizations and

for his assistance in testing the eectiveness of our algorithm and Nevin Heintze for discussions on

setbased analysis and for access to his implementation of set based analysis for ML

A Correctness Pro of for Abstract Representation

We use in as shorthand for in

P

sba P 



Theorem Correctness of Abstraction F sba P sba P



Pro of Weshow the equivalence of sba P andF sba P by proving the set inclusion

in b oth directions Let x be a variable in Vars Then

P



sba P x V F

V in x by denition of F

P

V sba P x by Lemma A

Also

V sba P x

V sba P x with V in V by Lemma A

P

V in x

P



V F sba P x by denition of F



sba P sba P Hence F

Lemma A sba includes sba V in x implies V sba P x

P

Pro of Assume that V in x Then there exists V sba P x with V in V Hence

P P

sba P satises the abstract there must b e a pro of based on the assumption that

constraints that proves V sba P x We pro ceed by lexicographic induction on the

size of V and on the length of this pro of and by case analysis on the last abstract

constraint used in the pro of

P P

C V sba P x via constraint C V c V c and let xc M Supp ose Then

P

P

o ccurs in P and hence by C wehave that V sba P x

Novemb er DRAFT

P P

C Supp ose V sba P x via constraint C Thenlet xy M o ccurs in P Also

 

V sba P y via a shorter pro of so by induction wehave V sba P y Using

P

constraint C gives us V sba P x



P P

C Supp ose V sba P x via constraint C Then let x y N M o ccurs in P

 

V y M and V hy N Ei where for each z dom E E z in z Each

P P

E z is smaller than V therefore by induction wehave that for each z dom E

P

E z sba P z Using constraint C then shows that V sba P x



P P

C Supp ose V sba P x via constraint C Thenlet x cons y y M o ccurs



in P V cons y y and V cons V V where V in y Each V is smaller

 P  i P i i

P

than V therefore by induction wehavethatV sba P y Using constraint C

i i

then shows that V sba P x

P P

C Supp ose V sba P x via constraint C Thenlet x car y M o ccurs in

V is not an abstract placeholder In this case P We rst with the case where

y

V cons z z and V sba P y via a shorter pro of By Lemma A there

y  P y

exists V in cons z z therefore there exists V in z Since V in V and V

P  P  P  P

sba z cons VV in cons z z By induction wehave that cons VV

 P  

P

sba P y and nally C implies that V sba P x

V is an abstract placeholder follows by a similar argument The case where

y

P P

C The analysis for the constraint C is similar to the previous case

P P

C Supp ose V sba P x via constraint C Again we rst with the case where

 

V is not an abstract placeholder In this case x N sba P y and V

y P

sba P z via shorter pro ofs Since hx N i in x N by induction we

P P

have that hx N i sba P y and that V sba P z An application of

P

C proves that V sba P x



V is an abstract placeholder follows by a similar argument The case where

y

P P

C C The analysis for the constraint is similar to the previous case

 

P P P P

C C The analysis for the constraint C and the left implication of C is similar to the

 

P

C analysis for



P P

Supp ose where C V sba P x via the right implication of constraint C V

 

hph FinalVar N i and V in hph FinalVar N i Then V hph pV i where V in FinalVar N

P N N P

P

By induction V sba P FinalVar N Hence the constraint C implies that

N



V sba P x

P P

C The analysis for the constraint C is trivial

Lemma A Nonemptiness of abstract values V sba P x implies there exists V in V

P

V sba P x We Pro of The pro of is by induction on the length of the pro of that

pro ceed by case analysis on the last constraint used in the pro of

P P

C Supp ose V sba P x via constraint C Then V c and c in V

P P

P P

C Supp ose V sba P x via constraint C Then V sba P y via a shorter

 

pro of and the lemma holds by induction

Novemb er DRAFT

P P

C Supp ose V sba P x via constraint C Then V y M and hence

P

 

hy M i in V

P

P P

C Supp ose V sba P x via constraint C Then V cons y y andV

 P i

sba P y for some V i via shorter pro ofs Therefore by induction there

i i

exists V in V and hence cons V V in V

i P i  P

P P P P P

The analysis of the constraints C C C C C and the left implication of

 

P P

C is similar to the analysis for C

 

P P

C Supp ose hph FinalVar N i sba P x via constraint C Thenwehave V

N

 

sba P FinalVar N via a shorter pro of so by induction there exists V in V

P N

hph FinalVar N i Hence wehave that hph pVi in

E

Lemma A sba includes sba V sba P x implies there exists V sba P x with V in V

P

Pro of Assume that V sba P x Then there exists a pro of based on the assumption

that sba P satises the set constraints that proves that V sba P x Weproceed

by induction on the length of this pro of and by case analysis on the last step in the

pro of

P

V c and the lemma holds C We take

P

P

For this case V sba P y via a shorter pro of so by induction there exists C



P

V sba P y with V in V Then C implies that V sba P x

P



P

C In this case V hy N Ei and for each z dom E Ez sba P z

i i i



via shorter pro ofs Therefore there exist V such that V sba P z and

i i i

P

V Nowtake V y N thenby C V sba P x wehave E z in

i P i P



and hy N Ei in V

P

P

C In this case V cons V V and V sba P y via shorter pro ofs Therefore

 i i

V sba P y with V in V Nowtake V cons y y then by there exist

i i i P i 

P

C V sba P x wehave that

P P

C Supp ose V sba P x via constraint C For simplicitywe consider only the

case where V is not a placeholder since the case involving placeholder is similar

y

but more complicated

Thus V cons V V sba P y via a shorter pro of By induction there

y 

V such that V sba P y and V in V HenceV cons z z exists

y y y P y y  P

P

V sba P z and V in V From C V sba P x and the we can prove

P

lemma holds for this case

P

C This case is analogous to the previous case

P P

C Supp ose V sba P x via constraint C For simplicitywe consider only the

 

case where V is not a placeholder since the case involving placeholder is similar

y

but more complicated

Thus V hx NEi sba P y via a shorter pro of By induction there

y

V such that V sba P y andV in V Hence V x N Also exists

y y y P y P

V sba P z via a shorter pro of so by induction there exists V such that V

P

sba P y and V in V Hence by C wehave V sba P x

P 

Novemb er DRAFT

P

C Again we consider only the case where V is not a placeholder



Thus V hx NEi and V sba P y via a shorter pro of By induction

y y

there exists V such that V sba P y and V in V Hence V x N

y y y P y y P

Also V sba P FinalVar N via a shorter pro of so by induction there exists

P

V such that V sba P FinalVar N and V in V Henceby C wehave V

P



sba P x

P P P P

C C The analysis for the constraint C and the left implication of C is similar to the

 

P

analysis for C



P P

C Supp ose hph pV i sba P x via the right implication of C Thenwehave

N

 

V V sba P FinalVar N via a shorter pro of so by induction there exists

N N

P

sba P FinalVar N with V in V ByC wehave that hph FinalVar N i

N P N



sba P x and hph pV i in hph FinalVar N i

N P

P

C This case is trivial

B Set Based Analysis Algorithm



A complete O jP j setbased analysis algorithm for the intermediate language is included in

a

Figure The algorithm is written in Scheme extended with a sp ecial form match for pattern

matching

The algorithm relies on a group of auxiliary functions that maintain for each program variable

an asso ciated set of abstract values and an asso ciated set of constraints b oth of which are initially

empty The function addabsvalue extends the abstract value set of a variable the predicate

inabsvalueset tests for memb ership in that set and the iterator function foreachabsvalue var

fn calls fn on each abstract value asso ciated with the variable var The functions addaconstraint

inconstraintset and foreachconstraint behave in a similar manner on constraintsetsWe assume

that the functions addabsvalue addaconstraint inabsvalueset and inconstraintset op erate

in constant time and that the functions foreachabsvalue and foreachconstraint op erate in time

linear in the numb er of elements in the appropriate set

The function SBA traverses an expression to ensure that the expression satises the abstract

constraints and returns the nal variable of that expression Certain constraints cannot b e satised

P

C requires that all abstract values in E y must b e in immediatelyFor example the constraint



E x but during the analysis of a program wemaynotyet know all the abstract values that may

E y Therefore we asso ciate a constraintprop ogateto x with the variable y This b e added to

constraint ensures that whenever an abstract value is added to E y then that abstract value is

also prop ogated to E x The function interpretconstraint is called for constraint and abstract

value asso ciated with a given variable and ensures that the constraint is satised by creating new

abstract values or new constraints as necessary



The O jP j time b ound can b e veried as follows Each call of the functions newabsvalue and

newconstraint takes constant time excluding the time sp ent in the b o dy of the resp ective unless

expressions The number of variables the numb er of abstract values and the numb er of constraints



are all O jP j Therefore the test conditions of the two unless expressions succeed at most O jP j



P P

and that do not include C C For simplicity the algorithm implements simpler versions of the abstract constraints

 

that nonemptyness conditions E y and E FinalVar N We b elieve the extra degree of approximation

i

intro duced by this simplicati on is negligibl e in practice

Novemb er DRAFT



times each Hence the b o dy of each unless expression is executed at most O jP j times and



function interpretconstraint is called at most O jP j times Each call of interpretconstraint



terminates in constant time Therefore the entire algorithm takes O jP j time

References

Baker H and Hewitt C The incremental garbage collection of pro cesses In Proceedings

of the Symposium on Articial Intel ligence and Programming Languages vol

pp

BBN Advanced Computers Inc Cambridge MA Inside the GP

Cousot P and Cousot R Abstract interpretation A unied lattice mo del for static

analyses of programs by consruction or approximation of xp oints In POPL pp

Cousot P and Cousot R Higer order abstract interpretation and application to com

p ortment analysis generalizing strictness termination pro jection and p er analysis of functional

languages ICCL

ale Shared Feeley M An Ecient and General Implementation of Futures on Large Sc

Memory Multiprocessors PhD thesis Department of Computer Science Brandeis University

Feeley M and Miller J S A parallel virtual machine for ecientscheme compilation

In LFP

Flanagan C and Felleisen M The semantics of Future Rice University Comp Sci

TR

Flanagan C Sabry A Duba B F and Felleisen M The essence of compiling

with continuations In PLDI pp

Halstead R Multilisp A language for concurrentsymb olic computataion ACM Transac

tions on Programming Languages and Systems

Heintze N Set BasedProgram Analysis PhD thesis Carnegie Mellon University

Heintze N Setbased analysis of ML programs In LFP pp

Henglein F Global tagging optimization bytyp e inference In LFP pp

Ito T and Halstead R Eds Paral lel Lisp Languages and Systems SpringerVerlag

Lecture Notes in Computer Science

Ito T and Matsui M A parallel lisp language Pailisp and its kernel sp ecication

Jagannathan S and Weeks S Analyzing stores and references in a parallel symb olic

language In LFP pp

Katz M and Weise D Continuing into the future on the interaction of futures and

rstclass continuations In LFP

Novemb er DRAFT

dene SBA

lambda expression

match expression

variable x x

let x exp body

match exp

constant c newabsvalue x c

variable y newconstraint y prop ogateto x

cons y y newabsvalue x cons y y

lamb da y N

let nalvarN SBA N

newabsvalue x lamb da y N nalvarN

future N

let nalvarN SBA N

newconstraint nalvarN prop ogateto x

newabsvalue x ph nalvarN

newabsvalue x phcirc

car y newconstraint y prop ogatecarto x

cdr y newconstraint y prop ogatecdrto x

if y M M

let nalvarM SBA M nalvarM SBA M

newconstraint nalvarM prop ogateto x

newconstraint nalvarM prop ogateto x

z newconstraint y application x z apply y

SBA body

dene newabsvalue

lambda var absvalue

unless inabsvalueset var absvalue

addabsvalue var absvalue

foreachconstraint var lambda constraint interpretconstraint constraint absvalue

dene newconstraint

lambda var constraint

unless inconstraintset var constraint

addconstraint var constraint

foreachabsvalue var lambda absvalue interpretconstraint constraint absvalue

dene interpretconstraint

lambda constraint absvalue

match cons constraint absvalue

prop ogateto x v newabsvalue x v

prop ogatecarto x cons y y newconstraint y prop ogateto x

prop ogatecdrto x cons y y newconstraint y prop ogateto x

application result arg lamb da para nalvar

newconstraint nalvar prop ogateto result

newconstraint arg prop ogateto para

void

Figure The SetBased Analysis Algorithm

Novemb er DRAFT

Kessler RR and R Swanson Concurrentscheme

Knopp J Improving the p erformance of parallel lisp by compile time analysis

Kranz D Halstead R and Mohr E MulT A highp erformance parallel lisp

Kranz D Halstead R and Mohr E MulT A highp erformance parallel lisp In

PLDI pp

Miller J MultiScheme A Paral lel Processing System PhD thesis MIT

Mohr E Kranz R and Halstead R Lazy task creation A technique for increasing

the granularity of parallel programs In LFP

Moreau L Sound Evaluation of Paral lel Functional Programs with FirstClass Continua

tions PhD thesis Universite de Liege

Shivers O Controlow Analysis of HigherOrder Languages or Taming Lambda PhD

thesis CarnegieMellon University

Swanson M Kessler R and Lindstrom G An implementation of p ortable standard

lisp on the BBN butteryInLFP pp

Wright A and R Cartwright A practical soft typ e system for scheme In LFP pp