[pypy-svn] r74939 - in pypy/branch/blackhole-improvement/pypy/jit/codewriter: . test

arigo at codespeak.net arigo at codespeak.net
Sun May 30 23:03:32 CEST 2010


Author: arigo
Date: Sun May 30 23:03:31 2010
New Revision: 74939

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/codewriter/jtransform.py
   pypy/branch/blackhole-improvement/pypy/jit/codewriter/test/test_jtransform.py
Log:
Update the test along with the reason for it as comment.
Fix.


Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/jtransform.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/jtransform.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/jtransform.py	Sun May 30 23:03:31 2010
@@ -275,14 +275,14 @@
         else: raise AssertionError(kind)
         lst.append(v)
 
-    def handle_residual_call(self, op, extraargs=[]):
+    def handle_residual_call(self, op, extraargs=[], may_call_jitcodes=False):
         """A direct_call turns into the operation 'residual_call_xxx' if it
         is calling a function that we don't want to JIT.  The initial args
         of 'residual_call_xxx' are the function to call, and its calldescr."""
         calldescr = self.callcontrol.getcalldescr(op)
         op1 = self.rewrite_call(op, 'residual_call',
                                 [op.args[0], calldescr] + extraargs)
-        if self.callcontrol.calldescr_canraise(calldescr):
+        if may_call_jitcodes or self.callcontrol.calldescr_canraise(calldescr):
             op1 = [op1, SpaceOperation('-live-', [], None)]
         return op1
 
@@ -338,7 +338,7 @@
             lst.append(jitcode)
         op0 = SpaceOperation('-live-', [], None)
         op1 = SpaceOperation('int_guard_value', [op.args[0]], None)
-        op2 = self.handle_residual_call(op, [IndirectCallTargets(lst)])
+        op2 = self.handle_residual_call(op, [IndirectCallTargets(lst)], True)
         result = [op0, op1]
         if isinstance(op2, list):
             result += op2

Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/test/test_jtransform.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/test/test_jtransform.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/test/test_jtransform.py	Sun May 30 23:03:31 2010
@@ -65,7 +65,7 @@
         assert graph in ('somegraph1', 'somegraph2')
         return 'somejitcode' + graph[-1]
     def calldescr_canraise(self, calldescr):
-        return True
+        return False
 
 
 def test_optimize_goto_if_not():
@@ -325,6 +325,9 @@
     for v in op.args[1:]:
         kind = getkind(v.concretetype)
         assert kind == 'void' or kind[0] in expectedkind
+    # Note: we still expect a -live- here, even though canraise() returns
+    # False, because this 'residual_call' will likely call further jitcodes
+    # which can do e.g. guard_class or other stuff requiring anyway a -live-.
     assert op1.opname == '-live-'
     assert op1.args == []
 



More information about the Pypy-commit mailing list