[pypy-commit] pypy default: Simplify Desc.consider_call_site() signature

rlamy noreply at buildbot.pypy.org
Sat Mar 28 21:29:57 CET 2015


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r76613:22b3272ea735
Date: 2015-03-28 20:29 +0000
http://bitbucket.org/pypy/pypy/changeset/22b3272ea735/

Log:	Simplify Desc.consider_call_site() signature

diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -169,9 +169,7 @@
     def consider_call_site_for_pbc(self, s_callable, args, s_result,
                                    call_op):
         descs = list(s_callable.descriptions)
-        family = descs[0].getcallfamily()
-        s_callable.getKind().consider_call_site(self, family, descs, args,
-                                                s_result, call_op)
+        s_callable.getKind().consider_call_site(descs, args, s_result, call_op)
 
     def getuniqueclassdef(self, cls):
         """Get the ClassDef associated with the given user cls.
diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py
--- a/rpython/annotator/description.py
+++ b/rpython/annotator/description.py
@@ -329,9 +329,10 @@
                                              name)
 
     @staticmethod
-    def consider_call_site(bookkeeper, family, descs, args, s_result, op):
+    def consider_call_site(descs, args, s_result, op):
         shape = rawshape(args)
         row = FunctionDesc.row_to_consider(descs, args, op)
+        family = descs[0].getcallfamily()
         family.calltable_add_row(shape, row)
 
     @staticmethod
@@ -760,7 +761,7 @@
         return s_result     # common case
 
     @staticmethod
-    def consider_call_site(bookkeeper, family, descs, args, s_result, op):
+    def consider_call_site(descs, args, s_result, op):
         from rpython.annotator.model import SomeInstance, SomePBC, s_None
         if len(descs) == 1:
             # call to a single class, look at the result annotation
@@ -795,17 +796,14 @@
                     "unexpected dynamic __init__?")
                 initfuncdesc, = s_init.descriptions
                 if isinstance(initfuncdesc, FunctionDesc):
-                    initmethdesc = bookkeeper.getmethoddesc(initfuncdesc,
-                                                            classdef,
-                                                            classdef,
-                                                            '__init__')
+                    from rpython.annotator.bookkeeper import getbookkeeper
+                    initmethdesc = getbookkeeper().getmethoddesc(
+                        initfuncdesc, classdef, classdef, '__init__')
                     initdescs.append(initmethdesc)
         # register a call to exactly these __init__ methods
         if initdescs:
             initdescs[0].mergecallfamilies(*initdescs[1:])
-            initfamily = initdescs[0].getcallfamily()
-            MethodDesc.consider_call_site(bookkeeper, initfamily, initdescs,
-                                          args, s_None, op)
+            MethodDesc.consider_call_site(initdescs, args, s_None, op)
 
     def getallbases(self):
         desc = self
@@ -897,10 +895,11 @@
                                              flags)
 
     @staticmethod
-    def consider_call_site(bookkeeper, family, descs, args, s_result, op):
+    def consider_call_site(descs, args, s_result, op):
         cnt, keys, star = rawshape(args)
         shape = cnt + 1, keys, star  # account for the extra 'self'
         row = FunctionDesc.row_to_consider(descs, args, op)
+        family = descs[0].getcallfamily()
         family.calltable_add_row(shape, row)
 
     def rowkey(self):
@@ -1058,10 +1057,11 @@
         return self.funcdesc.pycall(schedule, args, s_previous_result, op)
 
     @staticmethod
-    def consider_call_site(bookkeeper, family, descs, args, s_result, op):
+    def consider_call_site(descs, args, s_result, op):
         cnt, keys, star = rawshape(args)
         shape = cnt + 1, keys, star  # account for the extra 'self'
         row = FunctionDesc.row_to_consider(descs, args, op)
+        family = descs[0].getcallfamily()
         family.calltable_add_row(shape, row)
 
     def rowkey(self):


More information about the pypy-commit mailing list