Author: Armin Rigo <[email protected]>
Branch:
Changeset: r65780:0a06c71baefa
Date: 2013-07-29 14:58 +0200
http://bitbucket.org/pypy/pypy/changeset/0a06c71baefa/
Log: A random test for COND_CALL. It can fail so far.
diff --git a/rpython/jit/backend/test/test_ll_random.py
b/rpython/jit/backend/test/test_ll_random.py
--- a/rpython/jit/backend/test/test_ll_random.py
+++ b/rpython/jit/backend/test/test_ll_random.py
@@ -502,6 +502,7 @@
# 3. raising call and wrong guard_exception
# 4. raising call and guard_no_exception
# 5. non raising call and guard_exception
+# (6. test of a cond_call, always non-raising and guard_no_exception)
class BaseCallOperation(test_random.AbstractOperation):
def non_raising_func_code(self, builder, r):
@@ -648,6 +649,34 @@
builder.guard_op = op
builder.loop.operations.append(op)
+# 6. a conditional call (for now always with no exception raised)
+class CondCallOperation(BaseCallOperation):
+ def produce_into(self, builder, r):
+ fail_subset = builder.subset_of_intvars(r)
+ v_cond = builder.get_bool_var(r)
+ subset = builder.subset_of_intvars(r)[:4]
+ for i in range(len(subset)):
+ if r.random() < 0.35:
+ subset[i] = ConstInt(r.random_integer())
+ #
+ seen = []
+ def call_me(*args):
+ if len(seen) == 0:
+ seen.append(args)
+ else:
+ assert seen[0] == args
+ #
+ TP = lltype.FuncType([lltype.Signed] * len(subset), lltype.Void)
+ ptr = llhelper(lltype.Ptr(TP), call_me)
+ c_addr = ConstAddr(llmemory.cast_ptr_to_adr(ptr), builder.cpu)
+ args = [v_cond, c_addr] + subset
+ descr = self.getcalldescr(builder, TP)
+ self.put(builder, args, descr)
+ op = ResOperation(rop.GUARD_NO_EXCEPTION, [], None,
+ descr=builder.getfaildescr())
+ op.setfailargs(fail_subset)
+ builder.loop.operations.append(op)
+
# ____________________________________________________________
OPERATIONS = test_random.OPERATIONS[:]
@@ -684,6 +713,7 @@
OPERATIONS.append(RaisingCallOperationGuardNoException(rop.CALL))
OPERATIONS.append(RaisingCallOperationWrongGuardException(rop.CALL))
OPERATIONS.append(CallOperationException(rop.CALL))
+ OPERATIONS.append(CondCallOperation(rop.COND_CALL))
OPERATIONS.append(GuardNonNullClassOperation(rop.GUARD_NONNULL_CLASS))
LLtypeOperationBuilder.OPERATIONS = OPERATIONS
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit