[pypy-svn] r65847 - in pypy/branch/pyjitpl5/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Sun Jun 21 17:07:20 CEST 2009


Author: arigo
Date: Sun Jun 21 17:07:18 2009
New Revision: 65847

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/heaptracker.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py
Log:
Move testing stuff around.


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/heaptracker.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/heaptracker.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/heaptracker.py	Sun Jun 21 17:07:18 2009
@@ -76,9 +76,14 @@
             cache[rinstance.lowleveltype.TO] = rinstance.rclass.getvtable()
         cpu._cache_gcstruct2vtable = cache
 
-def set_testing_vtable_for_gcstruct(GCSTRUCT, vtable):
+def set_testing_vtable_for_gcstruct(GCSTRUCT, vtable, name):
     # only for tests that need to register the vtable of their malloc'ed
     # structures in case they are GcStruct inheriting from OBJECT.
+    namez = name + '\x00'
+    vtable.name = lltype.malloc(rclass.OBJECT_VTABLE.name.TO, len(namez),
+                                immortal=True)
+    for i in range(len(namez)):
+        vtable.name[i] = namez[i]
     testing_gcstruct2vtable[GCSTRUCT] = vtable
 
 def populate_type_cache(graphs, cpu):

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py	Sun Jun 21 17:07:18 2009
@@ -35,11 +35,7 @@
 XY._adtmeths['access'].initialize(XY, ['inst_x', 'inst_node', 'inst_l'])
 
 xy_vtable = lltype.malloc(rclass.OBJECT_VTABLE, immortal=True)
-xy_vtable.name = lltype.malloc(rclass.OBJECT_VTABLE.name.TO, 3, immortal=True)
-xy_vtable.name[0] = 'X'
-xy_vtable.name[1] = 'Y'
-xy_vtable.name[2] = '\x00'
-heaptracker.set_testing_vtable_for_gcstruct(XY, xy_vtable)
+heaptracker.set_testing_vtable_for_gcstruct(XY, xy_vtable, 'XY')
 
 XYSUB = lltype.GcStruct(
     'XYSUB',
@@ -50,15 +46,7 @@
 XYSUB._adtmeths['access'].initialize(XYSUB, ['z'], PARENT=XY)
 
 xysub_vtable = lltype.malloc(rclass.OBJECT_VTABLE, immortal=True)
-xysub_vtable.name = lltype.malloc(rclass.OBJECT_VTABLE.name.TO, 6,
-                                  immortal=True)
-xysub_vtable.name[0] = 'X'
-xysub_vtable.name[1] = 'Y'
-xysub_vtable.name[2] = 'S'
-xysub_vtable.name[3] = 'U'
-xysub_vtable.name[4] = 'B'
-xysub_vtable.name[5] = '\x00'
-heaptracker.set_testing_vtable_for_gcstruct(XYSUB, xysub_vtable)
+heaptracker.set_testing_vtable_for_gcstruct(XYSUB, xysub_vtable, 'XYSUB')
 
 # ____________________________________________________________
 

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py	Sun Jun 21 17:07:18 2009
@@ -318,7 +318,7 @@
                                  ('extra', lltype.Signed))
 
 vtable2 = lltype.malloc(rclass.OBJECT_VTABLE, immortal=True)
-heaptracker.set_testing_vtable_for_gcstruct(NODE2, vtable2)
+heaptracker.set_testing_vtable_for_gcstruct(NODE2, vtable2, 'NODE2')
 
 class TestLLtype_Object(VirtualTests, LLJitMixin):
     _new_op = 'new_with_vtable'



More information about the Pypy-commit mailing list