[pypy-svn] r47477 - pypy/dist/pypy/rpython/memory/gctransform

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Oct 15 21:39:06 CEST 2007


Author: cfbolz
Date: Mon Oct 15 21:39:03 2007
New Revision: 47477

Added:
   pypy/dist/pypy/rpython/memory/gctransform/log.py
Modified:
   pypy/dist/pypy/rpython/memory/gctransform/framework.py
Log:
write out some statistics about number of typeids, roots and push/pops


Modified: pypy/dist/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform/framework.py	Mon Oct 15 21:39:03 2007
@@ -14,6 +14,7 @@
 from pypy.rpython.rbuiltin import gen_cast
 from pypy.rpython.memory.gctypelayout import ll_weakref_deref, WEAKREF
 from pypy.rpython.memory.gctypelayout import convert_weakref_to, WEAKREFPTR
+from pypy.rpython.memory.gctransform.log import log
 from pypy.tool.sourcetools import func_with_new_name
 import sys
 
@@ -119,6 +120,7 @@
 
         StackRootIterator = self.build_stack_root_iterator()
         gcdata.gc = GCClass(AddressLinkedList, get_roots=StackRootIterator, **GC_PARAMS)
+        self.num_pushs = 0
 
         def frameworkgc_setup():
             # run-time initialization code
@@ -364,6 +366,9 @@
 
     def finish_tables(self):
         table = self.layoutbuilder.flatten_table()
+        log.info("assigned %s typeids" % (len(table), ))
+        log.info("added %s push/pop stack root instructions" % (
+                     self.num_pushs, ))
 
         # replace the type_info_table pointer in gcdata -- at this point,
         # the database is in principle complete, so it has already seen
@@ -383,6 +388,7 @@
         #self.gcdata.type_info_table = table
 
         addresses_of_static_ptrs = self.layoutbuilder.addresses_of_static_ptrs
+        log.info("found %s static roots" % (len(addresses_of_static_ptrs), ))
         ll_static_roots_inside = lltype.malloc(lltype.Array(llmemory.Address),
                                                len(addresses_of_static_ptrs),
                                                immortal=True)
@@ -565,6 +571,7 @@
         if self.incr_stack_ptr is None:
             return
         livevars = [var for var in self.livevars if not var_ispyobj(var)]
+        self.num_pushs += len(livevars)
         if not livevars:
             return
         c_len = rmodel.inputconst(lltype.Signed, len(livevars) )

Added: pypy/dist/pypy/rpython/memory/gctransform/log.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rpython/memory/gctransform/log.py	Mon Oct 15 21:39:03 2007
@@ -0,0 +1,4 @@
+import py
+from pypy.tool.ansi_print import ansi_log
+log = py.log.Producer("gctransform")
+py.log.setconsumer("gctransform", ansi_log)



More information about the Pypy-commit mailing list