Discussion:
vex: r3336 - in /branches/VEX_JIT_HACKS/priv: ir_defs.c ir_opt.c
(too old to reply)
s***@valgrind.org
2017-03-28 21:10:37 UTC
Permalink
Raw Message
Author: iraisr
Date: Tue Mar 28 22:10:37 2017
New Revision: 3336

Log:
Last few fixes for the new approach with single global IRTypeEnv.
Now all tests for none and memcheck tools pass as they did in the baseline.

Modified:
branches/VEX_JIT_HACKS/priv/ir_defs.c
branches/VEX_JIT_HACKS/priv/ir_opt.c

Modified: branches/VEX_JIT_HACKS/priv/ir_defs.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_defs.c (original)
+++ branches/VEX_JIT_HACKS/priv/ir_defs.c Tue Mar 28 22:10:37 2017
@@ -2423,7 +2423,7 @@
{
IRStmtVecID next = irsb->id_seq;
irsb->id_seq += 1;
- vassert(irsb->id_seq < IRStmtVecID_INVALID);
+ vassert(irsb->id_seq != IRStmtVecID_INVALID);
return next;
}

@@ -2616,13 +2616,12 @@
IRTempDefSet* deepCopyIRTempDefSet(const IRTempDefSet* def_set)
{
IRTempDefSet* def_set2 = LibVEX_Alloc_inline(sizeof(IRTempDefSet));
- def_set2->slots_used = def_set->slots_used;
- def_set2->slots_size = def_set->slots_size;
+ def_set2->slots_used = def_set2->slots_size = def_set->slots_used;
UChar* set2 = LibVEX_Alloc_inline(def_set2->slots_used * sizeof(UChar));
for (UInt i = 0; i < def_set2->slots_used; i++) {
set2[i] = def_set->set[i];
}
- def_set2->set = set2;
+ def_set2->set = set2;
return def_set2;
}

@@ -3778,12 +3777,14 @@
UInt slots_required = (tmp + sizeof(UChar)) / sizeof(UChar);

if (slots_required >= def_set->slots_size) {
- UChar* new_set = LibVEX_Alloc_inline(2 * def_set->slots_size);
+ UInt new_size = (slots_required > 2 * def_set->slots_size) ?
+ slots_required : 2 * def_set->slots_size;
+ UChar* new_set = LibVEX_Alloc_inline(new_size * sizeof(UChar));
for (UInt i = 0; i < def_set->slots_used; i++) {
new_set[i] = def_set->set[i];
}
def_set->set = new_set;
- def_set->slots_size *= 2;
+ def_set->slots_size = new_size;
}

if (slots_required > def_set->slots_used) {

Modified: branches/VEX_JIT_HACKS/priv/ir_opt.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/ir_opt.c (original)
+++ branches/VEX_JIT_HACKS/priv/ir_opt.c Tue Mar 28 22:10:37 2017
@@ -5114,11 +5114,11 @@

bb2 = deepCopyIRSB(bb1);

- /* This is tricky. We need to copy types and increase IDs. This can be
- achieved here. But we also need to keep track in which IRStmtVec each
- IRTemp is defined and that can be set only during traversal. So we do
- only types here and deal with IDs and def_set during statement
- traversal. */
+ /* This is tricky. We need to copy types. We also need to increase IDs for
+ nested IRStmtVec's. This can be achieved here. But we also need to keep
+ track in which IRStmtVec each IRTemp is defined and that can be set
+ only during traversal. So we do only types here and deal with IDs and
+ def_set during statement traversal. */
ensureSpaceInIRTypeEnv(bb1->tyenv, bb1->tyenv->used + n_vars);
for (i = 0; i < n_vars; i++) {
bb1->tyenv->types[n_vars + i] = bb2->tyenv->types[i];
@@ -5134,7 +5134,8 @@
addStmtToIRStmtVec(bb1->stmts, bb2->stmts->stmts[i]);
}

- bb1->id_seq += n_ids;
+ /* Account for duplicated nested IRStmtVec's */
+ bb1->id_seq += (n_ids - 1);
}

if (DEBUG_IROPT) {

Loading...