[pypy-commit] pypy default: Generalize passing of translation options.
arigo
noreply at buildbot.pypy.org
Mon Oct 31 17:49:28 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r48625:9241337e06ff
Date: 2011-10-31 17:45 +0100
http://bitbucket.org/pypy/pypy/changeset/9241337e06ff/
Log: Generalize passing of translation options.
diff --git a/pypy/jit/codewriter/support.py b/pypy/jit/codewriter/support.py
--- a/pypy/jit/codewriter/support.py
+++ b/pypy/jit/codewriter/support.py
@@ -37,10 +37,11 @@
return a.typeannotation(t)
def annotate(func, values, inline=None, backendoptimize=True,
- type_system="lltype"):
+ type_system="lltype", translationoptions={}):
# build the normal ll graphs for ll_function
t = TranslationContext()
- t.config.translation.withsmallfuncsets = 3
+ for key, value in translationoptions.items():
+ setattr(t.config.translation, key, value)
annpolicy = AnnotatorPolicy()
annpolicy.allow_someobjects = False
a = t.buildannotator(policy=annpolicy)
diff --git a/pypy/jit/metainterp/test/support.py b/pypy/jit/metainterp/test/support.py
--- a/pypy/jit/metainterp/test/support.py
+++ b/pypy/jit/metainterp/test/support.py
@@ -12,7 +12,7 @@
from pypy.rlib.rfloat import isnan
def _get_jitcodes(testself, CPUClass, func, values, type_system,
- supports_longlong=False, **kwds):
+ supports_longlong=False, translationoptions={}, **kwds):
from pypy.jit.codewriter import support
class FakeJitCell(object):
@@ -42,7 +42,8 @@
enable_opts = ALL_OPTS_DICT
func._jit_unroll_safe_ = True
- rtyper = support.annotate(func, values, type_system=type_system)
+ rtyper = support.annotate(func, values, type_system=type_system,
+ translationoptions=translationoptions)
graphs = rtyper.annotator.translator.graphs
testself.all_graphs = graphs
result_kind = history.getkind(graphs[0].getreturnvar().concretetype)[0]
diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -3585,7 +3585,8 @@
n = h(n, f8)
return n
assert f(5) == 41
- self.interp_operations(f, [5])
+ translationoptions = {'withsmallfuncsets': 3}
+ self.interp_operations(f, [5], translationoptions=translationoptions)
class TestLLtype(BaseLLtypeTests, LLJitMixin):
More information about the pypy-commit
mailing list