[pypy-svn] r35996 - in pypy/dist/pypy: doc translator/llvm

pedronis at codespeak.net pedronis at codespeak.net
Wed Dec 27 14:58:22 CET 2006

Author: pedronis
Date: Wed Dec 27 14:58:19 2006
New Revision: 35996


Modified: pypy/dist/pypy/doc/jit.txt
--- pypy/dist/pypy/doc/jit.txt	(original)
+++ pypy/dist/pypy/doc/jit.txt	Wed Dec 27 14:58:19 2006
@@ -615,7 +615,55 @@
 Calls and inlining
-...green call... red call and inlining effect... gray call, yellow call...
+For calls timeshifting can either produce code to generate a residual
+call operation or recursively invoke the timeshifted version of the
+callee.  The residual operations generated by the timeshifted callee
+will grow the compile-time produced residual function, this
+effectively amounts to compile-time inlining the original callee into
+its caller.
+Again timeshifting determines how to transform call operations based on
+the color of arguments and result:
+* If all arguments and the result are green and we can detect the called
+  function not to have side-effects, the call is a so-called *green call*,
+  and will be left untouched which means there will be a call executed
+  at compile-time. 
+* Calls to function that have no return value (i.e. their return type
+  is the low-level type Void), are assumed to have side-effects, they
+  are *gray calls*.
+* Calls with a green result but with side-effects are so-called *yellow calls*.
+* Calls with a red result are *red calls*
+The treatment of *red*, *gray* and *yellow* calls is similar,
+timeshifting will transform them into calls to the timeshifted version
+of the callee, resulting into an inlining-effect at compile time.
+At compile-time the JIT state contains a chain of virtual frames
+(similar to `virtual structures`_), its top frame is updated with all
+the red boxes for the call-point red variables before such calls and
+the callee will attach a fresh new frame. This chain guarantees that
+values (represented by the boxes) are propagated correctly,
+accordingly split points duplicate and merge points treat the full
+chain properly.
+Each timeshifted function has its own dispatch logic for splits, it
+returns to the caller when all the split scheduled states have been
+dealt with. A list of all the states that reached the return of the
+function (there can be more than one) is returned to the caller which
+then schedules these states on its dispatch queue. This is crucial for
+yellow calls to keep the various green return values disjunct.
+What we have described applies to direct calls where the callee is a
+constant function. For indirect calls, where the callee is a variable
+it is checked whether the callee is constant at compile-time in which
+case a mapping between the pointers to the original functions and
+their timeshifted versions is used to call the appropriate timeshifted
+callee as for a direct call. If the exact callee is unknown a residual
+call operation is generated.
 Virtual structures

Modified: pypy/dist/pypy/translator/llvm/externs2ll.py
--- pypy/dist/pypy/translator/llvm/externs2ll.py	(original)
+++ pypy/dist/pypy/translator/llvm/externs2ll.py	Wed Dec 27 14:58:19 2006
@@ -36,7 +36,7 @@
     plain = filename[:-2]
     includes = get_incdirs()
-    cmd = "llvm-gcc %s -S %s.c -o %s.ll 2>&1" % (includes,
+    cmd = "llvm-gcc %s -emit-llvm -S %s.c -o %s.ll 2>&1" % (includes,
@@ -64,7 +64,7 @@
         line = line.rstrip()
         # find function names, declare them with the default calling convertion
-        if line[-1:] == '{':
+        if line[-3:] == ') {':
            returntype, s = line.split(' ', 1)
            funcname  , s = s.split('(', 1)
            funcnames[funcname] = True

Modified: pypy/dist/pypy/translator/llvm/gc.py
--- pypy/dist/pypy/translator/llvm/gc.py	(original)
+++ pypy/dist/pypy/translator/llvm/gc.py	Wed Dec 27 14:58:19 2006
@@ -6,6 +6,7 @@
 log = log.gc
 def have_boehm():
+    return True
     import distutils.sysconfig
     from os.path import exists
     libdir = distutils.sysconfig.EXEC_PREFIX + "/lib"  

More information about the Pypy-commit mailing list