[pypy-svn] r13492 - pypy/dist/pypy/interpreter
arigo at codespeak.net
arigo at codespeak.net
Thu Jun 16 23:33:12 CEST 2005
Author: arigo
Date: Thu Jun 16 23:33:11 2005
New Revision: 13492
Modified:
pypy/dist/pypy/interpreter/eval.py
pypy/dist/pypy/interpreter/pyopcode.py
Log:
A couple of changes to make the rtyper happy with function calls. The rule is:
if a call point can invoke several different functions, then these functions
should always be called using the same "call shape" (i.e. # of args provided,
*/** arguments). It's fine to use various call shapes to call a single
function explicitely, though; this rule is only about calls via a "function
pointer" or an overridden method. These two changes were all that is needed
in the whole of PyPy.
Modified: pypy/dist/pypy/interpreter/eval.py
==============================================================================
--- pypy/dist/pypy/interpreter/eval.py (original)
+++ pypy/dist/pypy/interpreter/eval.py Thu Jun 16 23:33:11 2005
@@ -19,7 +19,7 @@
def exec_code(self, space, w_globals, w_locals):
"Implements the 'exec' statement."
- frame = self.create_frame(space, w_globals)
+ frame = self.create_frame(space, w_globals, None)
frame.setdictscope(w_locals)
return frame.run()
Modified: pypy/dist/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyopcode.py (original)
+++ pypy/dist/pypy/interpreter/pyopcode.py Thu Jun 16 23:33:11 2005
@@ -626,7 +626,7 @@
block = pyframe.FinallyBlock(f, f.next_instr + offsettoend)
f.blockstack.push(block)
- def CALL_FUNCTION(f, oparg, w_star=None, w_starstar=None):
+ def call_function(f, oparg, w_star=None, w_starstar=None):
n_arguments = oparg & 0xff
n_keywords = (oparg>>8) & 0xff
keywords = {}
@@ -642,18 +642,21 @@
w_result = f.space.call_args(w_function, args)
f.valuestack.push(w_result)
+ def CALL_FUNCTION(f, oparg):
+ f.call_function(oparg)
+
def CALL_FUNCTION_VAR(f, oparg):
w_varargs = f.valuestack.pop()
- f.CALL_FUNCTION(oparg, w_varargs)
+ f.call_function(oparg, w_varargs)
def CALL_FUNCTION_KW(f, oparg):
w_varkw = f.valuestack.pop()
- f.CALL_FUNCTION(oparg, None, w_varkw)
+ f.call_function(oparg, None, w_varkw)
def CALL_FUNCTION_VAR_KW(f, oparg):
w_varkw = f.valuestack.pop()
w_varargs = f.valuestack.pop()
- f.CALL_FUNCTION(oparg, w_varargs, w_varkw)
+ f.call_function(oparg, w_varargs, w_varkw)
def MAKE_FUNCTION(f, numdefaults):
w_codeobj = f.valuestack.pop()
More information about the Pypy-commit
mailing list