[pypy-svn] r64995 - pypy/branch/pyjitpl5/pypy/jit/backend/test
fijal at codespeak.net
fijal at codespeak.net
Sun May 3 05:40:17 CEST 2009
Author: fijal
Date: Sun May 3 05:40:15 2009
New Revision: 64995
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py
pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
Log:
Point 3. wrong guard_exception after call
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py Sun May 3 05:40:15 2009
@@ -11,6 +11,7 @@
def __init__(self, *args, **kw):
test_random.OperationBuilder.__init__(self, *args, **kw)
+ self.vtable_counter = 0
def get_structptr_var(self, r, must_have_vtable=False):
while True:
@@ -42,6 +43,9 @@
def get_random_structure_type_and_vtable(self, r):
vtable = lltype.malloc(rclass.OBJECT_VTABLE, immortal=True)
+ vtable.subclassrange_min = self.vtable_counter
+ vtable.subclassrange_max = self.vtable_counter
+ self.vtable_counter += 1
S = self.get_random_structure_type(r, with_vtable=vtable)
name = S._name
vtable.name = lltype.malloc(lltype.Array(lltype.Char), len(name)+1,
@@ -255,6 +259,30 @@
builder.guard_op = op
builder.loop.operations.append(op)
+# 3. raising call and wrong guard_exception
+
+class RaisingCallOperationWrongGuardException(BaseCallOperation):
+ def produce_into(self, builder, r):
+ subset, f, exc = self.raising_func_code(builder, r)
+ TP = lltype.FuncType([lltype.Signed] * len(subset), lltype.Void)
+ ptr = llhelper(lltype.Ptr(TP), f)
+ c_addr = ConstAddr(llmemory.cast_ptr_to_adr(ptr), builder.cpu)
+ args = [c_addr] + subset
+ descr = builder.cpu.calldescrof(TP, TP.ARGS, TP.RESULT)
+ self.put(builder, args, descr)
+ assert builder.cpu.get_exception()
+ builder.cpu.clear_exception()
+ _, vtableptr = builder.get_random_structure_type_and_vtable(r)
+ assert vtableptr != exc
+ other_box = ConstAddr(llmemory.cast_ptr_to_adr(vtableptr), builder.cpu)
+ op = ResOperation(rop.GUARD_EXCEPTION, [other_box], BoxPtr())
+ op._exc_box = ConstAddr(llmemory.cast_ptr_to_adr(exc), builder.cpu)
+ subset = builder.subset_of_intvars(r)
+ op.suboperations = [ResOperation(rop.FAIL, subset, None)]
+ builder.should_fail_by = op.suboperations[0]
+ builder.guard_op = op
+ builder.loop.operations.append(op)
+
# ____________________________________________________________
OPERATIONS = test_random.OPERATIONS[:]
@@ -270,6 +298,7 @@
OPERATIONS.append(CallOperation(rop.CALL))
OPERATIONS.append(RaisingCallOperation(rop.CALL))
OPERATIONS.append(RaisingCallOperationGuardNoException(rop.CALL))
+ OPERATIONS.append(RaisingCallOperationWrongGuardException(rop.CALL))
LLtypeOperationBuilder.OPERATIONS = OPERATIONS
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py Sun May 3 05:40:15 2009
@@ -390,7 +390,7 @@
op = cpu.execute_operations(self.loop)
assert op is self.should_fail_by
if (self.guard_op is not None and
- self.guard_op.opnum == rop.GUARD_NO_EXCEPTION):
+ self.guard_op.is_guard_exception()):
assert cpu.get_exception()
cpu.clear_exception()
for i, v in enumerate(op.args):
@@ -417,7 +417,7 @@
if not op.args:
return False
subloop = DummyLoop(guard_op.suboperations)
- if guard_op.opnum == rop.GUARD_NO_EXCEPTION:
+ if guard_op.is_guard_exception():
guard_op.suboperations.append(exc_handling(guard_op))
bridge_builder = self.builder.__class__(self.builder.cpu, subloop,
op.args[:])
@@ -437,7 +437,7 @@
if self.guard_op is None:
guard_op.suboperations[-1] = jump_op
else:
- if self.guard_op.opnum == rop.GUARD_NO_EXCEPTION:
+ if self.guard_op.is_guard_exception():
# exception clearing
self.guard_op.suboperations.insert(-1, exc_handling(
self.guard_op))
More information about the Pypy-commit
mailing list