[pypy-commit] pypy sanitise_bytecode_dispatch: (cfbolz, ltratt) Remove the CALL_METHOD option.
ltratt
noreply at buildbot.pypy.org
Fri Aug 30 18:03:33 CEST 2013
Author: Laurence Tratt <laurie at tratt.net>
Branch: sanitise_bytecode_dispatch
Changeset: r66672:e434731eb29b
Date: 2013-08-30 15:47 +0100
http://bitbucket.org/pypy/pypy/changeset/e434731eb29b/
Log: (cfbolz, ltratt) Remove the CALL_METHOD option.
This has been enabled by default for some time.
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -127,11 +127,6 @@
pypy_optiondescription = OptionDescription("objspace", "Object Space Options", [
- OptionDescription("opcodes", "opcodes to enable in the interpreter", [
- BoolOption("CALL_METHOD", "emit a special bytecode for expr.name()",
- default=False),
- ]),
-
OptionDescription("usemodules", "Which Modules should be used", [
BoolOption(modname, "use module %s" % (modname, ),
default=modname in default_modules,
@@ -307,7 +302,6 @@
# all the good optimizations for PyPy should be listed here
if level in ['2', '3', 'jit']:
- config.objspace.opcodes.suggest(CALL_METHOD=True)
config.objspace.std.suggest(withrangelist=True)
config.objspace.std.suggest(withmethodcache=True)
config.objspace.std.suggest(withprebuiltchar=True)
diff --git a/pypy/doc/config/objspace.opcodes.CALL_METHOD.txt b/pypy/doc/config/objspace.opcodes.CALL_METHOD.txt
deleted file mode 100644
--- a/pypy/doc/config/objspace.opcodes.CALL_METHOD.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Enable a pair of bytecodes that speed up method calls.
-See ``pypy.interpreter.callmethod`` for a description.
-
-The goal is to avoid creating the bound method object in the common
-case. So far, this only works for calls with no keyword, no ``*arg``
-and no ``**arg`` but it would be easy to extend.
-
-For more information, see the section in `Standard Interpreter Optimizations`_.
-
-.. _`Standard Interpreter Optimizations`: ../interpreter-optimizations.html#lookup-method-call-method
diff --git a/pypy/doc/config/objspace.opcodes.txt b/pypy/doc/config/objspace.opcodes.txt
deleted file mode 100644
--- a/pypy/doc/config/objspace.opcodes.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-.. intentionally empty
diff --git a/pypy/doc/interpreter-optimizations.rst b/pypy/doc/interpreter-optimizations.rst
--- a/pypy/doc/interpreter-optimizations.rst
+++ b/pypy/doc/interpreter-optimizations.rst
@@ -198,9 +198,6 @@
if it is not None, then it is considered to be an additional first
argument in the call to the *im_func* object from the stack.
-You can enable this feature with the :config:`objspace.opcodes.CALL_METHOD`
-option.
-
.. more here?
Overall Effects
diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py
--- a/pypy/interpreter/astcompiler/codegen.py
+++ b/pypy/interpreter/astcompiler/codegen.py
@@ -982,9 +982,8 @@
return self._call_has_no_star_args(call) and not call.keywords
def _optimize_method_call(self, call):
- if not self.space.config.objspace.opcodes.CALL_METHOD or \
- not self._call_has_no_star_args(call) or \
- not isinstance(call.func, ast.Attribute):
+ if not self._call_has_no_star_args(call) or \
+ not isinstance(call.func, ast.Attribute):
return False
attr_lookup = call.func
assert isinstance(attr_lookup, ast.Attribute)
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -219,9 +219,6 @@
return self.jump_absolute(oparg, ec)
for opdesc in unrolling_all_opcode_descs:
- if not opdesc.is_enabled(space):
- continue
-
# the following "if" is part of the big switch described
# above.
if opcode == opdesc.index:
diff --git a/pypy/interpreter/test/test_compiler.py b/pypy/interpreter/test/test_compiler.py
--- a/pypy/interpreter/test/test_compiler.py
+++ b/pypy/interpreter/test/test_compiler.py
@@ -953,10 +953,6 @@
assert i > -1
assert isinstance(co.co_consts[i], frozenset)
-
-class AppTestCallMethod(object):
- spaceconfig = {'objspace.opcodes.CALL_METHOD': True}
-
def test_call_method_kwargs(self):
source = """def _f(a):
return a.f(a=a)
diff --git a/pypy/interpreter/test/test_executioncontext.py b/pypy/interpreter/test/test_executioncontext.py
--- a/pypy/interpreter/test/test_executioncontext.py
+++ b/pypy/interpreter/test/test_executioncontext.py
@@ -253,10 +253,6 @@
""")
-class TestExecutionContextWithCallMethod(TestExecutionContext):
- spaceconfig ={'objspace.opcodes.CALL_METHOD': True}
-
-
class AppTestDelNotBlocked:
def setup_method(self, meth):
diff --git a/pypy/interpreter/test/test_gateway.py b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -812,10 +812,6 @@
assert len(called) == 1
assert isinstance(called[0], argument.Arguments)
-class TestPassThroughArguments_CALL_METHOD(TestPassThroughArguments):
- spaceconfig = dict(usemodules=('itertools',), **{
- "objspace.opcodes.CALL_METHOD": True
- })
class AppTestKeywordsToBuiltinSanity(object):
diff --git a/pypy/module/_continuation/interp_pickle.py b/pypy/module/_continuation/interp_pickle.py
--- a/pypy/module/_continuation/interp_pickle.py
+++ b/pypy/module/_continuation/interp_pickle.py
@@ -120,8 +120,7 @@
nkwds = (oparg >> 8) & 0xff
if nkwds == 0: # only positional arguments
# fast paths leaves things on the stack, pop them
- if (frame.space.config.objspace.opcodes.CALL_METHOD and
- opcode == map['CALL_METHOD']):
+ if opcode == map['CALL_METHOD']:
frame.dropvalues(nargs + 2)
elif opcode == map['CALL_FUNCTION']:
frame.dropvalues(nargs + 1)
diff --git a/pypy/module/_lsprof/test/test_cprofile.py b/pypy/module/_lsprof/test/test_cprofile.py
--- a/pypy/module/_lsprof/test/test_cprofile.py
+++ b/pypy/module/_lsprof/test/test_cprofile.py
@@ -191,11 +191,6 @@
sys.path.pop(0)
-class AppTestWithDifferentBytecodes(AppTestCProfile):
- spaceconfig = AppTestCProfile.spaceconfig.copy()
- spaceconfig['objspace.opcodes.CALL_METHOD'] = True
-
-
expected_output = {}
expected_output['print_stats'] = """\
126 function calls (106 primitive calls) in 1.000 seconds
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -841,8 +841,7 @@
#
# default_magic - 6 -- used by CPython without the -U option
# default_magic - 5 -- used by CPython with the -U option
-# default_magic -- used by PyPy without the CALL_METHOD opcode
-# default_magic + 2 -- used by PyPy with the CALL_METHOD opcode
+# default_magic -- used by PyPy [because of CALL_METHOD]
#
from pypy.interpreter.pycode import default_magic
MARSHAL_VERSION_FOR_PYC = 2
@@ -855,10 +854,7 @@
magic = __import__('imp').get_magic()
return struct.unpack('<i', magic)[0]
- result = default_magic
- if space.config.objspace.opcodes.CALL_METHOD:
- result += 2
- return result
+ return default_magic
def parse_source_module(space, pathname, source):
diff --git a/pypy/module/sys/test/test_sysmodule.py b/pypy/module/sys/test/test_sysmodule.py
--- a/pypy/module/sys/test/test_sysmodule.py
+++ b/pypy/module/sys/test/test_sysmodule.py
@@ -710,7 +710,3 @@
except:
assert g() is e
test_call_in_subfunction.expected = 'n'
-
-
-class AppTestSysExcInfoDirectCallMethod(AppTestSysExcInfoDirect):
- spaceconfig = {"objspace.opcodes.CALL_METHOD": True}
diff --git a/pypy/objspace/std/frame.py b/pypy/objspace/std/frame.py
--- a/pypy/objspace/std/frame.py
+++ b/pypy/objspace/std/frame.py
@@ -91,10 +91,9 @@
StdObjSpaceFrame.BINARY_ADD = int_BINARY_ADD
if space.config.objspace.std.optimized_list_getitem:
StdObjSpaceFrame.BINARY_SUBSCR = list_BINARY_SUBSCR
- if space.config.objspace.opcodes.CALL_METHOD:
- from pypy.objspace.std.callmethod import LOOKUP_METHOD, CALL_METHOD
- StdObjSpaceFrame.LOOKUP_METHOD = LOOKUP_METHOD
- StdObjSpaceFrame.CALL_METHOD = CALL_METHOD
+ from pypy.objspace.std.callmethod import LOOKUP_METHOD, CALL_METHOD
+ StdObjSpaceFrame.LOOKUP_METHOD = LOOKUP_METHOD
+ StdObjSpaceFrame.CALL_METHOD = CALL_METHOD
if space.config.objspace.std.optimized_comparison_op:
StdObjSpaceFrame.COMPARE_OP = fast_COMPARE_OP
return StdObjSpaceFrame
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -591,10 +591,7 @@
return ObjSpace.getindex_w(self, w_obj, w_exception, objdescr)
def call_method(self, w_obj, methname, *arg_w):
- if self.config.objspace.opcodes.CALL_METHOD:
- return callmethod.call_method_opt(self, w_obj, methname, *arg_w)
- else:
- return ObjSpace.call_method(self, w_obj, methname, *arg_w)
+ return callmethod.call_method_opt(self, w_obj, methname, *arg_w)
def _type_issubtype(self, w_sub, w_type):
if isinstance(w_sub, W_TypeObject) and isinstance(w_type, W_TypeObject):
diff --git a/pypy/objspace/std/test/test_callmethod.py b/pypy/objspace/std/test/test_callmethod.py
--- a/pypy/objspace/std/test/test_callmethod.py
+++ b/pypy/objspace/std/test/test_callmethod.py
@@ -2,8 +2,6 @@
# The exec hacking is needed to have the code snippets compiled
# by our own compiler, not CPython's
- spaceconfig = {"objspace.opcodes.CALL_METHOD": True}
-
def test_call_method(self):
exec """if 1:
class C(object):
@@ -111,13 +109,10 @@
class AppTestCallMethodWithGetattributeShortcut(AppTestCallMethod):
- spaceconfig = AppTestCallMethod.spaceconfig.copy()
- spaceconfig["objspace.std.getattributeshortcut"] = True
+ spaceconfig = {"objspace.std.getattributeshortcut": True}
class TestCallMethod:
- spaceconfig = {"objspace.opcodes.CALL_METHOD": True}
-
def test_space_call_method(self):
space = self.space
w_lst = space.newlist([])
diff --git a/pypy/objspace/std/test/test_mapdict.py b/pypy/objspace/std/test/test_mapdict.py
--- a/pypy/objspace/std/test/test_mapdict.py
+++ b/pypy/objspace/std/test/test_mapdict.py
@@ -656,8 +656,7 @@
class AppTestWithMapDictAndCounters(object):
spaceconfig = {"objspace.std.withmapdict": True,
- "objspace.std.withmethodcachecounter": True,
- "objspace.opcodes.CALL_METHOD": True}
+ "objspace.std.withmethodcachecounter": True}
def setup_class(cls):
from pypy.interpreter import gateway
@@ -1001,8 +1000,7 @@
class AppTestGlobalCaching(AppTestWithMapDict):
spaceconfig = {"objspace.std.withmethodcachecounter": True,
- "objspace.std.withmapdict": True,
- "objspace.opcodes.CALL_METHOD": True}
+ "objspace.std.withmapdict": True}
def test_mix_classes(self):
import __pypy__
diff --git a/rpython/tool/stdlib_opcode.py b/rpython/tool/stdlib_opcode.py
--- a/rpython/tool/stdlib_opcode.py
+++ b/rpython/tool/stdlib_opcode.py
@@ -9,13 +9,6 @@
def _freeze_(self):
return True
- def is_enabled(self, space):
- """Check if the opcode should be enabled in the space's configuration.
- (Returns True for all standard opcodes.)"""
- opt = space.config.objspace.opcodes
- return getattr(opt, self.name, True)
- is_enabled._annspecialcase_ = 'specialize:memo'
-
# for predictable results, we try to order opcodes most-used-first
opcodeorder = [124, 125, 100, 105, 1, 131, 116, 111, 106, 83, 23, 93, 113, 25, 95, 64, 112, 66, 102, 110, 60, 92, 62, 120, 68, 87, 32, 136, 4, 103, 24, 63, 18, 65, 15, 55, 121, 3, 101, 22, 12, 80, 86, 135, 126, 90, 140, 104, 2, 33, 20, 108, 107, 31, 134, 132, 88, 30, 133, 130, 137, 141, 61, 122, 11, 40, 74, 73, 51, 96, 21, 42, 56, 85, 82, 89, 142, 77, 78, 79, 91, 76, 97, 57, 19, 43, 84, 50, 41, 99, 53, 26]
More information about the pypy-commit
mailing list