|
From: <sv...@va...> - 2012-07-10 16:41:59
|
sewardj 2012-07-10 17:41:46 +0100 (Tue, 10 Jul 2012)
New Revision: 2422
Log:
Comment/formatting only change, to clarify semantics w.r.t.
relationship between guards and return temporaries from dirty helper
calls.
Modified files:
trunk/priv/ir_defs.c
trunk/pub/libvex_ir.h
Modified: trunk/priv/ir_defs.c (+7 -4)
===================================================================
--- trunk/priv/ir_defs.c 2012-07-06 22:56:53 +01:00 (rev 2421)
+++ trunk/priv/ir_defs.c 2012-07-10 17:41:46 +01:00 (rev 2422)
@@ -3677,10 +3677,13 @@
tcExpr( bb, stmt, d->guard, gWordTy );
if (typeOfIRExpr(tyenv, d->guard) != Ity_I1)
sanityCheckFail(bb,stmt,"IRStmt.Dirty.guard not :: Ity_I1");
- /* A dirty helper that is executed conditionally (or not at all)
- AND returns a value is not handled properly. */
- if (d->tmp != IRTemp_INVALID &&
- (d->guard->tag != Iex_Const || d->guard->Iex.Const.con->Ico.U1 == 0))
+ /* A dirty helper that is executed conditionally (or not at
+ all) may not return a value. Hence if .tmp is not
+ IRTemp_INVALID, .guard must be manifestly True at JIT
+ time. */
+ if (d->tmp != IRTemp_INVALID
+ && (d->guard->tag != Iex_Const
+ || d->guard->Iex.Const.con->Ico.U1 == 0))
sanityCheckFail(bb,stmt,"IRStmt.Dirty with a return value"
" is executed under a condition");
/* check types, minimally */
Modified: trunk/pub/libvex_ir.h (+6 -1)
===================================================================
--- trunk/pub/libvex_ir.h 2012-07-06 22:56:53 +01:00 (rev 2421)
+++ trunk/pub/libvex_ir.h 2012-07-10 17:41:46 +01:00 (rev 2422)
@@ -1942,7 +1942,12 @@
typedef
struct _IRDirty {
- /* What to call, and details of args/results */
+ /* What to call, and details of args/results. .guard must be
+ non-NULL. If .tmp is not IRTemp_INVALID (that is, the call
+ returns a result) then .guard must be demonstrably (at
+ JIT-time) always true, that is, the call must be
+ unconditional. Conditional calls that assign .tmp are not
+ allowed. */
IRCallee* cee; /* where to call */
IRExpr* guard; /* :: Ity_Bit. Controls whether call happens */
IRExpr** args; /* arg list, ends in NULL */
|