[pypy-svn] extradoc extradoc: add line numbers to the trace about where the operations originate from

cfbolz commits-noreply at bitbucket.org
Fri Mar 25 23:57:08 CET 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: extradoc
Changeset: r3410:a12221c2727a
Date: 2011-03-25 23:56 +0100
http://bitbucket.org/pypy/extradoc/changeset/a12221c2727a/

Log:	add line numbers to the trace about where the operations originate
	from

diff --git a/talk/icooolps2011/paper.tex b/talk/icooolps2011/paper.tex
--- a/talk/icooolps2011/paper.tex
+++ b/talk/icooolps2011/paper.tex
@@ -324,7 +324,10 @@
 
 The trace would look like in Figure~\ref{fig:trace1}. In this example, the
 attribute \texttt{a} is found on the instance, but the
-attributes \texttt{b} and \texttt{c} are found on the class. The trace indeed contains
+attributes \texttt{b} and \texttt{c} are found on the class. The numbers line
+numbers in the trace correspond to the line numbers in
+Figure~\ref{fig:interpreter-slow} where the traced operations come from. The
+trace indeed contains
 five calls to \texttt{dict.get}, which is slow. To make the language efficient
 using a tracing JIT, we need to find a way to get rid of these dictionary
 lookups somehow. How to achieve this will be topic of

diff --git a/talk/icooolps2011/code/trace1.tex b/talk/icooolps2011/code/trace1.tex
--- a/talk/icooolps2011/code/trace1.tex
+++ b/talk/icooolps2011/code/trace1.tex
@@ -1,33 +1,28 @@
-\begin{lstlisting}[mathescape,basicstyle=\ttfamily]
-# inst.getattr("a")
-# inside Instance.getfield
-$attributes_1$ = inst.attributes
-$result_1$ = dict.get($attributes_1$, "a")
-guard($result_1$ is not None)
+\begin{lstlisting}[mathescape,xleftmargin=20pt,numberblanklines=false,numbers=right,escapechar=|, firstnumber=27,basicstyle=\ttfamily]
+# inst.getattr("a")                         |\setcounter{lstnumber}{21}|
+$attributes_1$ = inst.attributes            |\setcounter{lstnumber}{21}|
+$result_1$ = dict.get($attributes_1$, "a")  |\setcounter{lstnumber}{28}|
+guard($result_1$ is not None)               |\setcounter{lstnumber}{25}|
 
-# inst.getattr("b")
-# inside Instance.getfield
-$attributes_2$ = inst.attributes
-$v_1$ = dict.get($attributes_2$, "b")
-guard($v_1$ is None)
-# inside Class.find_method
-$cls_1$ = inst.cls
-$methods_1$ = cls.methods
-$result_2$ = dict.get($methods_1$, "b")
-guard($result_2$ is not None)
-$v_2$ = $result_1$ + $result_2$
+# inst.getattr("b")                         |\setcounter{lstnumber}{21}|
+$attributes_2$ = inst.attributes            |\setcounter{lstnumber}{21}|
+$v_1$ = dict.get($attributes_2$, "b")       |\setcounter{lstnumber}{28}|
+guard($v_1$ is None)                        |\setcounter{lstnumber}{29}|
+$cls_1$ = inst.cls                          |\setcounter{lstnumber}{9}|
+$methods_1$ = cls.methods                   |\setcounter{lstnumber}{9}|
+$result_2$ = dict.get($methods_1$, "b")     |\setcounter{lstnumber}{30}|
+guard($result_2$ is not None)               |\setcounter{lstnumber}{-2}|
+$v_2$ = $result_1$ + $result_2$             |\setcounter{lstnumber}{25}|
 
-# inst.getattr("c")
-# inside Instance.getfield
-$attributes_3$ = inst.attributes
-$v_3$ = dict.get($attributes_3$, "c")
-guard($v_3$ is None)
-# inside Class.find_method
-$cls_1$ = inst.cls
-$methods_2$ = cls.methods
-$result_3$ = dict.get($methods_2$, "c")
-guard($result_3$ is not None)
+# inst.getattr("c")                         |\setcounter{lstnumber}{21}|
+$attributes_3$ = inst.attributes            |\setcounter{lstnumber}{21}|
+$v_3$ = dict.get($attributes_3$, "c")       |\setcounter{lstnumber}{28}|
+guard($v_3$ is None)                        |\setcounter{lstnumber}{29}|
+$cls_1$ = inst.cls                          |\setcounter{lstnumber}{9}|
+$methods_2$ = cls.methods                   |\setcounter{lstnumber}{9}|
+$result_3$ = dict.get($methods_2$, "c")     |\setcounter{lstnumber}{30}|
+guard($result_3$ is not None)               |\setcounter{lstnumber}{-3}|
 
-$v_4$ = $v_2$ + $result_3$
+$v_4$ = $v_2$ + $result_3$                  |\setcounter{lstnumber}{-2}|
 return($v_4$)
-\end{lstlisting}
+\end{lstlisting} % XXX find out how to not number lines


More information about the Pypy-commit mailing list