4 \begin{block
}{Downsides of the current mTask view
}
6 \item It all seems perfect
7 \item \ldots\pause{} but
\ldots
10 \item Compilation requires reprogramming
14 \begin{block
}{Solution
}
16 \item New bytecode backend for mTask
17 \item Interpreter on client
18 \item Server in iTasks with integration
19 \item No taskserver generation, onetime programming
20 \item Explicit SDS publishing
25 \subsection{Extending mTask
}
26 \begin{frame
}[fragile
]
27 \frametitle{Adding a View
}
29 :: ByteCode a p = BC (RWS ()
[BC
] BCState ())
30 :: BC = BCNop | BCPush BCValue | ...
31 :: BCValue = E.e: BCValue e & mTaskType, TC e
32 :: BCShare =
{ sdsi :: Int, sdsval :: BCValue, sdsname :: String
}
33 :: BCState =
{ freshl :: Int, freshs :: Int, sdss ::
[BCShare
] }
35 instance ByteCode arith, boolExpr, ...
39 \begin{frame
}[fragile
]
40 \frametitle{Implementation
}
42 \item Writing instruction
44 \item Hand-crafted helpers
47 op2 :: (ByteCode a p1) (ByteCode a p2) BC -> ByteCode b Expr
48 op2 (BC x) (BC y) bc = BC (x >>| y >>| tell
[bc
])
50 tell2 ::
[BC
] -> (ByteCode a p)
53 instance arith ByteCode where
54 lit x = tell2
[BCPush (BCValue x)
]
55 (+.) x y = op2 x y BCDiv
60 \begin{frame
}[fragile
]
61 \frametitle{Control flow
}
70 :: BC = ... | BCLab Int | ...
72 freshlabel = get >>=
\st=:
{freshl
}->put
{st & freshl=freshl+
1} >>| pure freshl
74 instance If ByteCode Stmt Stmt Stmt where If b t e = BCIfStmt b t e
76 BCIfStmt (BC b) (BC t) (BC e) = BC (
77 freshlabel >>=
\else->freshlabel >>=
\endif->
78 b >>| tell
[BCJmpF else
] >>|
79 t >>| tell
[BCJmp endif, BCLab else
] >>|
80 e >>| tell
[BCLab endif
]
85 \begin{frame
}[fragile
]
86 \frametitle{Functionality
}
87 \begin{block
}{SDS scope and naming
}
90 \item State per device
91 \item Tasks are sent and gone
96 class namedsds v where
97 namedsds :: ((v t Upd) -> In (Named t String) (Main (v c s)))
98 -> (Main (v c s)) | ...
99 :: Named a b = Named infix
1 a b
101 instance sdspub ByteCode where
102 pub (BC x) = BC (censor (\
[BCSdsFetch s
]->
[BCSdsPublish s
]) x)
107 \begin{frame
}[fragile
]
108 \frametitle{Assignment
}
110 instance sds ByteCode where
111 sds f =
{main = BC (freshshare
112 >>=
\sdsi->pure
{BCShare|sdsname="",sdsi=sdsi,sdsval=BCValue
0}
113 >>=
\sds->pure (f (tell2
[BCSdsFetch sds
]))
114 >>= \(v In bdy)->modify (addSDS sds v)
115 >>| unBC (unMain bdy))
118 instance assign ByteCode where
119 (=.) (BC v) (BC e) = BC (e >>| censor makeStore v)
121 makeStore
[BCSdsFetch i
] =
[BCSdsStore i
]
122 makeStore
[BCDigitalRead i
] =
[BCDigitalWrite i
]
123 makeStore
[...
] =
[...
]
126 \begin{frame
}[fragile
]
127 \frametitle{Task scheduling
}
131 \item Tasks start other tasks
137 \item Old system, taskserver, tasks start tasks
138 \item New system, task+strategy
142 \item \CI{OnInterval
}
143 \item \CI{OnInterrupt
}
146 \item How to handle termination
156 \subsection{Interpretation
}
157 \begin{frame
}[fragile
]
158 \frametitle{mTask implementation
}
167 \item Implement some classes in interface
169 \item How to handle termination
174 \subsection{Examples
}