Author: Ronan Lamy <[email protected]>
Branch: translation-cleanup
Changeset: r58141:68eaeee93b2b
Date: 2012-10-16 16:36 +0100
http://bitbucket.org/pypy/pypy/changeset/68eaeee93b2b/
Log: Flowspacify CALL_FUNCTION and friends
(remove useless speed hack in CALL_FUNCTION)
diff --git a/pypy/objspace/flow/flowcontext.py
b/pypy/objspace/flow/flowcontext.py
--- a/pypy/objspace/flow/flowcontext.py
+++ b/pypy/objspace/flow/flowcontext.py
@@ -771,6 +771,48 @@
self.pushvalue(self.space.newlist([]))
self.pushvalue(last_val)
+ def call_function(self, oparg, w_star=None, w_starstar=None):
+ n_arguments = oparg & 0xff
+ n_keywords = (oparg>>8) & 0xff
+ if n_keywords:
+ keywords = [None] * n_keywords
+ keywords_w = [None] * n_keywords
+ while True:
+ n_keywords -= 1
+ if n_keywords < 0:
+ break
+ w_value = self.popvalue()
+ w_key = self.popvalue()
+ key = self.space.str_w(w_key)
+ keywords[n_keywords] = key
+ keywords_w[n_keywords] = w_value
+ else:
+ keywords = None
+ keywords_w = None
+ arguments = self.popvalues(n_arguments)
+ args = self.argument_factory(arguments, keywords, keywords_w, w_star,
+ w_starstar)
+ w_function = self.popvalue()
+ w_result = self.space.call_args(w_function, args)
+ self.pushvalue(w_result)
+
+ def CALL_FUNCTION(self, oparg, next_instr):
+ self.call_function(oparg)
+ CALL_METHOD = CALL_FUNCTION
+
+ def CALL_FUNCTION_VAR(self, oparg, next_instr):
+ w_varargs = self.popvalue()
+ self.call_function(oparg, w_varargs)
+
+ def CALL_FUNCTION_KW(self, oparg, next_instr):
+ w_varkw = self.popvalue()
+ self.call_function(oparg, None, w_varkw)
+
+ def CALL_FUNCTION_VAR_KW(self, oparg, next_instr):
+ w_varkw = self.popvalue()
+ w_varargs = self.popvalue()
+ self.call_function(oparg, w_varargs, w_varkw)
+
def MAKE_FUNCTION(self, numdefaults, next_instr):
w_codeobj = self.popvalue()
defaults = self.popvalues(numdefaults)
diff --git a/pypy/objspace/flow/objspace.py b/pypy/objspace/flow/objspace.py
--- a/pypy/objspace/flow/objspace.py
+++ b/pypy/objspace/flow/objspace.py
@@ -427,10 +427,6 @@
raise FSException(self.w_ImportError,
self.wrap("cannot import name '%s'" % w_name.value))
- def call_valuestack(self, w_func, nargs, frame):
- args = frame.make_arguments(nargs)
- return self.call_args(w_func, args)
-
def call_method(self, w_obj, methname, *arg_w):
w_meth = self.getattr(w_obj, self.wrap(methname))
return self.call_function(w_meth, *arg_w)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit