[pypy-svn] r36587 - pypy/dist/pypy/rpython

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Jan 12 16:37:29 CET 2007


Author: cfbolz
Date: Fri Jan 12 16:37:03 2007
New Revision: 36587

Modified:
   pypy/dist/pypy/rpython/extfunc.py
   pypy/dist/pypy/rpython/rtyper.py
Log:
(arigo, cfbolz): don't always look at the graphs of all type systems


Modified: pypy/dist/pypy/rpython/extfunc.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunc.py	(original)
+++ pypy/dist/pypy/rpython/extfunc.py	Fri Jan 12 16:37:03 2007
@@ -11,17 +11,6 @@
         for arg, expected in zip(args_s, self.signature_args):
             arg = unionof(arg, expected)
             assert expected.contains(arg)
-
-        for type_system in ['lltype', 'ootype']:
-            impl = getattr(self, type_system + 'impl', None)
-            if impl:
-                key = impl.im_func
-                pbc = self.bookkeeper.immutablevalue(impl.im_func)
-                s_result = self.bookkeeper.emulate_pbc_call(key, pbc,
-                       self.signature_args)
-                s_result = unionof(s_result, self.signature_result)
-                assert self.signature_result.contains(s_result)
-        
         return self.signature_result
 
     def specialize_call(self, hop):
@@ -34,14 +23,11 @@
         method_name = rtyper.type_system.name[:2] + 'typeimpl'
         impl = getattr(self, method_name, None)
         if impl:
-            hop2 = hop.copy()
-            v = Constant(impl.im_func)
-            bookkeeper = rtyper.annotator.bookkeeper
-            hop2.v_s_insertfirstarg(v, bookkeeper.immutablevalue(impl.im_func))
-            return hop2.dispatch()
+            obj = rtyper.getannmixlevel().delayedfunction(
+                impl.im_func, self.signature_args, self.signature_result)
         else:
             obj = rtyper.type_system.getexternalcallable(args_ll, ll_result,
                                  name, _entry=self, _callable=self.instance)
-            vlist = [hop.inputconst(typeOf(obj), obj)] + hop.inputargs(*args_r)
-            hop.exception_is_here()
-            return hop.genop('direct_call', vlist, r_result)
+        vlist = [hop.inputconst(typeOf(obj), obj)] + hop.inputargs(*args_r)
+        hop.exception_is_here()
+        return hop.genop('direct_call', vlist, r_result)

Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py	(original)
+++ pypy/dist/pypy/rpython/rtyper.py	Fri Jan 12 16:37:03 2007
@@ -187,12 +187,20 @@
         ldef = listdef.ListDef(None, annmodel.SomeString())
         self.list_of_str_repr = self.getrepr(annmodel.SomeList(ldef))
 
+    def getannmixlevel(self):
+        if self.annmixlevel is not None:
+            return self.annmixlevel
+        from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
+        self.annmixlevel = MixLevelHelperAnnotator(self)
+        return self.annmixlevel
+
     def specialize_more_blocks(self):
         if self.already_seen:
             newtext = ' more'
         else:
             newtext = ''
         blockcount = 0
+        self.annmixlevel = None
         while True:
             # look for blocks not specialized yet
             pending = [block for block in self.annotator.annotated
@@ -234,6 +242,10 @@
             raise TyperError("there were %d error" % len(self.typererrors))
         self.log.event('-=- specialized %d%s blocks -=-' % (
             blockcount, newtext))
+        annmixlevel = self.annmixlevel
+        del self.annmixlevel
+        if annmixlevel is not None:
+            annmixlevel.finish()
 
     def dump_typererrors(self, num=None, minimize=True, to_log=False): 
         c = 0



More information about the Pypy-commit mailing list