X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mtaskext.bytecode.tex;h=fd5feee518ef367f8417ef521727c96532078406;hb=a8c4fab6539e030e3d656e2420a31a5c22874376;hp=887a6b56964f0d964d9867b4003934b42d0b4274;hpb=d66b8c6bae6fde77e7ba53759f862364a9505ace;p=msc-thesis1617.git diff --git a/mtaskext.bytecode.tex b/mtaskext.bytecode.tex index 887a6b5..fd5feee 100644 --- a/mtaskext.bytecode.tex +++ b/mtaskext.bytecode.tex @@ -24,7 +24,10 @@ the content. Most notably, the type must be bytecode encodable. A \CI{BCValue} must be encodable and decodable without losing type or value information. At the moment a simple encoding scheme is used that uses single byte prefixes to detect the type of the value. The devices know these prefixes and can apply the -same detection if necessary. +same detection if necessary. Note that \CI{BCValue} uses existentially +quantified type variables and therefore it is not possible to derive class +instances such as \CI{iTasks}. Tailor-made instances for these functions have +been made. \begin{lstlisting}[label={lst:bcview},caption={Bytecode view}] :: ByteCode a p = BC (RWS () [BC] BCState ()) @@ -171,12 +174,12 @@ instance noOp ByteCode where The semantics for the \gls{mTask}-\glspl{Task} bytecode view are different from the semantics of the \gls{C} view. \glspl{Task} in the \gls{C} view can start new \glspl{Task} or even start themselves to continue, while in the bytecode -view, \glspl{Task} run indefinitely, 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. +view, \glspl{Task} run indefinitely, 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}] @@ -215,15 +218,15 @@ addSDS sds v s = {s & sdss=[{sds & sdsval=BCValue v}:s.sdss]} \end{lstlisting} All assignable types compile to an \gls{RWST} which writes the specific fetch -instruction(s). For example, using an \gls{SDS} always results in an -expression of the form \CI{sds \x=4 In ...}. The actual \CI{x} is the +instruction(s). For example, using an \gls{SDS} always results in % chktex 36 +an expression of the form \CI{sds \x=4 In ...}. The actual \CI{x} is the \gls{RWST} that always writes one \CI{BCSdsFetch} instruction with the correctly embedded \gls{SDS}. Assigning to an analog pin will result in the \gls{RWST} containing the \CI{BCAnalogRead} instruction. When the operation on the assignable is not a read operation from but an assign operation, the -instruction(s) will be rewritten accordingly. This results in a \CI{BCSdsStore} -or \CI{BCAnalogWrite} instruction respectively. The implementation for this is -given in Listing~\ref{lst:assignmentview}. +instruction(s) will be rewritten accordingly. This results in a %chktex 36 +\CI{BCSdsStore} or \CI{BCAnalogWrite} instruction respectively. The +implementation for this is given in Listing~\ref{lst:assignmentview}. \begin{lstlisting}[label={lst:assignmentview},% caption={Bytecode view implementation for assignment.}]