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

pedronis at codespeak.net pedronis at codespeak.net
Wed Feb 23 15:30:16 CET 2005


Author: pedronis
Date: Wed Feb 23 15:30:16 2005
New Revision: 9455

Added:
   pypy/dist/goal/buildcache2.py   (contents, props changed)
Modified:
   pypy/dist/goal/translate_pypy.py
Log:
start of new cache filling code



Added: pypy/dist/goal/buildcache2.py
==============================================================================
--- (empty file)
+++ pypy/dist/goal/buildcache2.py	Wed Feb 23 15:30:16 2005
@@ -0,0 +1,37 @@
+import autopath
+
+
+def buildcache(space):
+    space.builtin.getdict()
+    print "*builtin*"
+    #w_dic = space.builtin.w_dict
+    #print space.unwrap(space.call_method(w_dic,"keys"))
+    
+    space.sys.getdict()
+    print "*sys*"
+    #w_dic = space.sys.w_dict
+    #print space.unwrap(space.call_method(w_dic,"keys"))
+
+    for typedef in space.model.pythontypes:
+        w_typ = getattr(space, 'w_' + typedef.name)
+        w_typ.getdict()
+
+        print "*%s*" % typedef.name
+        #print w_typ.dict_w.keys()
+
+    space.appexec([],"""():
+    try:
+       raise ValueError
+    except ValueError:
+       pass
+    exec 'pass'    
+""")
+    # freeze caches?
+    print "cache build finished"
+
+if __name__ == '__main__':
+    from pypy.objspace.std.objspace import StdObjSpace
+
+    space = StdObjSpace()
+
+    buildcache(space)

Modified: pypy/dist/goal/translate_pypy.py
==============================================================================
--- pypy/dist/goal/translate_pypy.py	(original)
+++ pypy/dist/goal/translate_pypy.py	Wed Feb 23 15:30:16 2005
@@ -18,6 +18,7 @@
    -no-d    Disable recording of debugging information
 """
 import autopath, sys, threading, pdb, os
+import buildcache2
 from pypy.objspace.std.objspace import StdObjSpace, W_Object
 from pypy.objspace.std.intobject import W_IntObject
 from pypy.translator.translator import Translator
@@ -30,7 +31,6 @@
 from pypy.translator.tool import buildpyxmodule
 buildpyxmodule.enable_fast_compilation()
 
-#from buildcache import buildcache
 # __________  Entry point  __________
 
 def entry_point():
@@ -38,15 +38,16 @@
     w_b = W_IntObject(space, -7)
     return space.mul(w_a, w_b)
 
-
 # __________  Main  __________
 
 def analyse(entry_point=entry_point):
     global t, space
     space = StdObjSpace()
-    # call the entry_point once to trigger building of all 
-    # caches (as far as analyzing the entry_point is concerned) 
-    entry_point() 
+    # call cache filling code
+    buildcache2.buildcache(space)    
+    # further call the entry_point once to trigger building remaining
+    # caches (as far as analyzing the entry_point is concerned)
+    entry_point()
     t = Translator(entry_point, verbose=True, simplifying=True)
     if listen_port:
         run_async_server()



More information about the Pypy-commit mailing list