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
(1) |
2
(3) |
3
(1) |
4
(2) |
|
5
|
6
|
7
(4) |
8
|
9
(2) |
10
|
11
(2) |
|
12
|
13
(3) |
14
(7) |
15
(4) |
16
(2) |
17
|
18
|
|
19
|
20
(1) |
21
(2) |
22
|
23
|
24
|
25
|
|
26
|
27
(1) |
28
|
29
|
30
|
|
|
|
From: Philippe W. <phi...@so...> - 2017-11-07 20:45:22
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=cc897604813cee1f5d3c614c76e5ca9ce696e6c3 commit cc897604813cee1f5d3c614c76e5ca9ce696e6c3 Author: Philippe Waroquiers <phi...@sk...> Date: Sat Nov 4 23:32:19 2017 +0100 Improve efficiency of SP tracking in helgrind (and incidentally in exp-sgheck) Helgrind (and incidentally exp-sgcheck) does not need both of tracking new mem stack and die mem stack: Helgrind only tracks new mem stack. exp-sgcheck only tracks die mem stack. Currently, m_translate.c vg_SP_update_pass inserts helpers calls for new and die mem stack, even if the tool only needs new mem stack (helgrind) or die mem stack (exp-sgcheck). The optimisation consists in not inserting helpers calls when the tool does not need to see new (or die) mem stack. Also, for helgrind, implement specialised new_mem_stack for known SP updates with small values (like memcheck). This reduces the size of the generated code for helgrind and exp-sgcheck. (see below the diffs on perf/memrw). This does not impact the code generation for tools that tracks both new and die mem stack (such as memcheck). trunk: exp-sgcheck: --28481-- transtab: new 2,256 (44,529 -> 581,402; ratio 13.1) [0 scs] avg tce size 257 helgrind: --28496-- transtab: new 2,299 (46,667 -> 416,575; ratio 8.9) [0 scs] avg tce size 181 memcheck: --28501-- transtab: new 2,220 (50,038 -> 777,139; ratio 15.5) [0 scs] avg tce size 350 with this patch: exp-sgcheck: --28516-- transtab: new 2,254 (44,479 -> 567,196; ratio 12.8) [0 scs] avg tce size 251 helgrind: --28512-- transtab: new 2,297 (46,620 -> 399,799; ratio 8.6) [0 scs] avg tce size 174 memcheck: --28507-- transtab: new 2,219 (49,991 -> 776,028; ratio 15.5) [0 scs] avg tce size 349 More in details, the changes consist in: pub_core_tooliface.h: * add 2 booleans any_new_mem_stack and any_die_mem_stack to the tdict struct * renamed VG_(sanity_check_needs) to VG_(finish_needs_init), as it does now more than sanity checks : it derives the 2 above booleans. m_tooliface.c: * change VG_(sanity_check_needs) to VG_(finish_needs_init) m_main.c: * update call to VG_(sanity_check_needs) hg_main.c: * add a few inlines for functions just calling another function * define the functions evh__new_mem_stack_[4|8|12|16|32|112|128|144|160] (using the macro DCL_evh__new_mem_stack). * call the VG_(track_new_mem_stack_[4|8|12|16|32|112|128|144|160]) m_translate.c * n_SP_updates_* stats are now maintained separately for the new and die fast and known cases. * need_to_handle_SP_assignment can now check only the 2 booleans any_new_mem_stack and any_die_mem_stack * DO_NEW macro: does not insert anymore a helper call if the tool does not track 'new' mem_stack. In case there is no new tracking, it however still does update the SP aliases (and the n_SP_updates_new_fast). * similar changes for DO_DIE macro. * a bunch of white spaces changes Note: it is easier to look at the changes in this file using git diff -w to ignore the white spaces changes (e.g. due to DO_NEW/DO_DIE indentation changes). regtested on debian/amd64 and on centos/ppc64 Diff: --- coregrind/m_main.c | 4 +- coregrind/m_tooliface.c | 9 ++- coregrind/m_translate.c | 175 ++++++++++++++++++++++------------------- coregrind/pub_core_tooliface.h | 8 +- helgrind/hg_main.c | 44 ++++++++++- 5 files changed, 149 insertions(+), 91 deletions(-) diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 4526b12..e3d5f65 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1651,10 +1651,10 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) { /* The tool's "needs" will by now be finalised, since it has no further opportunity to specify them. So now sanity check - them. */ + and finish initialising the needs. */ const HChar* s; Bool ok; - ok = VG_(sanity_check_needs)( &s ); + ok = VG_(finish_needs_init)( &s ); if (!ok) { VG_(core_panic)(s); } diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index 31b5f6c..d2e7ad9 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -103,7 +103,7 @@ VgNeeds VG_(needs) = { }; /* static */ -Bool VG_(sanity_check_needs)(const HChar** failmsg) +Bool VG_(finish_needs_init)(const HChar** failmsg) { Bool any_new_mem_stack_N, any_new_mem_stack_N_w_ECU; Bool any_new_mem_stack_w_conflicting_otags; @@ -124,7 +124,7 @@ Bool VG_(sanity_check_needs)(const HChar** failmsg) /* Check that new_mem_stack is defined if any new_mem_stack_N are. */ - any_new_mem_stack_N + any_new_mem_stack_N = VG_(tdict).track_new_mem_stack_4 || VG_(tdict).track_new_mem_stack_8 || VG_(tdict).track_new_mem_stack_12 || @@ -182,6 +182,9 @@ Bool VG_(sanity_check_needs)(const HChar** failmsg) " but you can only have one or the other (not both)\n"; return False; } + VG_(tdict).any_new_mem_stack + = VG_(tdict).track_new_mem_stack || VG_(tdict).track_new_mem_stack_w_ECU + || any_new_mem_stack_N || any_new_mem_stack_N_w_ECU; /* Check that die_mem_stack is defined if any die_mem_stack_N are. */ @@ -202,6 +205,8 @@ Bool VG_(sanity_check_needs)(const HChar** failmsg) " 'die_mem_stack' should be defined\n"; return False; } + VG_(tdict).any_die_mem_stack + = VG_(tdict).track_die_mem_stack || any_die_mem_stack_N; return True; diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index 55c845d..d03df5d 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -66,8 +66,10 @@ /*--- Stats ---*/ /*------------------------------------------------------------*/ -static ULong n_SP_updates_fast = 0; -static ULong n_SP_updates_generic_known = 0; +static ULong n_SP_updates_new_fast = 0; +static ULong n_SP_updates_new_generic_known = 0; +static ULong n_SP_updates_die_fast = 0; +static ULong n_SP_updates_die_generic_known = 0; static ULong n_SP_updates_generic_unknown = 0; static ULong n_PX_VexRegUpdSpAtMemAccess = 0; @@ -77,19 +79,25 @@ static ULong n_PX_VexRegUpdAllregsAtEachInsn = 0; void VG_(print_translation_stats) ( void ) { - UInt n_SP_updates = n_SP_updates_fast + n_SP_updates_generic_known - + n_SP_updates_generic_unknown; + UInt n_SP_updates = n_SP_updates_new_fast + n_SP_updates_new_generic_known + + n_SP_updates_die_fast + n_SP_updates_die_generic_known + + n_SP_updates_generic_unknown; if (n_SP_updates == 0) { VG_(message)(Vg_DebugMsg, "translate: no SP updates identified\n"); } else { VG_(message)(Vg_DebugMsg, - "translate: fast SP updates identified: %'llu (%3.1f%%)\n", - n_SP_updates_fast, n_SP_updates_fast * 100.0 / n_SP_updates ); + "translate: fast new/die SP updates identified: " + "%'llu (%3.1f%%)/%'llu (%3.1f%%)\n", + n_SP_updates_new_fast, n_SP_updates_new_fast * 100.0 / n_SP_updates, + n_SP_updates_die_fast, n_SP_updates_die_fast * 100.0 / n_SP_updates ); VG_(message)(Vg_DebugMsg, - "translate: generic_known SP updates identified: %'llu (%3.1f%%)\n", - n_SP_updates_generic_known, - n_SP_updates_generic_known * 100.0 / n_SP_updates ); + "translate: generic_known new/die SP updates identified: " + "%'llu (%3.1f%%)/%'llu (%3.1f%%)\n", + n_SP_updates_new_generic_known, + n_SP_updates_new_generic_known * 100.0 / n_SP_updates, + n_SP_updates_die_generic_known, + n_SP_updates_die_generic_known * 100.0 / n_SP_updates ); VG_(message)(Vg_DebugMsg, "translate: generic_unknown SP updates identified: %'llu (%3.1f%%)\n", @@ -97,8 +105,12 @@ void VG_(print_translation_stats) ( void ) n_SP_updates_generic_unknown * 100.0 / n_SP_updates ); } - VG_(message)(Vg_DebugMsg, - "translate: PX: SPonly %'llu, UnwRegs %'llu, AllRegs %'llu, AllRegsAllInsns %'llu\n", n_PX_VexRegUpdSpAtMemAccess, n_PX_VexRegUpdUnwindregsAtMemAccess, n_PX_VexRegUpdAllregsAtMemAccess, n_PX_VexRegUpdAllregsAtEachInsn); + VG_(message) + (Vg_DebugMsg, + "translate: PX: SPonly %'llu, UnwRegs %'llu," + " AllRegs %'llu, AllRegsAllInsns %'llu\n", + n_PX_VexRegUpdSpAtMemAccess, n_PX_VexRegUpdUnwindregsAtMemAccess, + n_PX_VexRegUpdAllregsAtMemAccess, n_PX_VexRegUpdAllregsAtEachInsn); } /*------------------------------------------------------------*/ @@ -107,26 +119,7 @@ void VG_(print_translation_stats) ( void ) static Bool need_to_handle_SP_assignment(void) { - return ( VG_(tdict).track_new_mem_stack_4 || - VG_(tdict).track_die_mem_stack_4 || - VG_(tdict).track_new_mem_stack_8 || - VG_(tdict).track_die_mem_stack_8 || - VG_(tdict).track_new_mem_stack_12 || - VG_(tdict).track_die_mem_stack_12 || - VG_(tdict).track_new_mem_stack_16 || - VG_(tdict).track_die_mem_stack_16 || - VG_(tdict).track_new_mem_stack_32 || - VG_(tdict).track_die_mem_stack_32 || - VG_(tdict).track_new_mem_stack_112 || - VG_(tdict).track_die_mem_stack_112 || - VG_(tdict).track_new_mem_stack_128 || - VG_(tdict).track_die_mem_stack_128 || - VG_(tdict).track_new_mem_stack_144 || - VG_(tdict).track_die_mem_stack_144 || - VG_(tdict).track_new_mem_stack_160 || - VG_(tdict).track_die_mem_stack_160 || - VG_(tdict).track_new_mem_stack || - VG_(tdict).track_die_mem_stack ); + return VG_(tdict).any_new_mem_stack || VG_(tdict).any_die_mem_stack; } // - The SP aliases are held in an array which is used as a circular buffer. @@ -321,72 +314,82 @@ IRSB* vg_SP_update_pass ( void* closureV, vanilla = NULL != VG_(tdict).track_new_mem_stack_##syze; \ w_ecu = NULL != VG_(tdict).track_new_mem_stack_##syze##_w_ECU; \ vg_assert(!(vanilla && w_ecu)); /* can't have both */ \ - if (!(vanilla || w_ecu)) \ + if (VG_(tdict).any_new_mem_stack \ + && !vanilla && !w_ecu) { \ + n_SP_updates_new_generic_known++; \ goto generic; \ - \ - /* I don't know if it's really necessary to say that the */ \ - /* call reads the stack pointer. But anyway, we do. */ \ - if (w_ecu) { \ - dcall = unsafeIRDirty_0_N( \ - 2/*regparms*/, \ - "track_new_mem_stack_" #syze "_w_ECU", \ - VG_(fnptr_to_fnentry)( \ - VG_(tdict).track_new_mem_stack_##syze##_w_ECU ), \ - mkIRExprVec_2(IRExpr_RdTmp(tmpp), \ - mk_ecu_Expr(curr_IP)) \ - ); \ - } else { \ - dcall = unsafeIRDirty_0_N( \ - 1/*regparms*/, \ - "track_new_mem_stack_" #syze , \ - VG_(fnptr_to_fnentry)( \ - VG_(tdict).track_new_mem_stack_##syze ), \ - mkIRExprVec_1(IRExpr_RdTmp(tmpp)) \ - ); \ } \ - dcall->nFxState = 1; \ - dcall->fxState[0].fx = Ifx_Read; \ - dcall->fxState[0].offset = layout->offset_SP; \ - dcall->fxState[0].size = layout->sizeof_SP; \ - dcall->fxState[0].nRepeats = 0; \ - dcall->fxState[0].repeatLen = 0; \ \ - addStmtToIRSB( bb, IRStmt_Dirty(dcall) ); \ + if (VG_(tdict).any_new_mem_stack) { \ + /* I don't know if it's really necessary to say that the */ \ + /* call reads the stack pointer. But anyway, we do. */ \ + if (w_ecu) { \ + dcall = unsafeIRDirty_0_N( \ + 2/*regparms*/, \ + "track_new_mem_stack_" #syze "_w_ECU", \ + VG_(fnptr_to_fnentry)( \ + VG_(tdict).track_new_mem_stack_##syze##_w_ECU ), \ + mkIRExprVec_2(IRExpr_RdTmp(tmpp), \ + mk_ecu_Expr(curr_IP)) \ + ); \ + } else { \ + dcall = unsafeIRDirty_0_N( \ + 1/*regparms*/, \ + "track_new_mem_stack_" #syze , \ + VG_(fnptr_to_fnentry)( \ + VG_(tdict).track_new_mem_stack_##syze ), \ + mkIRExprVec_1(IRExpr_RdTmp(tmpp)) \ + ); \ + } \ + dcall->nFxState = 1; \ + dcall->fxState[0].fx = Ifx_Read; \ + dcall->fxState[0].offset = layout->offset_SP; \ + dcall->fxState[0].size = layout->sizeof_SP; \ + dcall->fxState[0].nRepeats = 0; \ + dcall->fxState[0].repeatLen = 0; \ + \ + addStmtToIRSB( bb, IRStmt_Dirty(dcall) ); \ + } \ \ vg_assert(syze > 0); \ update_SP_aliases(syze); \ \ - n_SP_updates_fast++; \ + n_SP_updates_new_fast++; \ \ } while (0) # define DO_DIE(syze, tmpp) \ do { \ - if (!VG_(tdict).track_die_mem_stack_##syze) \ + if (VG_(tdict).any_die_mem_stack \ + && !VG_(tdict).track_die_mem_stack_##syze) { \ + n_SP_updates_die_generic_known++; \ goto generic; \ + } \ \ - /* I don't know if it's really necessary to say that the */ \ - /* call reads the stack pointer. But anyway, we do. */ \ - dcall = unsafeIRDirty_0_N( \ - 1/*regparms*/, \ - "track_die_mem_stack_" #syze, \ - VG_(fnptr_to_fnentry)( \ - VG_(tdict).track_die_mem_stack_##syze ), \ - mkIRExprVec_1(IRExpr_RdTmp(tmpp)) \ - ); \ - dcall->nFxState = 1; \ - dcall->fxState[0].fx = Ifx_Read; \ - dcall->fxState[0].offset = layout->offset_SP; \ - dcall->fxState[0].size = layout->sizeof_SP; \ - dcall->fxState[0].nRepeats = 0; \ - dcall->fxState[0].repeatLen = 0; \ + if (VG_(tdict).any_die_mem_stack) { \ + /* I don't know if it's really necessary to say that the */ \ + /* call reads the stack pointer. But anyway, we do. */ \ + dcall = unsafeIRDirty_0_N( \ + 1/*regparms*/, \ + "track_die_mem_stack_" #syze, \ + VG_(fnptr_to_fnentry)( \ + VG_(tdict).track_die_mem_stack_##syze ), \ + mkIRExprVec_1(IRExpr_RdTmp(tmpp)) \ + ); \ + dcall->nFxState = 1; \ + dcall->fxState[0].fx = Ifx_Read; \ + dcall->fxState[0].offset = layout->offset_SP; \ + dcall->fxState[0].size = layout->sizeof_SP; \ + dcall->fxState[0].nRepeats = 0; \ + dcall->fxState[0].repeatLen = 0; \ \ - addStmtToIRSB( bb, IRStmt_Dirty(dcall) ); \ + addStmtToIRSB( bb, IRStmt_Dirty(dcall) ); \ + } \ \ vg_assert(syze > 0); \ update_SP_aliases(-(syze)); \ \ - n_SP_updates_fast++; \ + n_SP_updates_die_fast++; \ \ } while (0) @@ -497,10 +500,18 @@ IRSB* vg_SP_update_pass ( void* closureV, case -144: DO_NEW( 144, tttmp); addStmtToIRSB(bb,st); continue; case 160: DO_DIE( 160, tttmp); addStmtToIRSB(bb,st); continue; case -160: DO_NEW( 160, tttmp); addStmtToIRSB(bb,st); continue; - default: - /* common values for ppc64: 144 128 160 112 176 */ - n_SP_updates_generic_known++; - goto generic; + default: + if (delta > 0) { + n_SP_updates_die_generic_known++; + if (VG_(tdict).any_die_mem_stack) + goto generic; + } else { + n_SP_updates_new_generic_known++; + if (VG_(tdict).any_new_mem_stack) + goto generic; + } + /* No tracking for delta. Just add the original statement. */ + addStmtToIRSB(bb,st); continue; } } else { /* Deal with an unknown update to SP. We're here because diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index e02969d..7fb8117 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -211,6 +211,8 @@ typedef struct { void VG_REGPARM(1) (*track_new_mem_stack_160)(Addr); void (*track_new_mem_stack)(Addr,SizeT); + Bool any_new_mem_stack; // True if one or more track_new_mem_stack is set + void VG_REGPARM(1) (*track_die_mem_stack_4) (Addr); void VG_REGPARM(1) (*track_die_mem_stack_8) (Addr); void VG_REGPARM(1) (*track_die_mem_stack_12) (Addr); @@ -222,6 +224,8 @@ typedef struct { void VG_REGPARM(1) (*track_die_mem_stack_160)(Addr); void (*track_die_mem_stack)(Addr, SizeT); + Bool any_die_mem_stack; // True if one or more track_die_mem_stack is set + void (*track_ban_mem_stack)(Addr, SizeT); void (*track_pre_mem_read) (CorePart, ThreadId, const HChar*, Addr, SizeT); @@ -255,7 +259,9 @@ extern VgToolInterface VG_(tdict); Miscellaneous functions ------------------------------------------------------------------ */ -Bool VG_(sanity_check_needs) ( const HChar** failmsg ); +/* Sanity checks and finish the initialisation of the tool needs. + Returns False and sets a failmsg if the needs are inconsistent. */ +Bool VG_(finish_needs_init) ( const HChar** failmsg ); #endif // __PUB_CORE_TOOLIFACE_H diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 95945f3..e68ff2d 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -1032,12 +1032,13 @@ static void shadow_mem_cwrite_range ( Thread* thr, Addr a, SizeT len ) { LIBHB_CWRITE_N(hbthr, a, len); } -static void shadow_mem_make_New ( Thread* thr, Addr a, SizeT len ) +inline static void shadow_mem_make_New ( Thread* thr, Addr a, SizeT len ) { libhb_srange_new( thr->hbthr, a, len ); } -static void shadow_mem_make_NoAccess_NoFX ( Thread* thr, Addr aIN, SizeT len ) +inline static void shadow_mem_make_NoAccess_NoFX ( Thread* thr, Addr aIN, + SizeT len ) { if (0 && len > 500) VG_(printf)("make NoAccess_NoFX ( %#lx, %lu )\n", aIN, len ); @@ -1045,7 +1046,8 @@ static void shadow_mem_make_NoAccess_NoFX ( Thread* thr, Addr aIN, SizeT len ) libhb_srange_noaccess_NoFX( thr->hbthr, aIN, len ); } -static void shadow_mem_make_NoAccess_AHAE ( Thread* thr, Addr aIN, SizeT len ) +inline static void shadow_mem_make_NoAccess_AHAE ( Thread* thr, Addr aIN, + SizeT len) { if (0 && len > 500) VG_(printf)("make NoAccess_AHAE ( %#lx, %lu )\n", aIN, len ); @@ -1053,7 +1055,8 @@ static void shadow_mem_make_NoAccess_AHAE ( Thread* thr, Addr aIN, SizeT len ) libhb_srange_noaccess_AHAE( thr->hbthr, aIN, len ); } -static void shadow_mem_make_Untracked ( Thread* thr, Addr aIN, SizeT len ) +inline static void shadow_mem_make_Untracked ( Thread* thr, Addr aIN, + SizeT len ) { if (0 && len > 500) VG_(printf)("make Untracked ( %#lx, %lu )\n", aIN, len ); @@ -1488,6 +1491,30 @@ void evh__new_mem_stack ( Addr a, SizeT len ) { shadow_mem_make_Untracked( thr, a, len ); } +#define DCL_evh__new_mem_stack(syze) \ +static void VG_REGPARM(1) evh__new_mem_stack_##syze(Addr new_SP) \ +{ \ + Thread *thr = get_current_Thread(); \ + if (SHOW_EVENTS >= 2) \ + VG_(printf)("evh__new_mem_stack_" #syze "(%p, %lu)\n", \ + (void*)new_SP, (SizeT)syze ); \ + shadow_mem_make_New( thr, -VG_STACK_REDZONE_SZB + new_SP, syze ); \ + if (syze >= SCE_BIGRANGE_T && (HG_(clo_sanity_flags) & SCE_BIGRANGE)) \ + all__sanity_check("evh__new_mem_stack_" #syze "-post"); \ + if (UNLIKELY(thr->pthread_create_nesting_level > 0)) \ + shadow_mem_make_Untracked( thr, new_SP, syze ); \ +} + +DCL_evh__new_mem_stack(4); +DCL_evh__new_mem_stack(8); +DCL_evh__new_mem_stack(12); +DCL_evh__new_mem_stack(16); +DCL_evh__new_mem_stack(32); +DCL_evh__new_mem_stack(112); +DCL_evh__new_mem_stack(128); +DCL_evh__new_mem_stack(144); +DCL_evh__new_mem_stack(160); + static void evh__new_mem_w_tid ( Addr a, SizeT len, ThreadId tid ) { Thread *thr = get_current_Thread(); @@ -6028,6 +6055,15 @@ static void hg_pre_clo_init ( void ) VG_(track_new_mem_brk) ( evh__new_mem_w_tid ); VG_(track_new_mem_mmap) ( evh__new_mem_w_perms ); VG_(track_new_mem_stack) ( evh__new_mem_stack ); + VG_(track_new_mem_stack_4) ( evh__new_mem_stack_4 ); + VG_(track_new_mem_stack_8) ( evh__new_mem_stack_8 ); + VG_(track_new_mem_stack_12) ( evh__new_mem_stack_12 ); + VG_(track_new_mem_stack_16) ( evh__new_mem_stack_16 ); + VG_(track_new_mem_stack_32) ( evh__new_mem_stack_32 ); + VG_(track_new_mem_stack_112) ( evh__new_mem_stack_112 ); + VG_(track_new_mem_stack_128) ( evh__new_mem_stack_128 ); + VG_(track_new_mem_stack_144) ( evh__new_mem_stack_144 ); + VG_(track_new_mem_stack_160) ( evh__new_mem_stack_160 ); // FIXME: surely this isn't thread-aware VG_(track_copy_mem_remap) ( evh__copy_mem ); |
|
From: Philippe W. <phi...@so...> - 2017-11-07 20:45:07
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=4d621f651033304e3f9d57f673dc872b662c2871 commit 4d621f651033304e3f9d57f673dc872b662c2871 Author: Philippe Waroquiers <phi...@sk...> Date: Sat Nov 4 23:31:19 2017 +0100 Move or conditionalise on CHECK_CEM some expensive asserts * Some RCEC related asserts checking there was no corruption are on hot paths => make these checks only when CHECK_CEM is set. * Move an expensive assert where the event is inserted, as it is useless to check this when searching for an already existing event : it is enough to ensure that an invalid szB cannot be inserted, and so will not be found, and so assert will trigger in the insertion logic. Diff: --- helgrind/libhb_core.c | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c index 7fbcdda..792a374 100644 --- a/helgrind/libhb_core.c +++ b/helgrind/libhb_core.c @@ -4305,8 +4305,10 @@ static UWord RCEC_referenced = 0; /* True if the frames of ec1 and ec2 are different. */ static Bool RCEC__differs_by_frames ( RCEC* ec1, RCEC* ec2 ) { Word i; - tl_assert(ec1 && ec1->magic == RCEC_MAGIC); - tl_assert(ec2 && ec2->magic == RCEC_MAGIC); + if (CHECK_CEM) { + tl_assert(ec1 && ec1->magic == RCEC_MAGIC); + tl_assert(ec2 && ec2->magic == RCEC_MAGIC); + } if (ec1->frames_hash != ec2->frames_hash) return True; for (i = 0; i < N_FRAMES; i++) { if (ec1->frames[i] != ec2->frames[i]) return True; @@ -4318,7 +4320,8 @@ static Bool RCEC__differs_by_frames ( RCEC* ec1, RCEC* ec2 ) { static void ctxt__rcdec ( RCEC* ec ) { stats__ctxt_rcdec_calls++; - tl_assert(ec && ec->magic == RCEC_MAGIC); + if (CHECK_CEM) + tl_assert(ec && ec->magic == RCEC_MAGIC); tl_assert(ec->rc > 0); ec->rc--; if (ec->rc == 0) @@ -4327,7 +4330,8 @@ static void ctxt__rcdec ( RCEC* ec ) static void ctxt__rcinc ( RCEC* ec ) { - tl_assert(ec && ec->magic == RCEC_MAGIC); + if (CHECK_CEM) + tl_assert(ec && ec->magic == RCEC_MAGIC); if (ec->rc == 0) RCEC_referenced++; ec->rc++; @@ -4389,8 +4393,14 @@ static RCEC* ctxt__find_or_add ( RCEC* example ) { UWord hent; RCEC* copy; - tl_assert(example && example->magic == RCEC_MAGIC); - tl_assert(example->rc == 0); + + if (CHECK_CEM) { + /* Note that the single caller of ctxt__find_or_add always provides + &thr->cached_rcec as argument. The sanity of thr->cached_rcec is always + checked with a thread terminates. */ + tl_assert(example && example->magic == RCEC_MAGIC); + tl_assert(example->rc == 0); + } /* Search the hash table to see if we already have it. */ stats__ctxt_tab_qs++; @@ -4398,7 +4408,8 @@ static RCEC* ctxt__find_or_add ( RCEC* example ) copy = contextTab[hent]; while (1) { if (!copy) break; - tl_assert(copy->magic == RCEC_MAGIC); + if (CHECK_CEM) + tl_assert(copy->magic == RCEC_MAGIC); stats__ctxt_tab_cmps++; if (!RCEC__differs_by_frames(copy, example)) break; copy = copy->next; @@ -4892,10 +4903,6 @@ static void event_map_bind ( Addr a, SizeT szB, Bool isW, Thr* thr ) rcec = get_RCEC( thr ); - tl_assert (szB == 4 || szB == 8 ||szB == 1 || szB == 2); - // Check for most frequent cases first - // Note: we could support a szB up to 1 << (32 - SCALARTS_N_THRBITS - 1) - /* Look in the oldrefHT to see if we already have a record for this address/thr/sz/isW. */ example.ga = a; @@ -4927,6 +4934,11 @@ static void event_map_bind ( Addr a, SizeT szB, Bool isW, Thr* thr ) OldRef_newest(ref); } else { + tl_assert (szB == 4 || szB == 8 ||szB == 1 || szB == 2); + // We only need to check the size the first time we insert a ref. + // Check for most frequent cases first + // Note: we could support a szB up to 1 << (32 - SCALARTS_N_THRBITS - 1) + /* We don't have a record for this address+triple. Create a new one. */ stats__ctxt_neq_tsw_neq_rcec++; ref = alloc_or_reuse_OldRef(); @@ -5909,7 +5921,8 @@ void zsm_swrite64 ( Addr a, SVal svNew ) { tno = get_treeno(a); //toff = get_tree_offset(a); /* == 0, unused */ cl->descrs[tno] = TREE_DESCR_64; - tl_assert(svNew != SVal_INVALID); + if (CHECK_ZSM) + tl_assert(svNew != SVal_INVALID); /* EXPENSIVE */ cl->svals[cloff + 0] = svNew; cl->svals[cloff + 1] = SVal_INVALID; cl->svals[cloff + 2] = SVal_INVALID; @@ -6862,6 +6875,12 @@ void libhb_async_exit ( Thr* thr ) tl_assert(!thr->llexit_done); thr->llexit_done = True; + /* Check nobody messed up with the cached_rcec */ + tl_assert (thr->cached_rcec.magic == RCEC_MAGIC); + tl_assert (thr->cached_rcec.rc == 0); + tl_assert (thr->cached_rcec.rcX == 0); + tl_assert (thr->cached_rcec.next == NULL); + /* Just to be sure, declare the cached stack invalid. */ set_cached_rcec_validity(thr, False); |
|
From: Julian S. <se...@so...> - 2017-11-07 14:12:33
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=d813fb74af762393a43dd9c70882e655f35ec2ca commit d813fb74af762393a43dd9c70882e655f35ec2ca Author: Julian Seward <js...@ac...> Date: Tue Nov 7 15:01:51 2017 +0100 s390_irgen_EX_SS: add initialisations so as to remove (false positive) warnings from gcc-7.x. When compiling guest_s390_toIR.c for a 32-bit target (a configuration in which it will never be used, but never mind), gcc-7.x notices that sizeof(ss.dec) is larger than sizeof(ss.bytes), so the initialisation of ss.bytes leaves ss.dec.b2 and ss.dec.d2 uninitialised. This patch causes both variants to be initialised. When built for a 64 bit target, the existing initialisation of ss.bytes covers ss.dec completely, so there is no error. Diff: --- VEX/priv/guest_s390_toIR.c | 1 + 1 file changed, 1 insertion(+) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 14c8950..b36b85e 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -11078,6 +11078,7 @@ s390_irgen_EX_SS(UChar r, IRTemp addr2, stmt(IRStmt_Put(S390X_GUEST_OFFSET(guest_CMLEN), mkU64(4))); restart_if(mkexpr(cond)); + ss.dec.op = ss.dec.l = ss.dec.b1 = ss.dec.d1 = ss.dec.b2 = ss.dec.d2 = 0; ss.bytes = last_execute_target; assign(start1, binop(Iop_Add64, mkU64(ss.dec.d1), ss.dec.b1 != 0 ? get_gpr_dw0(ss.dec.b1) : mkU64(0))); |
|
From: Julian S. <se...@so...> - 2017-11-07 13:19:49
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7dd9a7f8b3118c25014b0a77aff899e517c46bcd commit 7dd9a7f8b3118c25014b0a77aff899e517c46bcd Author: Julian Seward <js...@ac...> Date: Tue Nov 7 14:18:16 2017 +0100 Add -finline-functions to standard build flags, so gcc will consider all functions as candidates for inlining. Diff: --- Makefile.all.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.all.am b/Makefile.all.am index faa170d..29e0407 100644 --- a/Makefile.all.am +++ b/Makefile.all.am @@ -97,7 +97,7 @@ clean-noinst_DSYMS: # -fno-builtin is important for defeating LLVM's idiom recognition # that somehow causes VG_(memset) to get into infinite recursion. AM_CFLAGS_BASE = \ - -O2 -g \ + -O2 -finline-functions -g \ -std=gnu99 \ -Wall \ -Wmissing-prototypes \ |