From: Julian Seward Date: Tue, 10 Jul 2012 16:41:46 +0000 (+0000) Subject: Comment/formatting only change, to clarify semantics w.r.t. X-Git-Tag: svn/VALGRIND_3_8_1^2~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8cda0d829155a2e60f83d7fe1a25eb8bf00a686;p=thirdparty%2Fvalgrind.git Comment/formatting only change, to clarify semantics w.r.t. relationship between guards and return temporaries from dirty helper calls. git-svn-id: svn://svn.valgrind.org/vex/trunk@2422 --- diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index 89aec11d1c..c689c2b160 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -3677,10 +3677,13 @@ void tcStmt ( IRSB* bb, IRStmt* stmt, IRType gWordTy ) 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 */ diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 005809c7fc..860b08b4f8 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -1942,7 +1942,12 @@ extern void ppIREffect ( IREffect ); 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 */