X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=results.mtask.tex;h=50cd1d6a6fe1ad4bb867a4aa5a588d7e964f52c9;hb=fcef9f5c5b6021ac424b19c44b4bda608eceaf40;hp=92e078248713a3ca6b672b431f7cb10410b83374;hpb=89072e21c162b4b8c0963ef3a37d1f669e582e46;p=msc-thesis1617.git diff --git a/results.mtask.tex b/results.mtask.tex index 92e0782..50cd1d6 100644 --- a/results.mtask.tex +++ b/results.mtask.tex @@ -224,11 +224,29 @@ BCIfStmt (BC b) (BC t) (BC e) = BC ( t >>| tell [BCJmp endif, BCLab else] >>| e >>| tell [BCLab endif] ) + instance noOp ByteCode where noOp = tell` [BCNop] \end{lstlisting} -\todo{Add return instruction} +The semantics for the \glspl{mTask} bytecode view are different than the +semantics for the \gls{C} view. \glspl{Task} in the \gls{C} view can start new +\gls{Task} or themselves to continue, while in the bytecode view, \gls{Task} +run idefinitly, one-shot or on interrupt. To allow interval and interrupt +\glspl{Task} to terminate, a return instruction is added. This class was not +available in the original system and is thus added. It just writes a single +instruction so that the interpreter knows to stop execution. +Listing~\ref{lst:return} shows the classes and implementation for the return +expression. + +\begin{lstlisting}[label={lst:return},% + caption={Bytecode view for the return instruction}] +class retrn v where + retrn :: v () Expr + +instance retrn ByteCode where + retrn = tell` [BCReturn] +\end{lstlisting} \subsection{Shared Data Sources \& Assignment} Shared data sources must be acquired from the state and constructing one