Fixed the support in the backends for mobile channel stuff

This commit is contained in:
Neil Brown 2009-03-19 15:23:35 +00:00
parent ca61da25cf
commit 8e5e73e3a2
2 changed files with 26 additions and 3 deletions

View File

@ -1073,6 +1073,12 @@ cgenInputItem c (A.InVariable m v)
tell [","]
rhs
tell [");"]
A.Mobile {} ->
do tell ["MTChanIn(wptr,"]
call genVariable c
tell [",(void*)"]
rhs
tell [");"]
_ ->
do tell ["ChanIn(wptr,"]
call genVariable c
@ -1099,21 +1105,37 @@ cgenOutputItem c (A.OutCounted m ce ae)
call genBytesIn m subT (Right v)
tell [");"]
cgenOutputItem c (A.OutExpression m e)
= do t <- astTypeOf e
case (t, e) of
= do t <- astTypeOf c
let innerT = case t of
A.Chan _ t' -> t'
A.ChanEnd _ _ t' -> t'
case (innerT, e) of
(A.Int, _) ->
do tell ["ChanOutInt(wptr,"]
call genVariable c
tell [","]
call genExpression e
tell [");"]
(A.Mobile {}, A.ExprVariable _ (A.DerefVariable _ v)) ->
do tell ["{void* outtmp = MTClone(*"]
call genVariableAM v A.Abbrev
tell [");MTChanOut(wptr,"]
call genVariable c
tell [",&outtmp);}"]
(A.Mobile {}, A.ExprVariable _ v) ->
do tell ["MTChanOut(wptr,"]
call genVariable c
tell [",(void*)"]
call genVariableAM v A.Abbrev
tell [");"]
(_, A.ExprVariable _ v) ->
do tell ["ChanOut(wptr,"]
call genVariable c
tell [","]
call genVariableAM v A.Abbrev
tell [","]
call genBytesIn m t (Right v)
te <- astTypeOf e
call genBytesIn m te (Right v)
tell [");"]
--}}}

View File

@ -107,6 +107,7 @@ evalVariable (A.Variable m n)
Nothing -> throwError (Just m, "non-constant variable " ++ show n ++ " used")
evalVariable (A.SubscriptedVariable _ sub v) = evalVariable v >>= evalSubscript sub
evalVariable (A.DirectedVariable _ _ v) = evalVariable v
evalVariable (A.DerefVariable _ v) = evalVariable v
evalIndex :: A.Expression -> EvalM Int
evalIndex e