[pypy-svn] r47416 - in pypy/dist/pypy: rlib rpython

arigo at codespeak.net arigo at codespeak.net
Sat Oct 13 09:58:39 CEST 2007


Author: arigo
Date: Sat Oct 13 09:58:37 2007
New Revision: 47416

Modified:
   pypy/dist/pypy/rlib/objectmodel.py
   pypy/dist/pypy/rpython/extfunc.py
Log:
Annotation fix.


Modified: pypy/dist/pypy/rlib/objectmodel.py
==============================================================================
--- pypy/dist/pypy/rlib/objectmodel.py	(original)
+++ pypy/dist/pypy/rlib/objectmodel.py	Sat Oct 13 09:58:37 2007
@@ -161,13 +161,23 @@
 
     def compute_result_annotation(self, s_RESTYPE, s_pythonfunction, *args_s):
         from pypy.annotation import model as annmodel
+        from pypy.rpython.lltypesystem import lltype
         assert s_RESTYPE.is_constant()
         assert s_pythonfunction.is_constant()
-        return annmodel.lltype_to_annotation(s_RESTYPE.const)
+        s_result = s_RESTYPE.const
+        if isinstance(s_result, lltype.LowLevelType):
+            s_result = annmodel.lltype_to_annotation(s_result)
+        assert isinstance(s_result, annmodel.SomeObject)
+        return s_result
 
     def specialize_call(self, hop):
+        from pypy.annotation import model as annmodel
         from pypy.rpython.lltypesystem import lltype
-        RESTYPE= hop.args_s[0].const
+        RESTYPE = hop.args_s[0].const
+        if not isinstance(RESTYPE, lltype.LowLevelType):
+            assert isinstance(RESTYPE, annmodel.SomeObject)
+            r_result = hop.rtyper.getrepr(RESTYPE)
+            RESTYPE = r_result.lowleveltype
         pythonfunction = hop.args_s[1].const
         c_pythonfunction = hop.inputconst(lltype.Void, pythonfunction)
         args_v = [hop.inputarg(hop.args_r[i], arg=i)

Modified: pypy/dist/pypy/rpython/extfunc.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunc.py	(original)
+++ pypy/dist/pypy/rpython/extfunc.py	Sat Oct 13 09:58:37 2007
@@ -174,7 +174,8 @@
         signature_args = self.normalize_args(*hop.args_s)
         args_r = [rtyper.getrepr(s_arg) for s_arg in signature_args]
         args_ll = [r_arg.lowleveltype for r_arg in args_r]
-        r_result = rtyper.getrepr(hop.s_result)
+        s_result = hop.s_result
+        r_result = rtyper.getrepr(s_result)
         ll_result = r_result.lowleveltype
         name = getattr(self, 'name', None) or self.instance.__name__
         method_name = rtyper.type_system.name[:2] + 'typeimpl'
@@ -191,7 +192,7 @@
                 original_impl = impl
                 def ll_wrapper(*args):
                     if running_on_llinterp:
-                        return debug_llinterpcall(ll_result, fakeimpl, *args)
+                        return debug_llinterpcall(s_result, fakeimpl, *args)
                     else:
                         return original_impl(*args)
                 impl = func_with_new_name(ll_wrapper, name + '_wrapper')



More information about the Pypy-commit mailing list