comparison doc_recap_some_important_thoughts_about_the_current_compiler.patch @ 142:cbff597d307e default tip

Wip doc
author Louis Opter <louis@lse.epita.fr>
date Sun, 09 Feb 2014 15:48:57 -0800
parents 85c2fa6f6bd8
children
comparison
equal deleted inserted replaced
141:85c2fa6f6bd8 142:cbff597d307e
1 # HG changeset patch 1 # HG changeset patch
2 # Parent 01873f017f54a0c625261b8a1f27052219a00141 2 # Parent 3bae25c81f3e5b3be3a6609c932997d9a8fc3b59
3 Recap important notes about the current compiler in a small document 3 Recap important notes about the current compiler in a small document
4 4
5 This should be used as a work document for the next compiler version. 5 This should be used as a work document for the next compiler version.
6 6
7 diff --git a/doc/rathaxes/technical/CMakeLists.txt b/doc/rathaxes/technical/CMakeLists.txt 7 diff --git a/doc/rathaxes/technical/CMakeLists.txt b/doc/rathaxes/technical/CMakeLists.txt
15 +ADD_LATEX_DOCUMENT(rtx_2k12_wrap_up.tex DEFAULT_PDF MANGLE_TARGET_NAMES) 15 +ADD_LATEX_DOCUMENT(rtx_2k12_wrap_up.tex DEFAULT_PDF MANGLE_TARGET_NAMES)
16 diff --git a/doc/rathaxes/technical/rtx_2k12_wrap_up.tex b/doc/rathaxes/technical/rtx_2k12_wrap_up.tex 16 diff --git a/doc/rathaxes/technical/rtx_2k12_wrap_up.tex b/doc/rathaxes/technical/rtx_2k12_wrap_up.tex
17 new file mode 100644 17 new file mode 100644
18 --- /dev/null 18 --- /dev/null
19 +++ b/doc/rathaxes/technical/rtx_2k12_wrap_up.tex 19 +++ b/doc/rathaxes/technical/rtx_2k12_wrap_up.tex
20 @@ -0,0 +1,113 @@ 20 @@ -0,0 +1,121 @@
21 +\documentclass[american]{rtxarticle} 21 +\documentclass[american]{rtxarticle}
22 + 22 +
23 +\title{Rathaxes 2012 wrap-up} 23 +\title{\rtx\ 2012 wrap-up}
24 + 24 +
25 +\author{Louis Opter} 25 +\author{Louis Opter}
26 + 26 +
27 +\begin{document} 27 +\begin{document}
28 + 28 +
29 +\maketitle 29 +\maketitle
30 + 30 +
31 +\begin{abstract} 31 +\begin{abstract}
32 +The second version of the Rathaxes compiler, \emph{Rathaxes 2012}, started in 32 +The second iteration of the \rtx\ compiler, \emph{\rtx\ 2012}, started in 2010
33 +2010 has been sunset in 2013. This document aims to highlight the issues and 33 +has been sunset in 2013. This document aims to highlight the issues and the
34 +the lessons learned while trying to recode an e1000 driver with this compiler 34 +lessons learned while trying to recode an e1000 driver with this compiler
35 +version. 35 +version.
36 + 36 +
37 +This document should serve as a reference for the next version of the Rathaxes 37 +This document should serve as a reference for the next version of the \rtx\
38 +compiler implemented in Python 3 with Pyrser. 38 +compiler implemented in Python 3 with Pyrser. Design shortcomings led to the
39 +biggest issues and are covered first, some implementation issues are covered in
40 +a second part.
39 +\end{abstract} 41 +\end{abstract}
40 + 42 +
41 +\section{Design issues} 43 +\section{Design issues}
42 + 44 +
43 +\subsection{Unused features} 45 +\subsection{Unused features}
47 +\begin{itemize} 49 +\begin{itemize}
48 +\item Advanced chunk selection (using the \texttt{with} statement); 50 +\item Advanced chunk selection (using the \texttt{with} statement);
49 +\item Register declarations. 51 +\item Register declarations.
50 +\end{itemize} 52 +\end{itemize}
51 + 53 +
52 +Turned out to unecessary because: 54 +Turned out to unnecessary because:
53 + 55 +
54 +\begin{itemize} 56 +\begin{itemize}
55 +\item We decided to scope the first driver to a single kernel (Linux 2.6.32 and 57 +\item We decided to scope the first driver to a single kernel (Linux 2.6.32 and
56 + then 3.2.0); 58 + then 3.2.0);
57 +\item Register declarations were not clearly wired to the rest of the language 59 +\item Register declarations were not clearly wired to the rest of the language
58 + and were simply too advanced to be used at first; 60 + and were simply too advanced to be used at first;
59 +\item Challenges appeared at other places. 61 +\item Challenges appeared at other places.
60 +\end{itemize} 62 +\end{itemize}
61 + 63 +
64 +The \texttt{with} statement stays a core feature of the language, it just
65 +turned out to an advanced feature that we didn't need at first.
66 +
62 +It's also interesting to note that sequences weren't used to define algorithms 67 +It's also interesting to note that sequences weren't used to define algorithms
63 +as planned but were re-fitted as ``functions'' as we started to write object 68 +as planned but were re-fitted as ``functions'' as we started to write object
64 +oriented code around Rathaxes types. Some sequences are also used to logically 69 +oriented code around \rtx\ types. Some sequences are also used to logically
65 +regroup chunks and pointcut but those chunks could be moved to types or could 70 +regroup chunks and pointcut but those chunks could be moved to types or could
66 +directly be top-level declarations within their interface. 71 +directly be top-level declarations within their interface.
67 + 72 +
68 +\subsection{Features we missed} 73 +\subsection{Features we missed}
69 + 74 +
70 +The following compiler features: 75 +The following compiler features:
71 + 76 +
72 +\begin{itemize} 77 +\begin{itemize}
73 +\item ``Object model''; 78 +\item ``Object model'';
74 +\item Ref/Scalar; 79 +\item ref/scalar (let you express whether a variable or attribute is a pointer
80 + or not);
75 +\item Error handling; 81 +\item Error handling;
76 +\item Variadic sequences; 82 +\item Variadic sequences;
77 +\item Arrays support; 83 +\item Arrays support (maybe we could have ref, scalar and array?);
78 +\item Comments passthrough; 84 +\item Comments pass-through;
79 +\item Type coercion to \texttt{Builtin::symbol}. 85 +\item Type coercion to \texttt{Builtin::symbol}.
80 +\end{itemize} 86 +\end{itemize}
81 + 87 +
82 +Are really needed. 88 +Are really needed; the ref/scalar distinction has been implemented in 2013 and
89 +works ok.
83 + 90 +
84 +\subsubsection{``Object model''} 91 +\subsubsection{``Object model''}
85 + 92 +
86 +The driver code started to organically organize itself into types with methods 93 +The driver code started to organically organize itself into types, with methods
87 +and attributes that loosely correspond to classes. We ran different into 94 +(chunks attached to a type which take an explicit \texttt{self} argument of
88 +issues: 95 +that type) and attributes, that loosely correspond to classes. We ran different
96 +into issues:
89 + 97 +
90 +\begin{itemize} 98 +\begin{itemize}
91 +\item Methods call aren't working; 99 +\item Methods call aren't working;
92 +\item Type dependencies aren't resolved correctly, so they aren't generated in 100 +\item Type dependencies aren't resolved correctly, so they aren't generated in
93 + the right order; 101 + the right order;
94 +\item \texttt{\$\{self\}} is ambiguous, how do you know when it's a scalar or a 102 +\item \texttt{\$\{self\}} is ambiguous, how do you know when it's a scalar or a
95 + method? (this is important to define the init method); 103 + method? (this is important to define the \texttt{init} method);
96 +\item Abstract data types should probably be framed/defined in the language; 104 +\item Abstract data types should probably be framed/defined in the language;
97 +\item Mappings aren't resolved recursively; 105 +\item Mappings aren't resolved recursively;
98 +\item Mappings can't use Rathaxes code in them (e.g: you can't use 106 +\item Mappings can't use \rtx\ code in them (e.g: you can't use
99 + \texttt{\$\{Rathaxes::Type.ref\}} in a mapping definition); 107 + \texttt{\$\{Rathaxes::Type.ref\}} in a mapping definition);
100 +\item Circular dependencies aren't supported (in e1000 the rings and the 108 +\item Circular dependencies aren't supported (in e1000 the rings and the
101 + hardware context are inter-dependant, you can't avoid that); 109 + hardware context are inter-dependant, you can't avoid that);
102 +\item Type injections in upper sub-system (i.e: inject \texttt{e1000::Context} 110 +\item Type injections in upper sub-system (i.e: inject \texttt{e1000::Context}
103 + into \texttt{Ethernet::Device}), that has been implemented with regular 111 + into \texttt{Ethernet::Device}), that has been implemented with regular
105 + not the full structure field). 113 + not the full structure field).
106 +\end{itemize} 114 +\end{itemize}
107 + 115 +
108 +\subsubsection{Error handling} 116 +\subsubsection{Error handling}
109 + 117 +
110 +This has been deliberately left out in Rathaxes 2012 but it seems that the 118 +This has been deliberately left out in \rtx\ 2012 but it seems that the
111 +biggest difficulty is going to define and then inject the error handling code 119 +biggest difficulty is going to define and then inject the error handling code
112 +into the parent chunk/context appropriately. 120 +into the parent chunk/context appropriately.
113 + 121 +
114 +\section{Implementation issues} 122 +\section{Implementation issues}
115 + 123 +
116 +Some bugs are imparing development: 124 +Bugs are impairing development:
117 + 125 +
118 +\begin{itemize} 126 +\begin{itemize}
119 +\item Expansion bugs: 127 +\item Expansion bugs:
120 +\begin{itemize} 128 +\begin{itemize}
121 +\item Obscure expansion issues solved by scoping thigns; 129 +\item Obscure expansion issues solved by scoping things;
122 +\item Variable declarations leaking across different chunks; 130 +\item Variable declarations leaking across different chunks;
123 +\item Chunk/Pointcut parameters not bound to the C variables (the parameters 131 +\item Chunk/Pointcut parameters not bound to the C variables (the parameters
124 + must be named like the C variables are). 132 + must be named like the C variables are).
125 +\end{itemize} 133 +\end{itemize}
126 +\item CNorm issues: it's impossible to use annotation (e.g: \texttt{\_\_init}, 134 +\item CNorm issues: it's impossible to use annotation (e.g: \texttt{\_\_init},
127 + \texttt{\_\_exit}, \texttt{\_\_iomem}, \ldots) or arbitrary typedef'd 135 + \texttt{\_\_exit}, \texttt{\_\_iomem}\ldots) or arbitrary typedef'd
128 + types; 136 + types;
129 +\item Some sequences call aren't working for obscure reasons (e.g: 137 +\item Some sequences call aren't working for obscure reasons (e.g:
130 + \texttt{DMA::unmap}). 138 + \texttt{DMA::unmap}).
131 +\end{itemize} 139 +\end{itemize}
132 + 140 +