[pypy-svn] r56920 - in pypy/branch/opt-option/pypy: config translator/goal
arigo at codespeak.net
arigo at codespeak.net
Sat Aug 2 14:32:38 CEST 2008
Author: arigo
Date: Sat Aug 2 14:32:38 2008
New Revision: 56920
Removed:
pypy/branch/opt-option/pypy/translator/goal/targetmultiplespaces.py
Modified:
pypy/branch/opt-option/pypy/config/pypyoption.py
pypy/branch/opt-option/pypy/translator/goal/targetprologstandalone.py
pypy/branch/opt-option/pypy/translator/goal/targetpypystandalone.py
pypy/branch/opt-option/pypy/translator/goal/translate.py
Log:
Make the --opt option to translate.py also affect the PyPy objspace settings.
Modified: pypy/branch/opt-option/pypy/config/pypyoption.py
==============================================================================
--- pypy/branch/opt-option/pypy/config/pypyoption.py (original)
+++ pypy/branch/opt-option/pypy/config/pypyoption.py Sat Aug 2 14:32:38 2008
@@ -296,6 +296,9 @@
"a instrumentation option: before exit, print the types seen by "
"certain simpler bytecodes",
default=False),
+ ChoiceOption("multimethods", "the multimethod implementation to use",
+ ["doubledispatch", "mrd"],
+ default="mrd"),
]),
])
@@ -344,6 +347,10 @@
if level == '0':
config.objspace.suggest(geninterp=False)
+ # some optimizations have different effects depending on the typesystem
+ if type_system == 'ootype':
+ config.objspace.std.suggest(multimethods="doubledispatch")
+
if __name__ == '__main__':
config = get_pypy_config()
Modified: pypy/branch/opt-option/pypy/translator/goal/targetprologstandalone.py
==============================================================================
--- pypy/branch/opt-option/pypy/translator/goal/targetprologstandalone.py (original)
+++ pypy/branch/opt-option/pypy/translator/goal/targetprologstandalone.py Sat Aug 2 14:32:38 2008
@@ -27,9 +27,7 @@
# _____ Define and setup target ___
-def handle_config(config):
- return
- config.translation.stackless = True
+# XXX this should suggest --stackless somehow
def target(driver, args):
driver.exe_name = 'pyrolog-%(backend)s'
Modified: pypy/branch/opt-option/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/branch/opt-option/pypy/translator/goal/targetpypystandalone.py (original)
+++ pypy/branch/opt-option/pypy/translator/goal/targetpypystandalone.py Sat Aug 2 14:32:38 2008
@@ -90,26 +90,29 @@
parserkwargs={'usage': self.usage})
return parser
- def handle_config(self, config):
+ def handle_config(self, config, translateconfig):
+ self.translateconfig = translateconfig
+ # set up the objspace optimizations based on the --opt argument
+ from pypy.config.pypyoption import set_pypy_opt_level
+ set_pypy_opt_level(config, translateconfig.opt)
+
# as of revision 27081, multimethod.py uses the InstallerVersion1 by default
# because it is much faster both to initialize and run on top of CPython.
# The InstallerVersion2 is optimized for making a translator-friendly
# structure for low level backends. However, InstallerVersion1 is still
# preferable for high level backends, so we patch here.
+
from pypy.objspace.std import multimethod
- if config.translation.type_system == 'lltype':
+ if config.objspace.std.multimethods == 'mrd':
assert multimethod.InstallerVersion1.instance_counter == 0,\
'The wrong Installer version has already been instatiated'
multimethod.Installer = multimethod.InstallerVersion2
- else:
+ elif config.objspace.std.multimethods == 'doubledispatch':
# don't rely on the default, set again here
assert multimethod.InstallerVersion2.instance_counter == 0,\
'The wrong Installer version has already been instatiated'
multimethod.Installer = multimethod.InstallerVersion1
- def handle_translate_config(self, translateconfig):
- self.translateconfig = translateconfig
-
def print_help(self, config):
self.opt_parser(config).print_help()
@@ -184,7 +187,7 @@
def interface(self, ns):
for name in ['take_options', 'handle_config', 'print_help', 'target',
- 'handle_translate_config', 'portal',
+ 'portal',
'get_additional_config_options']:
ns[name] = getattr(self, name)
Modified: pypy/branch/opt-option/pypy/translator/goal/translate.py
==============================================================================
--- pypy/branch/opt-option/pypy/translator/goal/translate.py (original)
+++ pypy/branch/opt-option/pypy/translator/goal/translate.py Sat Aug 2 14:32:38 2008
@@ -163,10 +163,7 @@
# let the target modify or prepare itself
# based on the config
if 'handle_config' in targetspec_dic:
- targetspec_dic['handle_config'](config)
-
- if 'handle_translate_config' in targetspec_dic:
- targetspec_dic['handle_translate_config'](translateconfig)
+ targetspec_dic['handle_config'](config, translateconfig)
if translateconfig.help:
opt_parser.print_help()
More information about the Pypy-commit
mailing list