You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
(3) |
2
(2) |
3
|
4
(1) |
|
5
|
6
(2) |
7
|
8
(1) |
9
|
10
(2) |
11
(8) |
|
12
(2) |
13
(9) |
14
(2) |
15
(6) |
16
(5) |
17
(3) |
18
|
|
19
|
20
(1) |
21
(1) |
22
(6) |
23
(8) |
24
(2) |
25
(1) |
|
26
|
27
(3) |
28
(8) |
29
(17) |
30
(6) |
31
(3) |
|
|
From: <sv...@va...> - 2017-03-23 23:22:29
|
Author: iraisr
Date: Thu Mar 23 23:22:21 2017
New Revision: 16285
Log:
Fix for 377698 - Missing memory check for futex() uaddr arg for FUTEX_WAKE,
and FUTEX_WAKE_BITSET, check only 4 args for FUTEX_WAKE_BITSET,
and 2 args for FUTEX_TRYLOCK_PI.
Fixes BZ#377698.
Patch by: dia...@or...
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/memcheck/tests/arm64-linux/scalar.c
trunk/memcheck/tests/arm64-linux/scalar.stderr.exp
trunk/memcheck/tests/darwin/scalar.c
trunk/memcheck/tests/x86-linux/scalar.c
trunk/memcheck/tests/x86-linux/scalar.stderr.exp
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Mar 23 23:22:21 2017
@@ -147,6 +147,9 @@
377376 memcheck/tests/linux/getregset fails with glibc2.24
377427 PPC64, lxv instruction failing on odd destination register
377478 PPC64: ISA 3.0 setup fixes
+377698 Missing memory check for futex() uaddr arg for FUTEX_WAKE
+ and FUTEX_WAKE_BITSET, check only 4 args for FUTEX_WAKE_BITSET,
+ and 2 args for FUTEX_TRYLOCK_PI
377717 Fix massive space leak when reading compressed debuginfo sections
Release 3.12.0 (20 October 2016)
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c Thu Mar 23 23:22:21 2017
@@ -1610,9 +1610,11 @@
}
break;
case VKI_FUTEX_WAKE_BITSET:
- PRE_REG_READ6(long, "futex",
- vki_u32 *, futex, int, op, int, val,
- int, dummy, int, dummy2, int, val3);
+ PRE_REG_READ3(long, "futex",
+ vki_u32 *, futex, int, op, int, val);
+ if (VG_(tdict).track_pre_reg_read) {
+ PRA6("futex", int, val3);
+ }
break;
case VKI_FUTEX_WAIT:
case VKI_FUTEX_LOCK_PI:
@@ -1622,10 +1624,10 @@
break;
case VKI_FUTEX_WAKE:
case VKI_FUTEX_FD:
- case VKI_FUTEX_TRYLOCK_PI:
PRE_REG_READ3(long, "futex",
vki_u32 *, futex, int, op, int, val);
break;
+ case VKI_FUTEX_TRYLOCK_PI:
case VKI_FUTEX_UNLOCK_PI:
default:
PRE_REG_READ2(long, "futex", vki_u32 *, futex, int, op);
@@ -1655,13 +1657,10 @@
case VKI_FUTEX_FD:
case VKI_FUTEX_TRYLOCK_PI:
case VKI_FUTEX_UNLOCK_PI:
- PRE_MEM_READ( "futex(futex)", ARG1, sizeof(Int) );
- break;
-
case VKI_FUTEX_WAKE:
case VKI_FUTEX_WAKE_BITSET:
- /* no additional pointers */
- break;
+ PRE_MEM_READ( "futex(futex)", ARG1, sizeof(Int) );
+ break;
default:
SET_STATUS_Failure( VKI_ENOSYS ); // some futex function we don't understand
Modified: trunk/memcheck/tests/arm64-linux/scalar.c
==============================================================================
--- trunk/memcheck/tests/arm64-linux/scalar.c (original)
+++ trunk/memcheck/tests/arm64-linux/scalar.c Thu Mar 23 23:22:21 2017
@@ -1068,8 +1068,8 @@
#define FUTEX_WAIT 0
#endif
// XXX: again, glibc not doing 6th arg means we have only 5s errors
- GO(__NR_futex, "5s 2m");
- SY(__NR_futex, x0+FUTEX_WAIT, x0, x0, x0+1, x0, x0); FAIL;
+ GO(__NR_futex, "4s 2m");
+ SY(__NR_futex, x0+FUTEX_WAIT, x0, x0, x0+1); FAIL;
// __NR_sched_setaffinity 241
GO(__NR_sched_setaffinity, "3s 1m");
Modified: trunk/memcheck/tests/arm64-linux/scalar.stderr.exp
==============================================================================
--- trunk/memcheck/tests/arm64-linux/scalar.stderr.exp (original)
+++ trunk/memcheck/tests/arm64-linux/scalar.stderr.exp Thu Mar 23 23:22:21 2017
@@ -1958,7 +1958,7 @@
130: __NR_tkill n/a
-----------------------------------------------------
-----------------------------------------------------
- 98: __NR_futex 5s 2m
+ 98: __NR_futex 4s 2m
-----------------------------------------------------
Syscall param futex(futex) contains uninitialised byte(s)
...
Modified: trunk/memcheck/tests/darwin/scalar.c
==============================================================================
--- trunk/memcheck/tests/darwin/scalar.c (original)
+++ trunk/memcheck/tests/darwin/scalar.c Thu Mar 23 23:22:21 2017
@@ -1654,8 +1654,8 @@
#define FUTEX_WAIT 0
#endif
// XXX: again, glibc not doing 6th arg means we have only 5s errors
- GO(__NR_futex, "5s 2m");
- SY(__NR_futex, x0+FUTEX_WAIT, x0, x0, x0+1, x0, x0); FAIL;
+ GO(__NR_futex, "4s 2m");
+ SY(__NR_futex, x0+FUTEX_WAIT, x0, x0, x0+1); FAIL;
// __NR_sched_setaffinity 241
GO(__NR_sched_setaffinity, "3s 1m");
Modified: trunk/memcheck/tests/x86-linux/scalar.c
==============================================================================
--- trunk/memcheck/tests/x86-linux/scalar.c (original)
+++ trunk/memcheck/tests/x86-linux/scalar.c Thu Mar 23 23:22:21 2017
@@ -1068,8 +1068,8 @@
#define FUTEX_WAIT 0
#endif
// XXX: again, glibc not doing 6th arg means we have only 5s errors
- GO(__NR_futex, "5s 2m");
- SY(__NR_futex, x0+FUTEX_WAIT, x0, x0, x0+1, x0, x0); FAIL;
+ GO(__NR_futex, "4s 2m");
+ SY(__NR_futex, x0+FUTEX_WAIT, x0, x0, x0+1); FAIL;
// __NR_sched_setaffinity 241
GO(__NR_sched_setaffinity, "3s 1m");
Modified: trunk/memcheck/tests/x86-linux/scalar.stderr.exp
==============================================================================
--- trunk/memcheck/tests/x86-linux/scalar.stderr.exp (original)
+++ trunk/memcheck/tests/x86-linux/scalar.stderr.exp Thu Mar 23 23:22:21 2017
@@ -3300,7 +3300,7 @@
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
-240: __NR_futex 5s 2m
+240: __NR_futex 4s 2m
-----------------------------------------------------
Syscall param futex(futex) contains uninitialised byte(s)
...
|
|
From: <sv...@va...> - 2017-03-23 22:12:10
|
Author: iraisr
Date: Thu Mar 23 22:12:03 2017
New Revision: 16284
Log:
Announce fix for bug 377717 in the NEWS
Modified:
trunk/NEWS
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Mar 23 22:12:03 2017
@@ -147,6 +147,7 @@
377376 memcheck/tests/linux/getregset fails with glibc2.24
377427 PPC64, lxv instruction failing on odd destination register
377478 PPC64: ISA 3.0 setup fixes
+377717 Fix massive space leak when reading compressed debuginfo sections
Release 3.12.0 (20 October 2016)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
From: <sv...@va...> - 2017-03-23 21:57:07
|
Author: iraisr
Date: Thu Mar 23 21:56:58 2017
New Revision: 3328
Log:
Fix constant propagation and folding for IfThenElse statements.
Modified:
branches/VEX_JIT_HACKS/priv/ir_opt.c
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 Thu Mar 23 21:56:58 2017
@@ -1064,8 +1064,62 @@
#define NODE_LIMIT 30
-/* The env in this section is a map from IRTemp to IRExpr*,
- that is, an array indexed by IRTemp. */
+/* The env in this section is a structure which holds:
+ - A map from IRTemp to IRExpr*, that is, an array indexed by IRTemp.
+ Keys are IRTemp.indices. Values are IRExpr*s.
+ - IRTypeEnv ID
+ - Current IRStmtVec* which is being constructed.
+ - A pointer to the parent env (or NULL). */
+typedef
+ struct _FoldEnv {
+ IRExpr** map;
+ IRTyEnvID id;
+ IRStmtVec* stmts;
+ struct _FoldEnv* parent;
+ }
+ FoldEnv;
+
+/* Sets up the constant propagation and folding environment. */
+static FoldEnv* newFoldEnv(IRStmtVec* stmts_in, FoldEnv* parent_env)
+{
+ IRStmtVec* stmts_out = emptyIRStmtVec();
+ stmts_out->tyenv = deepCopyIRTypeEnv(stmts_in->tyenv);
+ stmts_out->parent = (parent_env != NULL) ? parent_env->stmts : NULL;
+
+ FoldEnv* env = LibVEX_Alloc_inline(sizeof(FoldEnv));
+ env->id = stmts_out->tyenv->id;
+ env->stmts = stmts_out;
+ env->parent = parent_env;
+
+ UInt n_tmps = stmts_out->tyenv->types_used;
+ env->map = LibVEX_Alloc_inline(n_tmps * sizeof(IRExpr*));
+ for (UInt i = 0; i < n_tmps; i++)
+ env->map[i] = NULL;
+ return env;
+}
+
+static inline IRExpr* findIRExpr(const FoldEnv* env, IRTemp tmp)
+{
+ while (env->id != tmp.id) {
+ env = env->parent;
+ vassert(env != NULL);
+ }
+ vassert(env->id == tmp.id);
+
+ return env->map[tmp.index];
+}
+
+static void setIRExpr(FoldEnv* env, IRTemp tmp, IRExpr* e)
+{
+ while (env->id != tmp.id) {
+ env = env->parent;
+ vassert(env != NULL);
+ }
+ vassert(env->id == tmp.id);
+
+ vassert(env->map[tmp.index] == NULL);
+ env->map[tmp.index] = e;
+}
/* Do both expressions compute the same value? The answer is generally
conservative, i.e. it will report that the expressions do not compute
@@ -1084,17 +1138,20 @@
slower out of line general case. Saves a few insns. */
__attribute__((noinline))
-static Bool sameIRExprs_aux2(IRExpr* env[], IRExpr* e1, IRExpr* e2);
+static Bool sameIRExprs_aux2(const FoldEnv* env, const IRExpr* e1,
+ const IRExpr* e2);
inline
-static Bool sameIRExprs_aux(IRExpr* env[], IRExpr* e1, IRExpr* e2)
+static Bool sameIRExprs_aux(const FoldEnv* env, const IRExpr* e1,
+ const IRExpr* e2)
{
if (e1->tag != e2->tag) return False;
return sameIRExprs_aux2(env, e1, e2);
}
__attribute__((noinline))
-static Bool sameIRExprs_aux2(IRExpr* env[], IRExpr* e1, IRExpr* e2)
+static Bool sameIRExprs_aux2(const FoldEnv* env, const IRExpr* e1,
+ const IRExpr* e2)
{
if (num_nodes_visited++ > NODE_LIMIT) return False;
@@ -1102,12 +1159,12 @@
case Iex_RdTmp: {
IRTemp tmp1 = e1->Iex.RdTmp.tmp;
IRTemp tmp2 = e2->Iex.RdTmp.tmp;
- vassert(tmp1.id == tmp2.id);
- if (tmp1.index == tmp2.index) return True;
-
- if (env[tmp1.index] && env[tmp2.index]) {
- Bool same = sameIRExprs_aux(env, env[tmp1.index], env[tmp2.index]);
+ if (eqIRTemp(tmp1, tmp2)) return True;
+ const IRExpr* subst1 = findIRExpr(env, tmp1);
+ const IRExpr* subst2 = findIRExpr(env, tmp2);
+ if (subst1 != NULL && subst2 != NULL) {
+ Bool same = sameIRExprs_aux(env, subst1, subst2);
#if STATS_IROPT
recursed = True;
if (same) recursion_helped = True;
@@ -1176,7 +1233,7 @@
}
inline
-static Bool sameIRExprs(IRExpr* env[], IRExpr* e1, IRExpr* e2)
+static Bool sameIRExprs(const FoldEnv* env, const IRExpr* e1, const IRExpr* e2)
{
Bool same;
@@ -1205,8 +1262,8 @@
--vex-iropt-level > 0, that is, vex_control.iropt_verbosity > 0.
Bad because it duplicates functionality from typeOfIRExpr. See
comment on the single use point below for rationale. */
-static
-Bool debug_only_hack_sameIRExprs_might_assert ( IRExpr* e1, IRExpr* e2 )
+static Bool
+debug_only_hack_sameIRExprs_might_assert(const IRExpr* e1, const IRExpr* e2)
{
if (e1->tag != e2->tag) return False;
switch (e1->tag) {
@@ -1224,7 +1281,7 @@
/* Is this literally IRExpr_Const(IRConst_U32(0)) ? */
-static Bool isZeroU32 ( IRExpr* e )
+static Bool isZeroU32(const IRExpr* e)
{
return toBool( e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_U32
@@ -1234,7 +1291,7 @@
/* Is this literally IRExpr_Const(IRConst_U64(0)) ?
Currently unused; commented out to avoid compiler warning */
#if 0
-static Bool isZeroU64 ( IRExpr* e )
+static Bool isZeroU64(const IRExpr* e)
{
return toBool( e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_U64
@@ -1243,7 +1300,7 @@
#endif
/* Is this literally IRExpr_Const(IRConst_V128(0)) ? */
-static Bool isZeroV128 ( IRExpr* e )
+static Bool isZeroV128(const IRExpr* e)
{
return toBool( e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_V128
@@ -1251,7 +1308,7 @@
}
/* Is this literally IRExpr_Const(IRConst_V256(0)) ? */
-static Bool isZeroV256 ( IRExpr* e )
+static Bool isZeroV256(const IRExpr* e)
{
return toBool( e->tag == Iex_Const
&& e->Iex.Const.con->tag == Ico_V256
@@ -1259,7 +1316,7 @@
}
/* Is this an integer constant with value 0 ? */
-static Bool isZeroU ( IRExpr* e )
+static Bool isZeroU(const IRExpr* e)
{
if (e->tag != Iex_Const) return False;
switch (e->Iex.Const.con->tag) {
@@ -1274,7 +1331,7 @@
}
/* Is this an integer constant with value 1---1b ? */
-static Bool isOnesU ( IRExpr* e )
+static Bool isOnesU(const IRExpr* e)
{
if (e->tag != Iex_Const) return False;
switch (e->Iex.Const.con->tag) {
@@ -1391,14 +1448,14 @@
return NULL if it can't resolve 'e' to a new expression, which will
be the case if 'e' is instead defined by an IRStmt (IRDirty or
LLSC). */
-static IRExpr* chase(IRExpr* env[], IRExpr* e)
+static IRExpr* chase(FoldEnv* env, IRExpr* e)
{
/* Why is this loop guaranteed to terminate? Because all tmps must
have definitions before use, hence a tmp cannot be bound
(directly or indirectly) to itself. */
while (e->tag == Iex_RdTmp) {
if (0) { vex_printf("chase "); ppIRExpr(e); vex_printf("\n"); }
- e = env[e->Iex.RdTmp.tmp.index];
+ e = findIRExpr(env, e->Iex.RdTmp.tmp);
if (e == NULL) break;
}
return e;
@@ -1413,7 +1470,7 @@
return env[e->Iex.RdTmp.tmp.index];
}
-static IRExpr* fold_Expr(IRExpr* env[], IRExpr* e)
+static IRExpr* fold_Expr(FoldEnv* env, IRExpr* e)
{
Int shift;
IRExpr* e2 = e; /* e2 is the result of folding e, if possible */
@@ -2473,13 +2530,12 @@
/* Apply the subst to a simple 1-level expression -- guaranteed to be
1-level due to previous flattening pass. */
-
-static IRExpr* subst_Expr(IRExpr* env[], IRExpr* ex)
+static IRExpr* subst_Expr(FoldEnv* env, IRExpr* ex)
{
switch (ex->tag) {
- case Iex_RdTmp:
- if (env[ex->Iex.RdTmp.tmp.index] != NULL) {
- IRExpr *rhs = env[ex->Iex.RdTmp.tmp.index];
+ case Iex_RdTmp: {
+ IRExpr* rhs = findIRExpr(env, ex->Iex.RdTmp.tmp);
+ if (rhs != NULL) {
if (rhs->tag == Iex_RdTmp)
return rhs;
if (rhs->tag == Iex_Const
@@ -2488,6 +2544,7 @@
}
/* not bound in env */
return ex;
+ }
case Iex_Const:
case Iex_Get:
@@ -2584,27 +2641,13 @@
}
}
-/* Set up the cprop env with which travels forward for the current IRStmtVec.
- This holds a substitution, mapping IRTemp.indices to IRExprs.
- Keys are IRTemp.indices. Values are IRExpr*s.
-*/
-static IRExpr** new_cprop_env(const IRTypeEnv* tyenv)
-{
- UInt n_tmps = tyenv->types_used;
- IRExpr** env = LibVEX_Alloc_inline(n_tmps * sizeof(IRExpr*));
- for (UInt i = 0; i < n_tmps; i++)
- env[i] = NULL;
- return env;
-}
-
-static IRStmtVec* subst_and_fold_Stmts(IRExpr* env[], IRStmtVec* in,
- IRStmtVec* parent);
+static IRStmtVec* subst_and_fold_Stmts(FoldEnv* env, IRStmtVec* in);
/* Apply the subst to stmt, then fold the result as much as possible.
Much simplified due to stmt being previously flattened. As a
result of this, the stmt may wind up being turned into a no-op.
*/
-static IRStmt* subst_and_fold_Stmt(IRExpr* env[], IRStmt* st, IRStmtVec* parent)
+static IRStmt* subst_and_fold_Stmt(FoldEnv* env, IRStmt* st)
{
# if 0
vex_printf("\nsubst and fold stmt\n");
@@ -2832,16 +2875,17 @@
It is necessary to rewrite indices of all IRTemp's in scope.
Not sure if this is possible or feasible. */
}
- return IRStmt_IfThenElse(fcond,
- subst_and_fold_Stmts(
- new_cprop_env(st->Ist.IfThenElse.then_leg->tyenv),
- st->Ist.IfThenElse.then_leg,
- parent),
- subst_and_fold_Stmts(
- new_cprop_env(st->Ist.IfThenElse.then_leg->tyenv),
- st->Ist.IfThenElse.else_leg,
- parent),
- st->Ist.IfThenElse.phi_nodes);
+
+ FoldEnv* then_env = newFoldEnv(st->Ist.IfThenElse.then_leg, env);
+ IRStmtVec* then_stmts = subst_and_fold_Stmts(then_env,
+ st->Ist.IfThenElse.then_leg);
+
+ FoldEnv* else_env = newFoldEnv(st->Ist.IfThenElse.else_leg, env);
+ IRStmtVec* else_stmts = subst_and_fold_Stmts(else_env,
+ st->Ist.IfThenElse.else_leg);
+
+ return IRStmt_IfThenElse(fcond, then_stmts, else_stmts,
+ st->Ist.IfThenElse.phi_nodes);
}
default:
@@ -2850,8 +2894,8 @@
}
}
-static
-IRStmtVec* subst_and_fold_Stmts(IRExpr* env[], IRStmtVec* in, IRStmtVec* parent)
+/* Is to be called with already created FoldEnv as per newFoldEnv(). */
+static IRStmtVec* subst_and_fold_Stmts(FoldEnv* env, IRStmtVec* in)
{
/* Keep track of IRStmt_LoadGs that we need to revisit after
processing all the other statements. */
@@ -2859,9 +2903,7 @@
Int fixups[N_FIXUPS]; /* indices in the stmt array of 'out' */
Int n_fixups = 0;
- IRStmtVec* out = emptyIRStmtVec();
- out->tyenv = deepCopyIRTypeEnv( in->tyenv );
- out->parent = parent;
+ IRStmtVec* out = env->stmts;
/* For each original SSA-form stmt ... */
for (UInt i = 0; i < in->stmts_used; i++) {
@@ -2876,7 +2918,7 @@
/* perhaps st2 is already a no-op? */
if (st2->tag == Ist_NoOp) continue;
- st2 = subst_and_fold_Stmt(env, st2, out);
+ st2 = subst_and_fold_Stmt(env, st2);
/* Deal with some post-folding special cases. */
switch (st2->tag) {
@@ -2891,8 +2933,7 @@
propagation and to allow sameIRExpr look through
IRTemps. */
case Ist_WrTmp: {
- vassert(env[st2->Ist.WrTmp.tmp.index] == NULL);
- env[st2->Ist.WrTmp.tmp.index] = st2->Ist.WrTmp.data;
+ setIRExpr(env, st2->Ist.WrTmp.tmp, st2->Ist.WrTmp.data);
/* 't1 = t2' -- don't add to BB; will be optimized out */
if (st2->Ist.WrTmp.data->tag == Iex_RdTmp)
@@ -2993,9 +3034,10 @@
IRSB* cprop_BB ( IRSB* in )
{
- IRExpr** env = new_cprop_env(in->stmts->tyenv);
+ FoldEnv* env = newFoldEnv(in->stmts, NULL);
IRSB* out = emptyIRSB();
- out->stmts = subst_and_fold_Stmts(env, in->stmts, NULL);
+ out->stmts = subst_and_fold_Stmts(env, in->stmts);
+ out->id_seq = in->id_seq;
out->next = subst_Expr( env, in->next );
out->jumpkind = in->jumpkind;
out->offsIP = in->offsIP;
@@ -6247,7 +6289,7 @@
case Iex_RdTmp:
ppIRTemp(e->Iex.RdTmp.tmp);
vex_printf("=");
- print_flat_expr(env, chase(env, e));
+ print_flat_expr(env, chase1(env, e));
break;
case Iex_Const:
case Iex_CCall:
|
|
From: <sv...@va...> - 2017-03-23 17:12:55
|
Author: iraisr
Date: Thu Mar 23 17:12:48 2017
New Revision: 16283
Log:
Use iteration rathen than recursion for accessing parent stuff.
Modified:
branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
Modified: branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
==============================================================================
--- branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c (original)
+++ branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c Thu Mar 23 17:12:48 2017
@@ -277,24 +277,26 @@
so far exists, allocate one. */
static IRTemp findShadowTmpV ( MCEnv* mce, IRTemp orig )
{
- if (mce->id == orig.id) {
- /* VG_(indexXA) range-checks 'orig', hence no need to check here. */
- TempMapEnt* ent = (TempMapEnt*) VG_(indexXA)(mce->tmpMap, orig.index);
+ while (mce->id != orig.id) {
+ mce = mce->parent;
+ tl_assert(mce != NULL);
+ }
+ tl_assert(mce->id == orig.id);
+
+ /* VG_(indexXA) range-checks 'orig', hence no need to check here. */
+ TempMapEnt* ent = (TempMapEnt*) VG_(indexXA)(mce->tmpMap, orig.index);
+ tl_assert(ent->kind == Orig);
+ if (isIRTempInvalid(ent->shadowV)) {
+ IRTemp tmpV = newTemp(mce, shadowTypeV(mce->tyenv->types[orig.index]),
+ VSh);
+ /* newTemp may cause mce->tmpMap to resize, hence previous results
+ from VG_(indexXA) are invalid. */
+ ent = (TempMapEnt*) VG_(indexXA)(mce->tmpMap, orig.index);
tl_assert(ent->kind == Orig);
- if (isIRTempInvalid(ent->shadowV)) {
- IRTemp tmpV = newTemp(mce, shadowTypeV(mce->tyenv->types[orig.index]),
- VSh);
- /* newTemp may cause mce->tmpMap to resize, hence previous results
- from VG_(indexXA) are invalid. */
- ent = (TempMapEnt*) VG_(indexXA)(mce->tmpMap, orig.index);
- tl_assert(ent->kind == Orig);
- tl_assert(isIRTempInvalid(ent->shadowV));
- ent->shadowV = tmpV;
- }
- return ent->shadowV;
- } else {
- return findShadowTmpV(mce->parent, orig);
+ tl_assert(isIRTempInvalid(ent->shadowV));
+ ent->shadowV = tmpV;
}
+ return ent->shadowV;
}
/* Allocate a new shadow for the given original tmp. This means any
@@ -384,12 +386,14 @@
if (a1->tag == Iex_Const)
return True;
if (a1->tag == Iex_RdTmp) {
- if (mce->id == a1->Iex.RdTmp.tmp.id) {
- TempMapEnt* ent = VG_(indexXA)(mce->tmpMap, a1->Iex.RdTmp.tmp.index);
- return ent->kind == Orig;
- } else {
- return isOriginalAtom(mce->parent, a1);
+ while (mce->id != a1->Iex.RdTmp.tmp.id) {
+ mce = mce->parent;
+ tl_assert(mce != NULL);
}
+ tl_assert(mce->id == a1->Iex.RdTmp.tmp.id);
+
+ TempMapEnt* ent = VG_(indexXA)(mce->tmpMap, a1->Iex.RdTmp.tmp.index);
+ return ent->kind == Orig;
}
return False;
}
@@ -401,12 +405,14 @@
if (a1->tag == Iex_Const)
return True;
if (a1->tag == Iex_RdTmp) {
- if (mce->id == a1->Iex.RdTmp.tmp.id) {
- TempMapEnt* ent = VG_(indexXA)(mce->tmpMap, a1->Iex.RdTmp.tmp.index);
- return ent->kind == VSh || ent->kind == BSh;
- } else {
- return isShadowAtom(mce->parent, a1);
+ while (mce->id != a1->Iex.RdTmp.tmp.id) {
+ mce = mce->parent;
+ tl_assert(mce != NULL);
}
+ tl_assert(mce->id == a1->Iex.RdTmp.tmp.id);
+
+ TempMapEnt* ent = VG_(indexXA)(mce->tmpMap, a1->Iex.RdTmp.tmp.index);
+ return ent->kind == VSh || ent->kind == BSh;
}
return False;
}
@@ -7045,23 +7051,25 @@
/* Almost identical to findShadowTmpV. */
static IRTemp findShadowTmpB ( MCEnv* mce, IRTemp orig )
{
- if (mce->id == orig.id) {
- /* VG_(indexXA) range-checks 'orig', hence no need to check here. */
- TempMapEnt* ent = (TempMapEnt*) VG_(indexXA)(mce->tmpMap, orig.index);
+ while (mce->id != orig.id) {
+ mce = mce->parent;
+ tl_assert(mce != NULL);
+ }
+ tl_assert(mce->id == orig.id);
+
+ /* VG_(indexXA) range-checks 'orig', hence no need to check here. */
+ TempMapEnt* ent = (TempMapEnt*) VG_(indexXA)(mce->tmpMap, orig.index);
+ tl_assert(ent->kind == Orig);
+ if (isIRTempInvalid(ent->shadowB)) {
+ IRTemp tmpB = newTemp( mce, Ity_I32, BSh );
+ /* newTemp may cause mce->tmpMap to resize, hence previous results
+ from VG_(indexXA) are invalid. */
+ ent = (TempMapEnt*) VG_(indexXA)(mce->tmpMap, orig.index);
tl_assert(ent->kind == Orig);
- if (isIRTempInvalid(ent->shadowB)) {
- IRTemp tmpB = newTemp( mce, Ity_I32, BSh );
- /* newTemp may cause mce->tmpMap to resize, hence previous results
- from VG_(indexXA) are invalid. */
- ent = (TempMapEnt*) VG_(indexXA)(mce->tmpMap, orig.index);
- tl_assert(ent->kind == Orig);
- tl_assert(isIRTempInvalid(ent->shadowB));
- ent->shadowB = tmpB;
- }
- return ent->shadowB;
- } else {
- return findShadowTmpB(mce->parent, orig);
+ tl_assert(isIRTempInvalid(ent->shadowB));
+ ent->shadowB = tmpB;
}
+ return ent->shadowB;
}
static IRAtom* gen_maxU32 ( MCEnv* mce, IRAtom* b1, IRAtom* b2 )
|
|
From: <sv...@va...> - 2017-03-23 17:12:17
|
Author: iraisr
Date: Thu Mar 23 17:12:09 2017
New Revision: 3327
Log:
Use iteration rather than recursion for accessing parent stuff.
Modified:
branches/VEX_JIT_HACKS/priv/ir_defs.c
branches/VEX_JIT_HACKS/pub/libvex_ir.h
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 Thu Mar 23 17:12:09 2017
@@ -3798,15 +3798,16 @@
IRType typeOfIRTemp(const IRStmtVec* stmts, IRTemp tmp)
{
const IRTypeEnv* tyenv = stmts->tyenv;
- if (tyenv->id == tmp.id) {
- vassert(tmp.index >= 0);
- vassert(tmp.index < tyenv->types_used);
- return tyenv->types[tmp.index];
- } else if (stmts->parent != NULL) {
- return typeOfIRTemp(stmts->parent, tmp);
- } else {
- vpanic("typeOfIRTemp");
+ while (tyenv->id != tmp.id) {
+ stmts = stmts->parent;
+ vassert(stmts != NULL);
+ tyenv = stmts->tyenv;
}
+
+ vassert(tyenv->id == tmp.id);
+ vassert(tmp.index >= 0);
+ vassert(tmp.index < tyenv->types_used);
+ return tyenv->types[tmp.index];
}
IRType typeOfIRConst ( const IRConst* con )
@@ -4154,13 +4155,16 @@
{
vassert(tmp.id != IRTyEnvID_INVALID);
- if (stmts->tyenv->id == tmp.id) {
- return True;
- }
- if (stmts->parent != NULL) {
- return inScopeIRTemp(stmts->parent, tmp);
+ const IRTypeEnv* tyenv = stmts->tyenv;
+ while (tyenv->id != tmp.id) {
+ stmts = stmts->parent;
+ if (stmts == NULL)
+ return False;
+ tyenv = stmts->tyenv;
}
- return False;
+
+ vassert(tyenv->id == tmp.id);
+ return True;
}
static
Modified: branches/VEX_JIT_HACKS/pub/libvex_ir.h
==============================================================================
--- branches/VEX_JIT_HACKS/pub/libvex_ir.h (original)
+++ branches/VEX_JIT_HACKS/pub/libvex_ir.h Thu Mar 23 17:12:09 2017
@@ -2828,7 +2828,9 @@
Such an IRStmtVec needs to have a valid IRTyEnvId - get it from
nextIRTyEnvID(). Only after this is done, then such an IRStmtVec is ready
for newIRTemp() to give out new temporaries.
- Nested IRStmtVec also needs to have correctly set its parent. */
+ Nested IRStmtVec also needs to have correctly set its parent.
+
+ Function addEmptyIfThenElse() can be used conveniently instead. */
extern IRStmtVec* emptyIRStmtVec(void);
extern IRStmtVec* deepCopyIRStmtVec(const IRStmtVec* src, IRStmtVec* parent);
@@ -3206,6 +3208,11 @@
extern IRTyEnvID nextIRTyEnvID(IRSB*);
+/* Allocates an empty IfThenElse, assigns it a valid IRTyEnvID
+ and sets the parent for both then and else legs.
+ The returned IRStmt is added to the parent IRStmtVec and ready to be used. */
+extern IRStmt *addEmptyIfThenElse(IRSB* bb, IRStmtVec* parent, IRExpr* cond);
+
/*---------------------------------------------------------------*/
/*--- Helper functions for the IR ---*/
/*---------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2017-03-23 09:17:00
|
Author: iraisr
Date: Thu Mar 23 09:16:52 2017
New Revision: 16282
Log:
Make phi_nodes non-optional for IfThenElse.
Modified:
branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
Modified: branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c
==============================================================================
--- branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c (original)
+++ branches/VALGRIND_JIT_HACKS/memcheck/mc_translate.c Thu Mar 23 09:16:52 2017
@@ -6295,17 +6295,14 @@
initMCEnv(else_leg, &else_mce, mce);
instrument_IRStmtVec(else_leg, 0, &else_mce);
- IRPhiVec* phi_nodes_out = NULL;
- if (phi_nodes_in != NULL) {
- phi_nodes_out = emptyIRPhiVec();
- for (UInt i = 0; i < phi_nodes_in->phis_used; i++) {
- IRPhi* phi_in = phi_nodes_in->phis[i];
- IRPhi* phi_shadow = mkIRPhi(findShadowTmp(mce, phi_in->dst),
- findShadowTmp(&then_mce, phi_in->srcThen),
- findShadowTmp(&else_mce, phi_in->srcElse));
- phi(category, mce, phi_nodes_out, phi_shadow);
- phi('C', mce, phi_nodes_out, phi_in);
- }
+ IRPhiVec* phi_nodes_out = emptyIRPhiVec();
+ for (UInt i = 0; i < phi_nodes_in->phis_used; i++) {
+ IRPhi* phi_in = phi_nodes_in->phis[i];
+ IRPhi* phi_shadow = mkIRPhi(findShadowTmp(mce, phi_in->dst),
+ findShadowTmp(&then_mce, phi_in->srcThen),
+ findShadowTmp(&else_mce, phi_in->srcElse));
+ phi(category, mce, phi_nodes_out, phi_shadow);
+ phi('C', mce, phi_nodes_out, phi_in);
}
stmt(category, mce, IRStmt_IfThenElse(cond, then_mce.stmts, else_mce.stmts,
|
|
From: <sv...@va...> - 2017-03-23 09:16:33
|
Author: iraisr
Date: Thu Mar 23 09:16:25 2017
New Revision: 3326
Log:
Add new function addEmptyIfThenElse().
Make phi_nodes non-optional for IfThenElse.
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 Thu Mar 23 09:16:25 2017
@@ -1693,10 +1693,7 @@
ppIRStmtVec_wrk(s->Ist.IfThenElse.else_leg, depth + 1);
print_depth(depth);
vex_printf("}\n");
- IRPhiVec* phi_nodes = s->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- ppIRPhiVec_wrk(phi_nodes, depth);
- }
+ ppIRPhiVec_wrk(s->Ist.IfThenElse.phi_nodes, depth);
break;
default:
vpanic("ppIRStmt");
@@ -3747,6 +3744,20 @@
addStmtToIRStmtVec(bb->stmts, st);
}
+IRStmt *addEmptyIfThenElse(IRSB* bb, IRStmtVec* parent, IRExpr* cond)
+{
+ IRStmtVec* then_leg = emptyIRStmtVec();
+ then_leg->tyenv->id = nextIRTyEnvID(bb);
+ then_leg->parent = parent;
+
+ IRStmtVec* else_leg = emptyIRStmtVec();
+ else_leg->tyenv->id = nextIRTyEnvID(bb);
+ else_leg->parent = parent;
+
+ IRStmt* st = IRStmt_IfThenElse(cond, then_leg, else_leg, emptyIRPhiVec());
+ addStmtToIRStmtVec(parent, st);
+ return st;
+}
/*---------------------------------------------------------------*/
/*--- Helper functions for the IR -- IR Type Environments ---*/
@@ -5062,10 +5073,8 @@
n_stmt_vecs, id_counts, gWordTy);
sanityCheckIRStmtVec(bb, else_leg, require_flat, def_counts,
n_stmt_vecs, id_counts, gWordTy);
- if (stmt->Ist.IfThenElse.phi_nodes != NULL) {
- sanityCheckIRPhiNodes(bb, stmts, stmt,
- stmt->Ist.IfThenElse.phi_nodes, def_counts);
- }
+ sanityCheckIRPhiNodes(bb, stmts, stmt,
+ stmt->Ist.IfThenElse.phi_nodes, def_counts);
}
}
}
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 Thu Mar 23 09:16:25 2017
@@ -3166,12 +3166,10 @@
Bool* else_set = new_deadcode_set(st->Ist.IfThenElse.then_leg->tyenv);
IRPhiVec* phi_nodes = st->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- const IRPhi* phi = phi_nodes->phis[i];
- addUses_Temp(then_set, phi->srcThen);
- addUses_Temp(else_set, phi->srcElse);
- }
+ for (UInt i = 0; i < phi_nodes->phis_used; i++) {
+ const IRPhi* phi = phi_nodes->phis[i];
+ addUses_Temp(then_set, phi->srcThen);
+ addUses_Temp(else_set, phi->srcElse);
}
Int i_unconditional_exit; // TODO-JIT: unused at the moment
@@ -4852,10 +4850,8 @@
deltaIRStmtVec(st->Ist.IfThenElse.else_leg, delta, id);
IRPhiVec* phi_nodes = st->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- deltaIRTemp(&phi_nodes->phis[i]->dst, delta, id);
- }
+ for (UInt i = 0; i < phi_nodes->phis_used; i++) {
+ deltaIRTemp(&phi_nodes->phis[i]->dst, delta, id);
}
break;
}
@@ -5409,10 +5405,8 @@
case Ist_IfThenElse: {
aoccCount_Expr(uses, st->Ist.IfThenElse.cond);
IRPhiVec* phi_nodes = st->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- for (UInt i = 0; i < phi_nodes->phis_used; i++) {
- uses[phi_nodes->phis[i]->dst.index]++;
- }
+ for (UInt i = 0; i < phi_nodes->phis_used; i++) {
+ uses[phi_nodes->phis[i]->dst.index]++;
}
return;
}
@@ -6177,14 +6171,12 @@
IRStmtVec* then_leg = st->Ist.IfThenElse.then_leg;
IRStmtVec* else_leg = st->Ist.IfThenElse.else_leg;
IRPhiVec* phi_nodes = st->Ist.IfThenElse.phi_nodes;
- if (phi_nodes != NULL) {
- for (UInt j = 0; j < phi_nodes->phis_used; j++) {
- IRPhi* phi = phi_nodes->phis[j];
- addStmtToIRStmtVec(then_leg, IRStmt_WrTmp(phi->dst,
- IRExpr_RdTmp(phi->srcThen)));
- addStmtToIRStmtVec(else_leg, IRStmt_WrTmp(phi->dst,
- IRExpr_RdTmp(phi->srcElse)));
- }
+ for (UInt j = 0; j < phi_nodes->phis_used; j++) {
+ IRPhi* phi = phi_nodes->phis[j];
+ addStmtToIRStmtVec(then_leg, IRStmt_WrTmp(phi->dst,
+ IRExpr_RdTmp(phi->srcThen)));
+ addStmtToIRStmtVec(else_leg, IRStmt_WrTmp(phi->dst,
+ IRExpr_RdTmp(phi->srcElse)));
}
deconstruct_phi_nodes_IRStmtVec(then_leg);
|
|
From: <sv...@va...> - 2017-03-23 08:58:01
|
Author: iraisr
Date: Thu Mar 23 08:57:52 2017
New Revision: 3325
Log:
Use ppIRStmt_wrk() also in VEX/priv/guest_amd64_toIR.c.
Modified:
branches/VEX_JIT_HACKS/priv/guest_amd64_toIR.c
Modified: branches/VEX_JIT_HACKS/priv/guest_amd64_toIR.c
==============================================================================
--- branches/VEX_JIT_HACKS/priv/guest_amd64_toIR.c (original)
+++ branches/VEX_JIT_HACKS/priv/guest_amd64_toIR.c Thu Mar 23 08:57:52 2017
@@ -32374,8 +32374,7 @@
callback_opaque,
delta, archinfo, abiinfo, sigill_diag_IN );
for (i = x1; i < x2; i++) {
- vex_printf("\t\t");
- ppIRStmt(irsb_IN->stmts[i]);
+ ppIRStmt_wrk(irsb_IN->stmts[i], 4);
vex_printf("\n");
}
/* Failure of this assertion is serious and denotes a bug in
|