[pypy-svn] r9627 - pypy/dist/goal

arigo at codespeak.net arigo at codespeak.net
Fri Mar 4 14:52:28 CET 2005


Author: arigo
Date: Fri Mar  4 14:52:28 2005
New Revision: 9627

Added:
   pypy/dist/goal/translate_pypy1.py
      - copied, changed from r9623, pypy/dist/goal/translate_pypy.py
Log:
A modified version of the goal, which calls the 'mul' multimethod 
directly, instead of going through DescrOperation.  This allows the 
annotation to "drag in" only a small part of PyPy, so it terminates 
(successfully!) in only 15-20 seconds.



Copied: pypy/dist/goal/translate_pypy1.py (from r9623, pypy/dist/goal/translate_pypy.py)
==============================================================================
--- pypy/dist/goal/translate_pypy.py	(original)
+++ pypy/dist/goal/translate_pypy1.py	Fri Mar  4 14:52:28 2005
@@ -21,6 +21,7 @@
 import buildcache2
 from pypy.objspace.std.objspace import StdObjSpace, W_Object
 from pypy.objspace.std.intobject import W_IntObject
+from pypy.objspace.std import stdtypedef
 from pypy.translator.translator import Translator
 from pypy.annotation import model as annmodel
 from pypy.tool.cache import Cache
@@ -36,17 +37,29 @@
 def entry_point():
     w_a = W_IntObject(space, -6)
     w_b = W_IntObject(space, -7)
-    return space.mul(w_a, w_b)
+    return mmentrypoint(space, w_a, w_b)
 
 # __________  Main  __________
 
 def analyse(entry_point=entry_point):
-    global t, space
+    global t, space, mmentrypoint
     # disable translation of the whole of classobjinterp.py
     StdObjSpace.setup_old_style_classes = lambda self: None
     space = StdObjSpace()
     # call cache filling code
-    buildcache2.buildcache(space)    
+    buildcache2.buildcache(space)
+
+    # ------------------------------------------------------------
+    name = 'mul'
+    mm = space.MM.mul
+    exprargs, expr, miniglobals, fallback = (
+        mm.install_not_sliced(space.model.typeorder, baked_perform_call=False))
+    func = stdtypedef.make_perform_trampoline('__mm_'+name,
+                                              exprargs, expr, miniglobals,
+                                              mm)
+    mmentrypoint = func
+    # ------------------------------------------------------------
+
     # further call the entry_point once to trigger building remaining
     # caches (as far as analyzing the entry_point is concerned)
     entry_point()



More information about the Pypy-commit mailing list