]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Comment/formatting only change, to clarify semantics w.r.t.
authorJulian Seward <jseward@acm.org>
Tue, 10 Jul 2012 16:41:46 +0000 (16:41 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 10 Jul 2012 16:41:46 +0000 (16:41 +0000)
relationship between guards and return temporaries from dirty helper
calls.

git-svn-id: svn://svn.valgrind.org/vex/trunk@2422

VEX/priv/ir_defs.c
VEX/pub/libvex_ir.h

index 89aec11d1c9bbe5452f881bb3ecff11ff171e4f3..c689c2b1606257fa6bb3e6ec9f0fa85f20baf41e 100644 (file)
@@ -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 */
index 005809c7fc14cadcc318f8f6909016954f04ba9d..860b08b4f84a61db5bbdb1821b1cc0fc385ee5e4 100644 (file)
@@ -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 */