[pypy-commit] extradoc extradoc: merge

hakanardo noreply at buildbot.pypy.org
Fri Aug 10 22:25:38 CEST 2012


Author: Hakan Ardo <hakan at debian.org>
Branch: extradoc
Changeset: r4513:dd366fa6417d
Date: 2012-08-10 22:25 +0200
http://bitbucket.org/pypy/extradoc/changeset/dd366fa6417d/

Log:	merge

diff --git a/talk/vmil2012/figures/example.tex b/talk/vmil2012/figures/example.tex
--- a/talk/vmil2012/figures/example.tex
+++ b/talk/vmil2012/figures/example.tex
@@ -10,11 +10,11 @@
             return Odd(n)
 
 class Odd(Base):
-    def f(self):
+    def step(self):
         return Even(self.value * 3 + 1)
 
 class Even(Base):
-    def f(self):
+    def step(self):
         n = self.value >> 2
         if n == 1:
             return None
@@ -26,6 +26,6 @@
         j += 1
         if a is None:
             return True
-        a = a.f()
+        a = a.step()
     return False
 \end{lstlisting}
diff --git a/talk/vmil2012/figures/unopt-log.tex b/talk/vmil2012/figures/unopt-log.tex
new file mode 100644
--- /dev/null
+++ b/talk/vmil2012/figures/unopt-log.tex
@@ -0,0 +1,18 @@
+\begin{lstlisting}[mathescape, numbers=right, escapechar=|, firstnumber=-1]
+[$j_1$, $a_1$]                              |\setcounter{lstnumber}{24}|
+$j_2$ = int_add($j_1$, 1)                   |\setcounter{lstnumber}{25}|
+guard_nonnull($a_1$)                        |\setcounter{lstnumber}{27}|
+guard_class($a_1$, Even)                    |\setcounter{lstnumber}{16}|
+$i_1$ = getfield_gc($a_1$, descr='value')   |\setcounter{lstnumber}{16}|
+$i_2$ = int_rshift($i_1$, 2)                |\setcounter{lstnumber}{17}|
+$b_1$ = int_eq($i_2$, 1)                    |\setcounter{lstnumber}{17}|
+guard_false($b_1$)                          |\setcounter{lstnumber}{5}|
+$i_3$ = int_and($i_2$, 1)                   |\setcounter{lstnumber}{5}|
+$i_4$ = int_is_zero($i_3$)                  |\setcounter{lstnumber}{5}|
+guard_true($i_4$)                           |\setcounter{lstnumber}{6}|
+$a_2$ = new(Even)                           |\setcounter{lstnumber}{2}|
+setfield_gc($a_2$, descr='value')           |\setcounter{lstnumber}{23}|
+$b_2$ = int_lt($j_2$, 100)                  |\setcounter{lstnumber}{23}|
+guard_true($b_2$)                           |\setcounter{lstnumber}{-2}|
+jump($j_2$, $a_2$)
+\end{lstlisting}
diff --git a/talk/vmil2012/paper.tex b/talk/vmil2012/paper.tex
--- a/talk/vmil2012/paper.tex
+++ b/talk/vmil2012/paper.tex
@@ -262,13 +262,24 @@
 approach is called \emph{meta-tracing}. For the purpose of this paper the fact
 that RPython's tracing JIT is a meta-tracing JIT can be ignored.
 
-\todo{explain example}
-%___________________________________________________________________________
-
 \begin{figure}
     \input{figures/example.tex}
     \caption{Example Program}
-    \label{fig:trace-log}
+    \label{fig:example}
+\end{figure}
+
+Figure~\ref{fig:example} shows an example RPython function that checks
+whether a number reduces to 1 with less than 100 steps of the Collatz process.
+It uses an \lstinline{Even} and an \lstinline{Odd} class to box the numbers, to
+make the example more interesting. If the loop in \lstinline{check_reduces} is
+traced when \lstinline{a} is a multiple of four, the unoptimized
+trace looks like in Figure~\ref{fig:unopt-trace}. The line numbers in the trace
+correspond to the line numbers in Figure~\ref{fig:trace-log}.
+
+\begin{figure}
+    \input{figures/unopt-log.tex}
+    \caption{Unoptimized trace}
+    \label{fig:unopt-trace}
 \end{figure}
 
 \section{Guards in the Frontend} %{Resume Data}


More information about the pypy-commit mailing list