[pypy-svn] r74029 - in pypy/branch/rpython-iterator/pypy: annotation rpython/lltypesystem
arigo at codespeak.net
arigo at codespeak.net
Fri Apr 23 19:20:20 CEST 2010
Author: arigo
Date: Fri Apr 23 19:20:18 2010
New Revision: 74029
Modified:
pypy/branch/rpython-iterator/pypy/annotation/unaryop.py
pypy/branch/rpython-iterator/pypy/rpython/lltypesystem/rclass.py
Log:
Tweaks and copy-pasting from controllerentry.py until the
basic test in rlib/test/test_r_iter works.
Modified: pypy/branch/rpython-iterator/pypy/annotation/unaryop.py
==============================================================================
--- pypy/branch/rpython-iterator/pypy/annotation/unaryop.py (original)
+++ pypy/branch/rpython-iterator/pypy/annotation/unaryop.py Fri Apr 23 19:20:18 2010
@@ -11,7 +11,7 @@
s_ImpossibleValue, s_Bool, s_None, \
unionof, set, missing_operation, add_knowntypedata, HarmlesslyBlocked, \
SomeGenericCallable, SomeWeakRef, SomeUnicodeString
-from pypy.annotation.bookkeeper import getbookkeeper, RPythonCallsSpace
+from pypy.annotation.bookkeeper import getbookkeeper
from pypy.annotation import builtin
from pypy.annotation.binaryop import _clone ## XXX where to put this?
from pypy.rpython import extregistry
@@ -633,15 +633,17 @@
s.const = True
def iter(ins):
- s_result = SomeIterator(ins)
- s_result.s_next_pbc = ins._lookup_const_attr('next')
- return s_result
+ return SomeIterator(ins)
def getanyitem(ins):
bk = getbookkeeper()
- args = bk.build_args("simple_call", [])
- s_pbc = ins._lookup_const_attr('next')
- return bk.pbc_call(s_pbc, args)
+ s_func = bk.immutablevalue(call_next)
+ return bk.emulate_pbc_call(bk.position_key, s_func, [ins],
+ callback = bk.position_key)
+
+# XXX temporary!
+def call_next(instance):
+ return instance.next()
class __extend__(SomeBuiltin):
def simple_call(bltn, *args):
Modified: pypy/branch/rpython-iterator/pypy/rpython/lltypesystem/rclass.py
==============================================================================
--- pypy/branch/rpython-iterator/pypy/rpython/lltypesystem/rclass.py (original)
+++ pypy/branch/rpython-iterator/pypy/rpython/lltypesystem/rclass.py Fri Apr 23 19:20:18 2010
@@ -595,11 +595,16 @@
return vinst
def rtype_next(self, hop):
- vinst, = hop.inputargs(self)
- r_method = self.rtyper.makerepr(hop.args_s[0].s_next_pbc)
- v_meth = r_method.get_method_from_instance(self, vinst, hop.llops)
- import pdb
- pdb.set_trace()
+ # XXX should be moved to rpython/rclass.py
+ bk = hop.rtyper.annotator.bookkeeper
+ hop2 = hop.copy()
+ # XXX fish fish fish
+ from pypy.annotation.unaryop import call_next
+ c_func = Constant(call_next)
+ s_func = bk.immutablevalue(call_next)
+ hop2.v_s_insertfirstarg(c_func, s_func)
+ hop2.forced_opname = 'simple_call'
+ return hop2.dispatch()
class __extend__(pairtype(InstanceRepr, InstanceRepr)):
def convert_from_to((r_ins1, r_ins2), v, llops):
More information about the Pypy-commit
mailing list