Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: fast-slowpath
Changeset: r65467:4a928febab82
Date: 2013-07-18 21:44 +0200
http://bitbucket.org/pypy/pypy/changeset/4a928febab82/

Log:    hack differently - store extra descrs on effectinfo (I think it's ok
        to store extra field on this object, we should not have too many of
        them)

diff --git a/rpython/jit/codewriter/call.py b/rpython/jit/codewriter/call.py
--- a/rpython/jit/codewriter/call.py
+++ b/rpython/jit/codewriter/call.py
@@ -200,7 +200,7 @@
         return (fnaddr, calldescr)
 
     def getcalldescr(self, op, oopspecindex=EffectInfo.OS_NONE,
-                     extraeffect=None):
+                     extraeffect=None, extradescrs=None):
         """Return the calldescr that describes all calls done by 'op'.
         This returns a calldescr that we can put in the corresponding
         call operation in the calling jitcode.  It gets an effectinfo
@@ -258,7 +258,8 @@
         #
         effectinfo = effectinfo_from_writeanalyze(
             self.readwrite_analyzer.analyze(op), self.cpu, extraeffect,
-            oopspecindex, can_invalidate, call_release_gil_target)
+            oopspecindex, can_invalidate, call_release_gil_target,
+            extradescrs)
         #
         assert effectinfo is not None
         if elidable or loopinvariant:
diff --git a/rpython/jit/codewriter/effectinfo.py 
b/rpython/jit/codewriter/effectinfo.py
--- a/rpython/jit/codewriter/effectinfo.py
+++ b/rpython/jit/codewriter/effectinfo.py
@@ -100,11 +100,13 @@
                 extraeffect=EF_CAN_RAISE,
                 oopspecindex=OS_NONE,
                 can_invalidate=False,
-                call_release_gil_target=llmemory.NULL):
+                call_release_gil_target=llmemory.NULL,
+                extra_descrs=None):
         key = (frozenset_or_none(readonly_descrs_fields),
                frozenset_or_none(readonly_descrs_arrays),
                frozenset_or_none(write_descrs_fields),
                frozenset_or_none(write_descrs_arrays),
+               frozenset_or_none(extra_descrs),
                extraeffect,
                oopspecindex,
                can_invalidate)
@@ -137,6 +139,7 @@
         result.can_invalidate = can_invalidate
         result.oopspecindex = oopspecindex
         result.call_release_gil_target = call_release_gil_target
+        result.extra_descrs = extra_descrs
         if result.check_can_raise():
             assert oopspecindex in cls._OS_CANRAISE
         cls._cache[key] = result
@@ -176,7 +179,8 @@
                                  extraeffect=EffectInfo.EF_CAN_RAISE,
                                  oopspecindex=EffectInfo.OS_NONE,
                                  can_invalidate=False,
-                                 call_release_gil_target=llmemory.NULL):
+                                 call_release_gil_target=llmemory.NULL,
+                                 extra_descrs=None):
     from rpython.translator.backendopt.writeanalyze import top_set
     if effects is top_set or extraeffect == EffectInfo.EF_RANDOM_EFFECTS:
         readonly_descrs_fields = None
@@ -225,7 +229,8 @@
                       extraeffect,
                       oopspecindex,
                       can_invalidate,
-                      call_release_gil_target)
+                      call_release_gil_target,
+                      extra_descrs)
 
 def consider_struct(TYPE, fieldname):
     if fieldType(TYPE, fieldname) is lltype.Void:
diff --git a/rpython/jit/codewriter/jtransform.py 
b/rpython/jit/codewriter/jtransform.py
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -360,11 +360,12 @@
         lst.append(v)
 
     def handle_residual_call(self, op, extraargs=[], may_call_jitcodes=False,
-                             oopspecindex=EffectInfo.OS_NONE):
+                             oopspecindex=EffectInfo.OS_NONE, 
extradescrs=None):
         """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, 
oopspecindex=oopspecindex)
+        calldescr = self.callcontrol.getcalldescr(op, 
oopspecindex=oopspecindex,
+                                                  extradescrs=extradescrs)
         op1 = self.rewrite_call(op, 'residual_call',
                                 [op.args[0]] + extraargs, calldescr=calldescr)
         if may_call_jitcodes or self.callcontrol.calldescr_canraise(calldescr):
@@ -1619,12 +1620,11 @@
 
     def do_resizable_list__resize_ge(self, op, args, *descrs):
         index = EffectInfo.OS_LIST_RESIZE_GE
-        oplist = self.handle_residual_call(op, oopspecindex=index)[0]
         LIST = args[0].concretetype.TO
         lengthdescr = self.cpu.fielddescrof(LIST, 'length')
         arraydescr = self.cpu.arraydescrof(LIST.items.TO)
-        oplist[0].args += [lengthdescr, arraydescr]
-        return oplist
+        return self.handle_residual_call(op, oopspecindex=index,
+                                         extradescrs=[lengthdescr, arraydescr])
 
     # ----------
     # Strings and Unicodes.
diff --git a/rpython/jit/metainterp/pyjitpl.py 
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -1204,7 +1204,7 @@
                                                    CIF_DESCRIPTION_P)
 
         kind, descr, itemsize = get_arg_descr(self.metainterp.cpu, 
cif_description.rtype)
-        
+
         if kind != 'v':
             ofs = cif_description.exchange_result
             assert ofs % itemsize == 0     # alignment check (result)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to