[pypy-svn] r77297 - pypy/branch/jit-str/pypy/jit/codewriter

arigo at codespeak.net arigo at codespeak.net
Thu Sep 23 13:49:53 CEST 2010


Author: arigo
Date: Thu Sep 23 13:49:51 2010
New Revision: 77297

Modified:
   pypy/branch/jit-str/pypy/jit/codewriter/effectinfo.py
   pypy/branch/jit-str/pypy/jit/codewriter/jtransform.py
Log:
Fix for tests.  Raise AssertionError in translated tests if this
is ever hit.


Modified: pypy/branch/jit-str/pypy/jit/codewriter/effectinfo.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/codewriter/effectinfo.py	(original)
+++ pypy/branch/jit-str/pypy/jit/codewriter/effectinfo.py	Thu Sep 23 13:49:51 2010
@@ -126,10 +126,15 @@
 
 _callinfo_for_oopspec = {}
 
+def callinfo_for_oopspec_memo(oopspecindex):
+    return _callinfo_for_oopspec.get(oopspecindex, (None, 0))
+callinfo_for_oopspec_memo._annspecialcase_ = 'specialize:memo'
+
 def callinfo_for_oopspec(oopspecindex):
     """A memo function that returns the calldescr and the function
     address (as an int) of one of the OS_XYZ functions defined above.
     Don't use this if there might be several implementations of the same
     OS_XYZ specialized by type, e.g. OS_ARRAYCOPY."""
-    return _callinfo_for_oopspec.get(oopspecindex, (None, 0))
-callinfo_for_oopspec._annspecialcase_ = 'specialize:memo'
+    calldescr, func = callinfo_for_oopspec_memo(oopspecindex)
+    assert calldescr is not None
+    return calldescr, func

Modified: pypy/branch/jit-str/pypy/jit/codewriter/jtransform.py
==============================================================================
--- pypy/branch/jit-str/pypy/jit/codewriter/jtransform.py	(original)
+++ pypy/branch/jit-str/pypy/jit/codewriter/jtransform.py	Thu Sep 23 13:49:51 2010
@@ -1029,8 +1029,12 @@
 
     def _handle_oopspec_call(self, op, args, oopspecindex):
         calldescr = self.callcontrol.getcalldescr(op, oopspecindex)
-        func = heaptracker.adr2int(llmemory.cast_ptr_to_adr(op.args[0].value))
-        _callinfo_for_oopspec[oopspecindex] = calldescr, func
+        if isinstance(op.args[0].value, str):
+            pass  # for tests only
+        else:
+            func = heaptracker.adr2int(
+                llmemory.cast_ptr_to_adr(op.args[0].value))
+            _callinfo_for_oopspec[oopspecindex] = calldescr, func
         op1 = self.rewrite_call(op, 'residual_call',
                                 [op.args[0], calldescr],
                                 args=args)



More information about the Pypy-commit mailing list