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

fijal at codespeak.net fijal at codespeak.net
Thu Sep 7 11:34:02 CEST 2006


Author: fijal
Date: Thu Sep  7 11:33:46 2006
New Revision: 32042

Modified:
   pypy/dist/pypy/rpython/nonconst.py
   pypy/dist/pypy/rpython/rexternalobj.py
Log:
is-true for external object. Fixed nonconst to appear in rtyped graphs as constant.


Modified: pypy/dist/pypy/rpython/nonconst.py
==============================================================================
--- pypy/dist/pypy/rpython/nonconst.py	(original)
+++ pypy/dist/pypy/rpython/nonconst.py	Thu Sep  7 11:33:46 2006
@@ -5,6 +5,7 @@
 from pypy.rpython.extregistry import ExtRegistryEntry
 from pypy.annotation.bookkeeper import getbookkeeper
 from pypy.objspace.flow.model import Variable, Constant
+from pypy.rpython.lltypesystem import lltype
 
 class NonConstant(object):
     def __init__(self, _constant):
@@ -20,6 +21,9 @@
             return arg
 
     def specialize_call(self, hop):
-        v = Variable()
-        v.concretetype = hop.r_result.lowleveltype
-        return v
+        #v = Variable()
+        #v.concretetype = hop.r_result.lowleveltype
+        hop.exception_is_here()
+        retval = Constant(hop.r_result.convert_const(hop.args_v[0].value))
+        retval.concretetype = hop.r_result.lowleveltype
+        return retval

Modified: pypy/dist/pypy/rpython/rexternalobj.py
==============================================================================
--- pypy/dist/pypy/rpython/rexternalobj.py	(original)
+++ pypy/dist/pypy/rpython/rexternalobj.py	Thu Sep  7 11:33:46 2006
@@ -63,6 +63,11 @@
         hop.exception_is_here()
         return hop.genop('oosend', [Constant(name)] + vlist, resulttype=hop.r_result)
     
+    def rtype_is_true(self, hop):
+        vlist = hop.inputargs(self)
+        return hop.genop('is_true', vlist, resulttype=lltype.Bool)
+
+    
     def __getattr__(self, attr):
         if attr.startswith("rtype_method_"):
             name = attr[len("rtype_method_"):]



More information about the Pypy-commit mailing list