Change the --smc-check default value to =all-non-file.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15601 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index a95ff9f..cd9cad1 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -160,7 +160,7 @@
 "    --allow-mismatched-debuginfo=no|yes  [no]\n"
 "                              for the above two flags only, accept debuginfo\n"
 "                              objects that don't \"match\" the main object\n"
-"    --smc-check=none|stack|all|all-non-file [stack]\n"
+"    --smc-check=none|stack|all|all-non-file [all-non-file]\n"
 "                              checks for self-modifying code: none, only for\n"
 "                              code found in stacks, for all code, or for all\n"
 "                              code except that from file-backed mappings\n"
diff --git a/coregrind/m_options.c b/coregrind/m_options.c
index 4248e9b..b9b7b17 100644
--- a/coregrind/m_options.c
+++ b/coregrind/m_options.c
@@ -129,7 +129,7 @@
 Word   VG_(clo_main_stacksize) = 0; /* use client's rlimit.stack */
 Word   VG_(clo_valgrind_stacksize) = VG_DEFAULT_STACK_ACTIVE_SZB;
 Bool   VG_(clo_wait_for_gdb)   = False;
-VgSmc  VG_(clo_smc_check)      = Vg_SmcStack;
+VgSmc  VG_(clo_smc_check)      = Vg_SmcAllNonFile;
 UInt   VG_(clo_kernel_variant) = 0;
 Bool   VG_(clo_dsymutil)       = False;
 Bool   VG_(clo_sigill_diag)    = True;
diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml
index 80a3e66..3a9e720 100644
--- a/docs/xml/manual-core.xml
+++ b/docs/xml/manual-core.xml
@@ -1704,7 +1704,7 @@
 
   <varlistentry id="opt.smc-check" xreflabel="--smc-check">
     <term>
-      <option><![CDATA[--smc-check=<none|stack|all|all-non-file> [default: stack] ]]></option>
+      <option><![CDATA[--smc-check=<none|stack|all|all-non-file> [default: all-non-file] ]]></option>
     </term>
     <listitem>
       <para>This option controls Valgrind's detection of self-modifying
@@ -1720,15 +1720,16 @@
       file-backed mappings.
 
       Note that the default option will catch the vast majority
-      of cases.  The main case it will not catch is programs such as JIT
-      compilers that dynamically generate code <emphasis>and</emphasis>
-      subsequently overwrite part or all of it.  Running with
+      of cases, including the case where a JIT
+      compiler dynamically generates code <emphasis>and</emphasis>
+      subsequently overwrites part or all of it.  Running with
       <varname>all</varname> will slow Valgrind down noticeably.
       Running with
       <varname>none</varname> will rarely speed things up, since very little
-      code gets put on the stack for most programs.  The
+      code gets dynamically generated in most programs.  The
       <function>VALGRIND_DISCARD_TRANSLATIONS</function> client
       request is an alternative to <option>--smc-check=all</option>
+      and <option>--smc-check=all-non-file</option>
       that requires more programmer effort but allows Valgrind to run
       your program faster, by telling it precisely when translations
       need to be re-made.
@@ -1749,14 +1750,14 @@
       takes advantage of this observation, limiting the overhead of
       checking to code which is likely to be JIT generated.</para>
 
-      <para>Some architectures (including ppc32, ppc64, ARM and MIPS)
+      <para>Some architectures (including POWER/PPC, ARM and MIPS)
       require programs which create code at runtime to flush the
       instruction cache in between code generation and first use.
       Valgrind observes and honours such instructions.  Hence, on
-      ppc32/Linux, ppc64/Linux and ARM/Linux, Valgrind always provides
+      those targets, Valgrind always provides
       complete, transparent support for self-modifying code.  It is
-      only on platforms such as x86/Linux, AMD64/Linux, x86/Darwin and
-      AMD64/Darwin that you need to use this option.</para>
+      only on platforms such as x86/Linux, AMD64/Linux, x86/Darwin,
+      AMD64/Darwin and S390/Linux that you need to use this option.</para>
     </listitem>
   </varlistentry>
 
diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp
index d7219ce..3617545 100644
--- a/none/tests/cmdline1.stdout.exp
+++ b/none/tests/cmdline1.stdout.exp
@@ -74,7 +74,7 @@
     --allow-mismatched-debuginfo=no|yes  [no]
                               for the above two flags only, accept debuginfo
                               objects that don't "match" the main object
-    --smc-check=none|stack|all|all-non-file [stack]
+    --smc-check=none|stack|all|all-non-file [all-non-file]
                               checks for self-modifying code: none, only for
                               code found in stacks, for all code, or for all
                               code except that from file-backed mappings
diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp
index 4ea258d..88110ec 100644
--- a/none/tests/cmdline2.stdout.exp
+++ b/none/tests/cmdline2.stdout.exp
@@ -74,7 +74,7 @@
     --allow-mismatched-debuginfo=no|yes  [no]
                               for the above two flags only, accept debuginfo
                               objects that don't "match" the main object
-    --smc-check=none|stack|all|all-non-file [stack]
+    --smc-check=none|stack|all|all-non-file [all-non-file]
                               checks for self-modifying code: none, only for
                               code found in stacks, for all code, or for all
                               code except that from file-backed mappings
diff --git a/perf/bigcode.c b/perf/bigcode.c
index 8e12d7b..ae31cbb 100644
--- a/perf/bigcode.c
+++ b/perf/bigcode.c
@@ -8,6 +8,19 @@
 // to make a difference), but under Valgrind the one running more code is
 // significantly slower due to the extra translation time.
 
+// 31 Aug 2015: this only "works" on x86/amd64/s390 by accident; the
+// test is essentially kludged.  This "generates" code into memory
+// (the mmap'd area) and the executes it.  But historically and even
+// after this commit (r15601), the test has been run without 
+// --smc-check=all or all-non-file.  That just happens to work because
+// the "generated" code is never modified, so there's never a
+// translated-vs-reality coherence problem.  Really we ought to run
+// with the new-as-of-r15601 default --smc-check=all-non-file, but that
+// hugely slows it down and makes the results non-comparable with
+// pre r15601 results, so instead the .vgperf files now specify the
+// old default value --smc-check=stack explicitly.
+
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/perf/bigcode1.vgperf b/perf/bigcode1.vgperf
index 2fdcb4c..ea5440f 100644
--- a/perf/bigcode1.vgperf
+++ b/perf/bigcode1.vgperf
@@ -1 +1,2 @@
 prog: bigcode
+vgopts: --smc-check=stack
diff --git a/perf/bigcode2.vgperf b/perf/bigcode2.vgperf
index e4a42c9..d7de3a1 100644
--- a/perf/bigcode2.vgperf
+++ b/perf/bigcode2.vgperf
@@ -1,2 +1,3 @@
 prog: bigcode
 args: 0
+vgopts: --smc-check=stack