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

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Jan 6 23:46:18 CET 2006


Author: cfbolz
Date: Fri Jan  6 23:46:16 2006
New Revision: 21765

Modified:
   pypy/dist/pypy/rpython/llinterp.py
   pypy/dist/pypy/rpython/rpbc.py
   pypy/dist/pypy/rpython/rptr.py
Log:
add a new last argument to indirect_calls. it is a Constant of a list of graphs
that can be called by that call. Does not work in all cases, the most notable
is rbuiltin.ll_instantiate


Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Fri Jan  6 23:46:16 2006
@@ -319,7 +319,16 @@
         frame = self.__class__(graph, args, self.llinterpreter, self)
         return frame.eval()
 
-    op_indirect_call = op_direct_call  # XXX for now
+    def op_indirect_call(self, f, *args):
+        graphs = args[-1]
+        args = args[:-1]
+        if graphs is not None:
+            obj = self.llinterpreter.typer.type_system.deref(f)
+            if hasattr(obj, 'graph'):
+                assert obj.graph in graphs 
+        else:
+            print "this should ideally not happen", f, graphs, args
+        return self.op_direct_call(f, *args)
 
     def op_malloc(self, obj):
         if self.llinterpreter.gc is not None:

Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py	(original)
+++ pypy/dist/pypy/rpython/rpbc.py	Fri Jan  6 23:46:16 2006
@@ -315,6 +315,10 @@
         if isinstance(vlist[0], Constant):
             v = hop.genop('direct_call', vlist, resulttype = rresult)
         else:
+            print row_of_graphs
+            c = Constant(row_of_graphs.values())
+            c.concretetype = Void
+            vlist.append(c)
             v = hop.genop('indirect_call', vlist, resulttype = rresult)
         return hop.llops.convertvar(v, rresult, hop.r_result)
 

Modified: pypy/dist/pypy/rpython/rptr.py
==============================================================================
--- pypy/dist/pypy/rpython/rptr.py	(original)
+++ pypy/dist/pypy/rpython/rptr.py	Fri Jan  6 23:46:16 2006
@@ -65,6 +65,9 @@
             opname = 'direct_call'
         else:
             opname = 'indirect_call'
+            c = flowmodel.Constant(None)
+            c.concretetype = Void
+            vlist.append(c)
         hop.exception_is_here()
         return hop.genop(opname, vlist,
                          resulttype = self.lowleveltype.TO.RESULT)



More information about the Pypy-commit mailing list