[pypy-svn] r72854 - pypy/branch/kill-asm-call/pypy/jit/backend/llsupport

fijal at codespeak.net fijal at codespeak.net
Thu Mar 25 22:25:06 CET 2010


Author: fijal
Date: Thu Mar 25 22:25:05 2010
New Revision: 72854

Modified:
   pypy/branch/kill-asm-call/pypy/jit/backend/llsupport/descr.py
   pypy/branch/kill-asm-call/pypy/jit/backend/llsupport/llmodel.py
Log:
Pass rtyper arg and use maybe_on_top_of_llinterp


Modified: pypy/branch/kill-asm-call/pypy/jit/backend/llsupport/descr.py
==============================================================================
--- pypy/branch/kill-asm-call/pypy/jit/backend/llsupport/descr.py	(original)
+++ pypy/branch/kill-asm-call/pypy/jit/backend/llsupport/descr.py	Thu Mar 25 22:25:05 2010
@@ -3,7 +3,7 @@
 from pypy.jit.backend.llsupport import symbolic
 from pypy.jit.metainterp.history import AbstractDescr, getkind, BoxInt, BoxPtr
 from pypy.jit.metainterp.history import BasicFailDescr, LoopToken, BoxFloat
-from pypy.jit.metainterp import history
+from pypy.jit.metainterp import history, support
 from pypy.jit.metainterp.resoperation import ResOperation, rop
 
 # The point of the class organization in this file is to make instances
@@ -13,8 +13,9 @@
 
 
 class GcCache(object):
-    def __init__(self, translate_support_code):
+    def __init__(self, translate_support_code, rtyper=None):
         self.translate_support_code = translate_support_code
+        self.rtyper = rtyper
         self._cache_size = {}
         self._cache_field = {}
         self._cache_array = {}
@@ -217,7 +218,7 @@
     def get_call_stub(self):
         return self.call_stub
 
-    def create_call_stub(self, FUNC):
+    def create_call_stub(self, rtyper, FUNC):
         def process(no, c):
             if c == 'i':
                 return 'lltype.cast_primitive(FUNC.ARGS[%d], args[%d].getint())' % (no - 1, no)
@@ -242,14 +243,11 @@
         source = py.code.Source("""
         def call_stub(args):
             ll_callable = rffi.cast(lltype.Ptr(FUNC), args[0].getint())
-            res = ll_callable(%(args)s)
+            res = support.maybe_on_top_of_llinterp(rtyper, ll_callable)(%(args)s)
             return %(result)s
         """ % locals())
         d = locals().copy()
-        d['lltype'] = lltype
-        d['rffi'] = rffi
-        d['history'] = history
-        d['llmemory'] = llmemory
+        d.update(globals())
         exec source.compile() in d
         self.call_stub = d['call_stub']
 
@@ -297,7 +295,7 @@
         return cache[key]
     except KeyError:
         calldescr = cls(arg_classes, extrainfo)
-        calldescr.create_call_stub(lltype.FuncType(ARGS, RESULT))
+        calldescr.create_call_stub(gccache.rtyper, lltype.FuncType(ARGS, RESULT))
         cache[key] = calldescr
         return calldescr
 

Modified: pypy/branch/kill-asm-call/pypy/jit/backend/llsupport/llmodel.py
==============================================================================
--- pypy/branch/kill-asm-call/pypy/jit/backend/llsupport/llmodel.py	(original)
+++ pypy/branch/kill-asm-call/pypy/jit/backend/llsupport/llmodel.py	Thu Mar 25 22:25:05 2010
@@ -475,7 +475,14 @@
             assert (list(calldescr.arg_classes) ==
                     [arg.type for arg in args[1:]])
         callstub = calldescr.get_call_stub()
-        return callstub(args)
+        try:
+            return callstub(args)
+        except Exception, e:
+            if we_are_translated():
+                xxx
+            else:
+                import pdb
+                pdb.set_trace()
 
     def do_cast_ptr_to_int(self, ptrbox):
         return BoxInt(self.cast_gcref_to_int(ptrbox.getref_base()))



More information about the Pypy-commit mailing list