[pypy-svn] r20201 - in pypy/branch/somepbc-refactoring/pypy: annotation rpython

pedronis at codespeak.net pedronis at codespeak.net
Wed Nov 23 23:11:32 CET 2005


Author: pedronis
Date: Wed Nov 23 23:11:31 2005
New Revision: 20201

Modified:
   pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py
   pypy/branch/somepbc-refactoring/pypy/annotation/unaryop.py
   pypy/branch/somepbc-refactoring/pypy/rpython/rptr.py
Log:
repaired ll adt meths rtyping



Modified: pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py	Wed Nov 23 23:11:31 2005
@@ -216,10 +216,14 @@
     def consider_call_site(self, call_op):
         binding = self.annotator.binding
         s_callable = binding(call_op.args[0])
+        args_s = [binding(arg) for arg in call_op.args[1:]]
+        if isinstance(s_callable, SomeLLADTMeth):
+            adtmeth = s_callable
+            s_callable = self.immutablevalue(adtmeth.func)
+            args_s = [SomePtr(adtmeth.ll_ptrtype)] + args_s
         if isinstance(s_callable, SomePBC):
             descs = s_callable.descriptions.keys()
             family = descs[0].getcallfamily()
-            args_s = [binding(arg) for arg in call_op.args[1:]]
             args = self.build_args(call_op.opname, args_s)
             s_callable.getKind().consider_call_site(self, family, descs, args)
 

Modified: pypy/branch/somepbc-refactoring/pypy/annotation/unaryop.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/unaryop.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/unaryop.py	Wed Nov 23 23:11:31 2005
@@ -565,7 +565,8 @@
 
     def call(adtmeth, args):
         bookkeeper = getbookkeeper()
-        return bookkeeper.pycall(adtmeth.func, args.prepend(SomePtr(adtmeth.ll_ptrtype)), mono=True)
+        s_func = bookkeeper.immutablevalue(adtmeth.func)
+        return s_func.call(args.prepend(SomePtr(adtmeth.ll_ptrtype)))
 
 from pypy.rpython.ootypesystem import ootype
 class __extend__(SomeOOInstance):

Modified: pypy/branch/somepbc-refactoring/pypy/rpython/rptr.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/rptr.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/rptr.py	Wed Nov 23 23:11:31 2005
@@ -141,13 +141,15 @@
         self.adtmeth = adtmeth
         self.lowleveltype = adtmeth.ll_ptrtype
 
-    def rtype_hardwired_simple_call(self, hop):
+    def rtype_simple_call(self, hop):
         hop2 = hop.copy()
-        hop2.swap_fst_snd_args()
-        r_func, s_func = hop2.r_s_popfirstarg()
-        fptr = hop2.rtyper.getcallable(s_func.const)
-        hop2.v_s_insertfirstarg(flowmodel.Constant(fptr), annmodel.SomePtr(typeOf(fptr)))
-        return hop2.dispatch(opname='simple_call')
+        func = self.adtmeth.func
+        s_func = hop.rtyper.annotator.bookkeeper.immutablevalue(func)
+        v_ptr = hop2.args_v[0]
+        hop2.r_s_popfirstarg()
+        hop2.v_s_insertfirstarg(v_ptr, annmodel.SomePtr(self.adtmeth.ll_ptrtype))
+        hop2.v_s_insertfirstarg(flowmodel.Constant(func), s_func)
+        return hop2.dispatch()
 
 class __extend__(pairtype(PtrRepr, LLADTMethRepr)):
 



More information about the Pypy-commit mailing list