[pypy-commit] pypy kill-flowobjspace: pass already unpacked args to special cases
rlamy
noreply at buildbot.pypy.org
Sun Feb 3 03:21:40 CET 2013
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: kill-flowobjspace
Changeset: r60833:97725c1effff
Date: 2013-02-02 20:02 +0000
http://bitbucket.org/pypy/pypy/changeset/97725c1effff/
Log: pass already unpacked args to special cases
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -1019,7 +1019,7 @@
def UNPACK_SEQUENCE(self, itemcount, next_instr):
w_iterable = self.popvalue()
- items = self.space.unpacksequence(w_iterable, itemcount)
+ items = self.space.unpack_sequence(w_iterable, itemcount)
self.pushrevvalues(itemcount, items)
def slice(self, w_start, w_end):
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -271,7 +271,7 @@
else:
raise UnwrapException("cannot unpack a Variable iterable ")
- def unpacksequence(self, w_iterable, expected_length):
+ def unpack_sequence(self, w_iterable, expected_length):
if isinstance(w_iterable, Constant):
l = list(self.unwrap(w_iterable))
if len(l) != expected_length:
@@ -412,7 +412,9 @@
except (KeyError, TypeError):
pass
else:
- return sc(self, fn, args)
+ args_w, kwds_w = args.unpack()
+ assert kwds_w == {}, "should not call %r with keyword arguments" % (fn,)
+ return sc(self, fn, args_w)
try:
args_w, kwds_w = args.unpack()
diff --git a/rpython/flowspace/specialcase.py b/rpython/flowspace/specialcase.py
--- a/rpython/flowspace/specialcase.py
+++ b/rpython/flowspace/specialcase.py
@@ -3,16 +3,12 @@
from rpython.rlib.rarithmetic import r_uint
from rpython.rlib.objectmodel import we_are_translated
-def sc_import(space, fn, args):
- args_w, kwds_w = args.unpack()
- assert kwds_w == {}, "should not call %r with keyword arguments" % (fn,)
+def sc_import(space, fn, args_w):
assert len(args_w) > 0 and len(args_w) <= 5, 'import needs 1 to 5 arguments'
args = [space.unwrap(arg) for arg in args_w]
return space.import_name(*args)
-def sc_operator(space, fn, args):
- args_w, kwds_w = args.unpack()
- assert kwds_w == {}, "should not call %r with keyword arguments" % (fn,)
+def sc_operator(space, fn, args_w):
opname = OperationName[fn]
if len(args_w) != Arity[opname]:
if opname == 'pow' and len(args_w) == 2:
@@ -51,18 +47,16 @@
# _________________________________________________________________________
-def sc_r_uint(space, r_uint, args):
+def sc_r_uint(space, r_uint, args_w):
# special case to constant-fold r_uint(32-bit-constant)
# (normally, the 32-bit constant is a long, and is not allowed to
# show up in the flow graphs at all)
- args_w, kwds_w = args.unpack()
- assert not kwds_w
[w_value] = args_w
if isinstance(w_value, Constant):
return Constant(r_uint(w_value.value))
return space.frame.do_operation('simple_call', space.wrap(r_uint), w_value)
-def sc_we_are_translated(space, we_are_translated, args):
+def sc_we_are_translated(space, we_are_translated, args_w):
return Constant(True)
SPECIAL_CASES = {__import__: sc_import, r_uint: sc_r_uint,
More information about the pypy-commit
mailing list