[pypy-svn] r27054 - in pypy/dist/pypy/rpython: . lltypesystem/test

arigo at codespeak.net arigo at codespeak.net
Wed May 10 21:29:52 CEST 2006


Author: arigo
Date: Wed May 10 21:29:51 2006
New Revision: 27054

Modified:
   pypy/dist/pypy/rpython/llinterp.py
   pypy/dist/pypy/rpython/lltypesystem/test/test_rtagged.py
Log:
Finished writing this test.


Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Wed May 10 21:29:51 2006
@@ -52,9 +52,10 @@
             self.gc = heap.prepare_graphs_and_create_gc(self, flowgraphs)
         if self.TRACING:
             self.tracer = Tracer()
+        self.frame_class = LLFrame
 
     def eval_graph(self, graph, args=()):
-        llframe = LLFrame(graph, args, self)
+        llframe = self.frame_class(graph, args, self)
         if self.tracer:
             self.tracer.start()
         retval = None
@@ -133,7 +134,7 @@
         import exceptions
         klass, inst = exc.args[0], exc.args[1]
         exdata = self.typer.getexceptiondata()
-        frame = LLFrame(None, [], self)
+        frame = self.frame_class(None, [], self)
         old_active_frame = self.active_frame
         try:
             for cls in exceptions.__dict__.values():

Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_rtagged.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_rtagged.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_rtagged.py	Wed May 10 21:29:51 2006
@@ -160,9 +160,17 @@
         else:
             x = C(n)
         return x.meth(100)
-    interp, graph = get_interpreter(fn, [1000])
+    interp, graph = get_interpreter(fn, [-1000])
+
     t = interp.typer.annotator.translator
     backend_optimizations(t, propagate=True)
     if conftest.option.view:
         t.view()
-    # XXX finish writing this test
+
+    LLFrame = interp.frame_class
+    class MyFrame(LLFrame):
+        def op_indirect_call(self, f, *args):
+            raise AssertionError("this call should be optimized away")
+    interp.frame_class = MyFrame
+    res = interp.eval_graph(graph, [-1000])
+    assert res == -897



More information about the Pypy-commit mailing list