[pypy-svn] rev 2162 - in pypy/trunk/doc: devel translation

arigo at codespeak.net arigo at codespeak.net
Tue Nov 4 15:38:52 CET 2003


Author: arigo
Date: Tue Nov  4 15:38:51 2003
New Revision: 2162

Modified:
   pypy/trunk/doc/devel/howtosvn.txt
   pypy/trunk/doc/translation/controlflow.txt
Log:
Changed wording


Modified: pypy/trunk/doc/devel/howtosvn.txt
==============================================================================
--- pypy/trunk/doc/devel/howtosvn.txt	(original)
+++ pypy/trunk/doc/devel/howtosvn.txt	Tue Nov  4 15:38:51 2003
@@ -42,13 +42,13 @@
 
 download the tarball.  unzip and untar it.  Then type *./configure*.  Then, as root, *make* followed by *make install*.  Voilà ... a subversion client.
 
-A Debian package is available from backports_.  If you are using a *stable* Debian, first add the following line to ``/etc/apt/sources.list``::
+For Debian users::
 
-  deb http://fs.cs.fhm.edu/mirror/backports.org/debian stable subversion
+  $ apt-get install subversion-tools
 
-You can then install the package (same command for *testing* and *unstable*)::
+People using Debian *stable* first need to add the following line to ``/etc/apt/sources.list`` (thanks backports_!)::
 
-  $ apt-get install subversion-tools
+  deb http://fs.cs.fhm.edu/mirror/backports.org/debian stable subversion
 
 Note that you can always go look at the files online_ with your browser, located at: http://codespeak.net/svn/pypy/trunk
 But, you'll want to check out your own local copies to work on.

Modified: pypy/trunk/doc/translation/controlflow.txt
==============================================================================
--- pypy/trunk/doc/translation/controlflow.txt	(original)
+++ pypy/trunk/doc/translation/controlflow.txt	Tue Nov  4 15:38:51 2003
@@ -1,3 +1,58 @@
+FlowObjSpace
+============
+
+Introduction
+------------
+
+The FlowObjSpace generates a control-flow graph from a function. This graph also contains a trace of the individual operations, so that it is actually just an alternate representation for the function.
+
+The FlowObjSpace is an object space, which means that it exports the standard object space interface and it is driven by the interpreter.
+
+The basic idea is that if the interpreter is given a function, e.g.::
+
+  def f(n):
+    return 3*n+2
+
+it will do whatever bytecode dispatching and stack-shuffling needed, during which it issues a sequence of calls to the object space.  The FlowObjSpace merely records these calls (corresponding to "operations") in a structure called a basic block.  To track which value goes where, the FlowObjSpace invents placeholder "wrapped objects" and give them to the interpreter, so that they appear in some next operation.
+
+For example, if the placeholder ``v1`` is given as the argument to the above function, the interpreter will call ``v2 = space.mul(space.wrap(3), v1)`` and then ``v3 = space.add(v2, space.wrap(2))`` and return ``v3`` as the result.  During these calls the FlowObjSpace will record a basic block::
+
+  Block(v1):     # input argument
+    v2 = mul(constant(3), v1)
+    v3 = add(v2, constant(2))
+
+
+Joining basic blocks
+--------------------
+
+A basic block ends in one of two cases: when the interpreters calls ``is_true()``, or when a joinpoint is reached.
+
+* A joinpoint is a specially marked position in the bytecode.  This is the only bytecode dependency in FlowObjSpace.  Intuitively, there should be one joinpoint at each bytecode position where two different paths can "join" together, e.g. the entry point of a loop.  A joinpoint forces a basic block to end and the next one to begin.  A snapshot of the current frame is taken (a FrameState) and recorded on the joinpoint.  If the control flow later reaches this point again, we put a "backwards" jump to the old basic block that starts at this point.  (The control flow is actually just a graph, with basic blocks pointing to each other, so there is not really a notion of "backwards".)
+
+* If the interpreter calls ``is_true()``, the FlowObjSpace doesn't generally know if the answer should be True or False, so it puts a conditional jump and generates two successor blocks for the current basic block.  There is some trickery involved so that the interpreter is fooled into thinking that ``is_true()`` first returns False (and the subsequent operations are recorded in the first successor block), and later the *same* call to ``is_true()`` also returns True (and the subsequent operations go this time to the other successor block).
+
+
+Passing variables between basic blocks
+--------------------------------------
+
+XXX
+
+
+FlowExecutionContext
+--------------------
+
+The FlowExecutionContext is a modified ExecutionContext that drives the interpreter in a fashion that is quite different from the one needed for normal interpretation.  XXX
+
+
+Interface
+---------
+
+We make one instance of FlowExecutionContext per function to analyse.  The instance has a cache of FrameStates to detect when the control is looping (``self.joinpoints``).  XXX
+
+
+Old stuff to remove
+-------------------
+
 ::
 
   Hello again


More information about the Pypy-commit mailing list