[pypy-commit] pypy jitframe-on-heap: runner tests fixes
fijal
noreply at buildbot.pypy.org
Fri Feb 1 13:04:29 CET 2013
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: jitframe-on-heap
Changeset: r60805:b2af635e45dc
Date: 2013-01-31 13:12 +0200
http://bitbucket.org/pypy/pypy/changeset/b2af635e45dc/
Log: runner tests fixes
diff --git a/rpython/jit/backend/arm/test/test_runner.py b/rpython/jit/backend/arm/test/test_runner.py
--- a/rpython/jit/backend/arm/test/test_runner.py
+++ b/rpython/jit/backend/arm/test/test_runner.py
@@ -30,9 +30,10 @@
'adds', 'cmp', 'beq', 'b']
bridge_loop_instructions = ['movw', 'movt', 'bx']
- def setup_method(self, meth):
- self.cpu = CPU(rtyper=None, stats=FakeStats())
- self.cpu.setup_once()
+ def get_cpu(self):
+ cpu = CPU(rtyper=None, stats=FakeStats())
+ cpu.setup_once()
+ return cpu
def test_result_is_spilled(self):
cpu = self.cpu
diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -885,13 +885,13 @@
if faildescr == self.cpu.done_with_this_frame_descr_int:
reset_vable(jd, vable)
return self.cpu.get_int_value(pframe, 0)
- if faildescr == self.cpu.done_with_this_frame_descr_ref:
+ elif faildescr == self.cpu.done_with_this_frame_descr_ref:
reset_vable(jd, vable)
return self.cpu.get_ref_value(pframe, 0)
- if faildescr == self.cpu.done_with_this_frame_descr_float:
+ elif faildescr == self.cpu.done_with_this_frame_descr_float:
reset_vable(jd, vable)
return self.cpu.get_float_value(pframe, 0)
- if faildescr == self.cpu.done_with_this_frame_descr_void:
+ elif faildescr == self.cpu.done_with_this_frame_descr_void:
reset_vable(jd, vable)
return None
#
diff --git a/rpython/jit/backend/llgraph/test/test_llgraph.py b/rpython/jit/backend/llgraph/test/test_llgraph.py
--- a/rpython/jit/backend/llgraph/test/test_llgraph.py
+++ b/rpython/jit/backend/llgraph/test/test_llgraph.py
@@ -1,23 +1,16 @@
import py
-from rpython.rtyper.lltypesystem import lltype, llmemory, rstr, rclass
-from rpython.rtyper.test.test_llinterp import interpret
-from rpython.rlib.unroll import unrolling_iterable
-
-from rpython.jit.metainterp.history import BoxInt, BoxPtr, Const, ConstInt,\
- TreeLoop
-from rpython.jit.metainterp.resoperation import ResOperation, rop
-from rpython.jit.metainterp.executor import execute
+from rpython.rtyper.lltypesystem import lltype, llmemory
from rpython.jit.codewriter import heaptracker
from rpython.jit.backend.test.runner_test import LLtypeBackendTest
+from rpython.jit.backend.llgraph.runner import LLGraphCPU
class TestLLTypeLLGraph(LLtypeBackendTest):
# for individual tests see:
# ====> ../../test/runner_test.py
- from rpython.jit.backend.llgraph.runner import LLGraphCPU as cpu_type
- def setup_method(self, _):
- self.cpu = self.cpu_type(None)
+ def get_cpu(self):
+ return LLGraphCPU(None)
def test_memoryerror(self):
py.test.skip("does not make much sense on the llgraph backend")
diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -112,6 +112,13 @@
avoid_instances = False
+ def setup_method(self, _):
+ self.cpu = self.get_cpu()
+ self.cpu.done_with_this_frame_descr_int = None
+ self.cpu.done_with_this_frame_descr_ref = None
+ self.cpu.done_with_this_frame_descr_float = None
+ self.cpu.done_with_this_frame_descr_void = None
+
def test_compile_linear_loop(self):
i0 = BoxInt()
i1 = BoxInt()
@@ -2816,17 +2823,13 @@
# test the fast path, which should not call assembler_helper()
del called[:]
- prev_descr = self.cpu.done_with_this_frame_descr_int
self.cpu.done_with_this_frame_descr_int = finish_descr
- try:
- othertoken = JitCellToken()
- self.cpu.compile_loop(loop.inputargs, loop.operations, othertoken)
- args = [i+1 for i in range(10)]
- deadframe = self.cpu.execute_token(othertoken, *args)
- assert self.cpu.get_int_value(deadframe, 0) == 97
- assert not called
- finally:
- self.cpu.done_with_this_frame_int_v = prev_descr
+ othertoken = JitCellToken()
+ self.cpu.compile_loop(loop.inputargs, loop.operations, othertoken)
+ args = [i+1 for i in range(10)]
+ deadframe = self.cpu.execute_token(othertoken, *args)
+ assert self.cpu.get_int_value(deadframe, 0) == 97
+ assert not called
def test_assembler_call_float(self):
if not self.cpu.supports_floats:
@@ -2886,19 +2889,15 @@
# test the fast path, which should not call assembler_helper()
del called[:]
- prev_descr = self.cpu.done_with_this_frame_descr_float
self.cpu.done_with_this_frame_descr_float = finish_descr
- try:
- othertoken = JitCellToken()
- self.cpu.compile_loop(loop.inputargs, loop.operations, othertoken)
- args = [longlong.getfloatstorage(1.2),
- longlong.getfloatstorage(4.2)]
- deadframe = self.cpu.execute_token(othertoken, *args)
- x = self.cpu.get_float_value(deadframe, 0)
- assert longlong.getrealfloat(x) == 1.2 + 4.2
- assert not called
- finally:
- self.cpu.done_with_this_frame_descr_float = prev_descr
+ othertoken = JitCellToken()
+ self.cpu.compile_loop(loop.inputargs, loop.operations, othertoken)
+ args = [longlong.getfloatstorage(1.2),
+ longlong.getfloatstorage(4.2)]
+ deadframe = self.cpu.execute_token(othertoken, *args)
+ x = self.cpu.get_float_value(deadframe, 0)
+ assert longlong.getrealfloat(x) == 1.2 + 4.2
+ assert not called
def test_raw_malloced_getarrayitem(self):
ARRAY = rffi.CArray(lltype.Signed)
diff --git a/rpython/jit/backend/x86/test/test_runner.py b/rpython/jit/backend/x86/test/test_runner.py
--- a/rpython/jit/backend/x86/test/test_runner.py
+++ b/rpython/jit/backend/x86/test/test_runner.py
@@ -34,9 +34,10 @@
bridge_loop_instructions = ['cmp', 'jge', 'mov', 'mov', 'mov', 'mov',
'call', 'mov', 'jmp']
- def setup_method(self, meth):
- self.cpu = CPU(rtyper=None, stats=FakeStats())
- self.cpu.setup_once()
+ def get_cpu(self):
+ cpu = CPU(rtyper=None, stats=FakeStats())
+ cpu.setup_once()
+ return cpu
def test_execute_ptr_operation(self):
cpu = self.cpu
More information about the pypy-commit
mailing list