[pypy-svn] rev 1437 - pypy/trunk/doc/translation

tismer at codespeak.net tismer at codespeak.net
Mon Sep 29 15:23:58 CEST 2003


Author: tismer
Date: Mon Sep 29 15:23:58 2003
New Revision: 1437

Added:
   pypy/trunk/doc/translation/controlflow.txt
      - copied unchanged from rev 1436, pypy/trunk/doc/translation/controlflow.asc
Removed:
   pypy/trunk/doc/translation/controlflow.asc
Log:
renamed to .txt, since it now works as ReST

Deleted: /pypy/trunk/doc/translation/controlflow.asc
==============================================================================
--- /pypy/trunk/doc/translation/controlflow.asc	Mon Sep 29 15:23:58 2003
+++ (empty file)
@@ -1,107 +0,0 @@
-::
-
-  Hello again
-  
-                             def f(i):
-                                 return g(i)+2
-                             def g(i):
-                                 return i+1
-  
-  f(3)
-  tspace:
-  pyxcode.putln('def f(%s):' % sig)
-  res = frame.eval(executioncontext)
-  pyxcode.putln('return %s' % res)
-  
-  
-  Pyrex: def f(v1):
-  dis.dis(f) -->
-   2            0 LOAD_GLOBAL              0 (g)
-                 w_result =  space.getitem(f.w_globals, w_varname)
-  
-                3 LOAD_FAST                0 (i)
-                6 CALL_FUNCTION            1
-  space.call(w_function, w_arguments, w_kwds)
-  space.call(w_g, ("v1",), {})
-  Pyrex: v2 = g(v1)
-                9 LOAD_CONST               1 (2)
-  space.wrap(2)
-               12 BINARY_ADD
-  space.add("v2", "constant 2")
-  Pyrex: v3 = v2 + 2
-               13 RETURN_VALUE
-               14 LOAD_CONST               0 (None)
-               17 RETURN_VALUE
-  Pyrex: return v3
-  
-  
-  Result:
-  def f(v1):
-    v2 = g(v1)
-    v3 = v2 + 2
-    return v3
-  
-  
-  def h(i, j):
-    if i < 0:
-      i = j
-    return i+1
-  
-  Pyrex: def h(v1, v2):
-  --> interpreter
-    3           0 LOAD_FAST                0 (i)
-                3 LOAD_CONST               1 (0)
-                6 COMPARE_OP               0 (<)
-  "v3" = space.lt("v1", "constant 0")
-  Pyrex: v3 = v1 < 0
-                9 JUMP_IF_FALSE           10 (to 22)
-  space.is_true("v3")
-  Pyrex: if v3: cinline "goto Label1;"
-               12 POP_TOP
-  
-    4          13 LOAD_FAST                1 (j)
-               16 STORE_FAST               0 (i)
-               19 JUMP_FORWARD             1 (to 23)
-          >>   22 POP_TOP
-  
-  Pyrex: cinline "LabelBytecode23:"   # just in case for later
-    5     >>   23 LOAD_FAST                0 (i)
-               26 LOAD_CONST               2 (1)
-               29 BINARY_ADD
-  space.add("v1", "constant 2")
-  Pyrex: v4 = v1 + 2
-               30 RETURN_VALUE
-               31 LOAD_CONST               0 (None)
-               34 RETURN_VALUE
-  Pyrex: return v4
-  
-  pyrex: cinline "Label1:"
-               12 POP_TOP
-  
-    4          13 LOAD_FAST                1 (j)
-               16 STORE_FAST               0 (i)
-  (in the interpreter fastlocals now: i="v2" j="v2")
-               19 JUMP_FORWARD             1 (to 23)
-          >>   22 POP_TOP
-  
-  (bytecode 23 already seen!)
-  Pyrex: v1 = v2
-  Pyrex: cinline "goto LabelBytecode23;"
-    5     >>   23 LOAD_FAST                0 (i)
-  
-  def h(i, j):
-    if i < 0:
-      i = j
-    return i+1
-  
-  def h(v1, v2):
-      v3 = v1 < 0
-      if v3: cinline "goto label1;"
-  
-      cinline "labelBytecode23:"
-      v4=v1+1
-      return v4
-      cinline "label1:"
-      v1=v2
-      cinline "goto labelBytecode23;"
-  


More information about the Pypy-commit mailing list