[pypy-svn] r52832 - in pypy/branch/jit-hotpath/pypy/jit: rainbow/test timeshifter
arigo at codespeak.net
arigo at codespeak.net
Sat Mar 22 17:05:47 CET 2008
Author: arigo
Date: Sat Mar 22 17:05:45 2008
New Revision: 52832
Modified:
pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_llinterp.py
pypy/branch/jit-hotpath/pypy/jit/timeshifter/rdump.py
Log:
Put a smaller number of tests in test_hp_llinterp.
Translation fixes.
Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_llinterp.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_llinterp.py (original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_llinterp.py Sat Mar 22 17:05:45 2008
@@ -2,21 +2,37 @@
import py
from pypy.jit.conftest import option
-from pypy.jit.rainbow.test import test_hotpath, test_hp_promotion
if option.quicktest:
py.test.skip("slow")
-class TestLLInterpreted(test_hotpath.TestHotPath):
- translate_support_code = True
-
- # for the individual tests see
- # ====> test_hotpath.py
-
-
-class TestLLInterpreted(test_hp_promotion.TestHotPromotion):
- translate_support_code = True
-
- # for the individual tests see
- # ====> test_hp_promotion.py
+def llinterp(unbound_method):
+ cls = unbound_method.im_class
+ cls.setup_class.im_func(cls)
+ try:
+ self = cls()
+ self.translate_support_code = True
+ unbound_method(self)
+ finally:
+ cls.teardown_class.im_func(cls)
+
+# ____________________________________________________________
+# it takes ages to run all these tests, and a few of them are more or less
+# enough to pinpoint all the translation issues
+
+def test_simple_loop():
+ from pypy.jit.rainbow.test.test_hotpath import TestHotPath
+ llinterp(TestHotPath.test_simple_loop)
+
+def test_hp_tlr():
+ from pypy.jit.rainbow.test.test_hotpath import TestHotPath
+ llinterp(TestHotPath.test_hp_tlr)
+
+def test_green_across_global_mp():
+ from pypy.jit.rainbow.test.test_hp_promotion import TestHotPromotion
+ llinterp(TestHotPromotion.test_green_across_global_mp)
+
+def test_simple_interpreter_with_frame_with_stack():
+ from pypy.jit.rainbow.test.test_hp_virtualizable import TestVirtualizableImplicit
+ llinterp(TestVirtualizableImplicit.test_simple_interpreter_with_frame_with_stack)
Modified: pypy/branch/jit-hotpath/pypy/jit/timeshifter/rdump.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/timeshifter/rdump.py (original)
+++ pypy/branch/jit-hotpath/pypy/jit/timeshifter/rdump.py Sat Mar 22 17:05:45 2008
@@ -13,6 +13,7 @@
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.jit.timeshifter import rvalue, rcontainer, vlist
from pypy.rlib.objectmodel import compute_unique_id as getid
+from pypy.tool.pairtype import extendabletype
DUMPFILENAME = '%s.dot'
@@ -171,18 +172,7 @@
return 0
id = getid(redbox)
if self.see(id):
- text = "%s\\n" % str(redbox)
- if isinstance(redbox, rvalue.PtrRedBox):
- if redbox.genvar is None and redbox.content is not None:
- text += "virtual"
- else:
- text += self.ptrgenvar(redbox.genvar)
- if redbox.content is not None:
- self.emit_edge(id, self.add_container(redbox.content))
- elif isinstance(redbox, rvalue.DoubleRedBox):
- text += self.doublegenvar(redbox.genvar)
- else:
- text += self.intgenvar(redbox.genvar)
+ text = "%s\\n%s" % (str(redbox), redbox._rdump(id, self))
self.emit_node(id, text)
return id
@@ -191,35 +181,66 @@
return 0
id = getid(container)
if self.see(id):
- text = "%s\\n" % str(container)
-
- if isinstance(container, rcontainer.VirtualContainer):
- # most cases should arrive here, it's not exclusive for
- # the cases below
- self.emit_edge(id, self.add_redbox(container.ownbox),
- color="#808000", weak=True)
-
- if isinstance(container, rcontainer.VirtualStruct):
- text += container.typedesc.name
- fielddescs = container.typedesc.fielddescs
- for i in range(len(container.content_boxes)):
- try:
- name = fielddescs[i].fieldname
- except IndexError:
- name = 'field out of bounds (%d)' % (i,)
- box = container.content_boxes[i]
- self.emit_edge(id, self.add_redbox(box), name)
-
- if isinstance(container, vlist.VirtualList):
- text += 'length %d' % len(container.item_boxes)
- for i in range(len(container.item_boxes)):
- box = container.item_boxes[i]
- self.emit_edge(id, self.add_redbox(box),
- 'item_boxes[%d]' % i)
-
+ text = "%s\\n%s" % (str(container), container._rdump(id, self))
self.emit_node(id, text, fillcolor="#ffff60", color="#808000")
return id
+# We need to avoid using isinstance(x, Cls) because it forces the
+# Classes to be seen by the annotator even if the rest of the code is
+# not using them; then it chokes because they don't have the attributes
+# we are trying to read...
+
+class __extend__(rvalue.RedBox):
+ __metaclass__ = extendabletype
+ def _rdump(self, id, gb):
+ return gb.intgenvar(self.genvar)
+
+class __extend__(rvalue.PtrRedBox):
+ __metaclass__ = extendabletype
+ def _rdump(self, id, gb):
+ if self.content is not None:
+ gb.emit_edge(id, gb.add_container(self.content))
+ if self.genvar is None:
+ return "virtual"
+ return gb.ptrgenvar(self.genvar)
+
+class __extend__(rvalue.DoubleRedBox):
+ __metaclass__ = extendabletype
+ def _rdump(self, id, gb):
+ return gb.doublegenvar(self.genvar)
+
+
+class __extend__(rcontainer.VirtualContainer):
+ __metaclass__ = extendabletype
+ def _rdump(self, id, gb):
+ gb.emit_edge(id, gb.add_redbox(self.ownbox),
+ color="#808000", weak=True)
+ return ''
+
+class __extend__(rcontainer.VirtualStruct):
+ __metaclass__ = extendabletype
+ def _rdump(self, id, gb):
+ rcontainer.VirtualContainer._rdump(self, id, gb)
+ fielddescs = self.typedesc.fielddescs
+ for i in range(len(self.content_boxes)):
+ try:
+ name = fielddescs[i].fieldname
+ except IndexError:
+ name = 'field out of bounds (%d)' % (i,)
+ box = self.content_boxes[i]
+ gb.emit_edge(id, gb.add_redbox(box), name)
+ return self.typedesc.name
+
+class __extend__(vlist.VirtualList):
+ __metaclass__ = extendabletype
+ def _rdump(self, id, gb):
+ rcontainer.VirtualContainer._rdump(self, id, gb)
+ for i in range(len(self.item_boxes)):
+ box = self.item_boxes[i]
+ gb.emit_edge(id, gb.add_redbox(box),
+ 'item_boxes[%d]' % i)
+ return 'length %d' % len(self.item_boxes)
+
# ____________________________________________________________
#
# Public API
More information about the Pypy-commit
mailing list