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