[pypy-svn] r57644 - in pypy/branch/oo-jit/pypy: jit/codegen jit/codegen/cli/test jit/rainbow/test translator/cli/test
antocuni at codespeak.net
antocuni at codespeak.net
Wed Aug 27 14:47:56 CEST 2008
Author: antocuni
Date: Wed Aug 27 14:47:55 2008
New Revision: 57644
Added:
pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py (contents, props changed)
Modified:
pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_promotion.py
pypy/branch/oo-jit/pypy/jit/codegen/model.py
pypy/branch/oo-jit/pypy/jit/rainbow/test/test_interpreter.py
pypy/branch/oo-jit/pypy/translator/cli/test/runtest.py
Log:
add a new mixin to compile and test rainbow tests through gencli; probably lot
of tests in test_gencli_interpreter.py still fails
Added: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py
==============================================================================
--- (empty file)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py Wed Aug 27 14:47:55 2008
@@ -0,0 +1,26 @@
+import py
+from pypy.jit.codegen.cli.rgenop import RCliGenOp
+from pypy.jit.rainbow.test.test_interpreter import TestOOType as RainbowTest
+from pypy.translator.cli.test.runtest import compile_graph
+
+
+class CompiledCliMixin(object):
+ RGenOp = RCliGenOp
+ translate_support_code = True
+
+ def interpret(self, ll_function, values, opt_consts=[], *args, **kwds):
+ values, writer, jitcode = self.convert_and_serialize(ll_function, values, **kwds)
+ translator = self.rtyper.annotator.translator
+ func = compile_graph(self.rewriter.portal_entry_graph, translator)
+ return func(*values)
+
+
+ def check_insns(self, expected=None, **counts):
+ "Cannot check instructions in the generated assembler."
+
+class TestRainbowCli(CompiledCliMixin, RainbowTest):
+
+ # for the individual tests see
+ # ====> ../../../rainbow/test/test_interpreter.py
+
+ pass
Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_promotion.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_promotion.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_promotion.py Wed Aug 27 14:47:55 2008
@@ -31,3 +31,5 @@
test_vstruct_unfreeze = skip
test_promote_after_call = skip
test_merge_then_promote = skip
+ test_promote_class = skip
+ test_read___class___after_promotion = skip
Modified: pypy/branch/oo-jit/pypy/jit/codegen/model.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/model.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/model.py Wed Aug 27 14:47:55 2008
@@ -97,6 +97,8 @@
## def genop_oonewarray(self, alloctoken, gv_length):
## def genop_oosend(self, methtoken, gv_self, args_gv):
## def genop_oononnull(self, gv_obj):
+## def genop_ooisnull(self, gv_obj):
+
## def genop_oogetfield(self, fieldtoken, gv_obj):
## def genop_oosetfield(self, fieldtoken, gv_obj, gv_value):
Modified: pypy/branch/oo-jit/pypy/jit/rainbow/test/test_interpreter.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/test/test_interpreter.py (original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/test/test_interpreter.py Wed Aug 27 14:47:55 2008
@@ -194,12 +194,16 @@
self._cache_order.append(key)
return self.writer, self.jitcode
- def interpret(self, ll_function, values, opt_consts=[], *args, **kwds):
+ def convert_and_serialize(self, ll_function, values, **kwds):
if hasattr(ll_function, 'convert_arguments'):
assert len(ll_function.convert_arguments) == len(values)
values = [decoder(value) for decoder, value in zip(
ll_function.convert_arguments, values)]
writer, jitcode= self.serialize(ll_function, values, **kwds)
+ return values, writer, jitcode
+
+ def interpret(self, ll_function, values, opt_consts=[], *args, **kwds):
+ values, writer, jitcode = self.convert_and_serialize(ll_function, values, **kwds)
argcolors = []
for i, ll_val in enumerate(values):
color = writer.varcolor(self.graph.startblock.inputargs[i])
Modified: pypy/branch/oo-jit/pypy/translator/cli/test/runtest.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/cli/test/runtest.py (original)
+++ pypy/branch/oo-jit/pypy/translator/cli/test/runtest.py Wed Aug 27 14:47:55 2008
@@ -150,6 +150,15 @@
unpatch_os(olddefs) # restore original values
return CliFunctionWrapper(exe_name, func.__name__, auto_raise_exc)
+def compile_graph(graph, translator, auto_raise_exc=False,
+ exctrans=False, nowrap=False):
+ gen = _build_gen_from_graph(graph, translator, exctrans, nowrap)
+ gen.generate_source()
+ exe_name = gen.build_exe()
+ name = getattr(graph, 'name', '<graph>')
+ return CliFunctionWrapper(exe_name, name, auto_raise_exc)
+
+
def _build_gen(func, annotation, graph=None, backendopt=True, exctrans=False,
annotatorpolicy=None, nowrap=False):
try:
@@ -180,12 +189,15 @@
if getoption('view'):
t.view()
+ return _build_gen_from_graph(main_graph, t, exctrans, nowrap)
+
+def _build_gen_from_graph(graph, t, exctrans=False, nowrap=False):
if getoption('wd'):
tmpdir = py.path.local('.')
else:
tmpdir = udir
- return GenCli(tmpdir, t, TestEntryPoint(main_graph, not nowrap), exctrans=exctrans)
+ return GenCli(tmpdir, t, TestEntryPoint(graph, not nowrap), exctrans=exctrans)
class CliFunctionWrapper(object):
def __init__(self, exe_name, name=None, auto_raise_exc=False):
More information about the Pypy-commit
mailing list