The user can specify via command line or client requests which code range are considered untrusted. Based on that, Memcheck will instrument untrusted code normally and trusted code in a lightweight tracking mode: - Stores always store V bits - Loads are transformed to constants. - Trusted code "isAlwaysDefd" and all shadow PUT/GET's will generate consts. - Don't insert complainIfUndefined in trusted code. - Constants will be removed during optimization phase. Reproducible: Always I have already started working on this. Will upload patches for review when finished.
Perf test results of running a process in fully trusted mode: -- Running tests in perf ---------------------------------------------- -- bigcode1 -- bigcode1 valgrind-none-trusted:0.10s me: 2.7s (27.1x, -----) bigcode1 valgrind-all-trusted:0.10s me: 2.0s (20.1x, 25.8%) -- bigcode2 -- bigcode2 valgrind-none-trusted:0.10s me: 6.9s (69.2x, -----) bigcode2 valgrind-all-trusted:0.10s me: 5.4s (53.6x, 22.5%) -- bz2 -- bz2 valgrind-none-trusted:0.52s me: 7.6s (14.7x, -----) bz2 valgrind-all-trusted:0.52s me: 3.2s ( 6.2x, 58.1%) -- fbench -- fbench valgrind-none-trusted:0.22s me: 3.9s (17.9x, -----) fbench valgrind-all-trusted:0.22s me: 1.8s ( 8.0x, 55.3%) -- ffbench -- ffbench valgrind-none-trusted:0.20s me: 2.8s (13.9x, -----) ffbench valgrind-all-trusted:0.20s me: 1.2s ( 5.8x, 58.3%) -- heap -- heap valgrind-none-trusted:0.07s me: 4.8s (69.0x, -----) heap valgrind-all-trusted:0.07s me: 4.4s (62.9x, 8.9%) -- heap_pdb4 -- heap_pdb4 valgrind-none-trusted:0.08s me: 7.4s (92.0x, -----) heap_pdb4 valgrind-all-trusted:0.08s me: 4.7s (58.1x, 36.8%) -- many-loss-records -- many-loss-records valgrind-none-trusted:0.01s me: 1.2s (118.0x, -----) many-loss-records valgrind-all-trusted:0.01s me: 1.1s (107.0x, 9.3%) -- many-xpts -- many-xpts valgrind-none-trusted:0.03s me: 1.7s (56.7x, -----) many-xpts valgrind-all-trusted:0.03s me: 1.4s (48.0x, 15.3%) -- sarp -- sarp valgrind-none-trusted:0.02s me: 1.9s (97.0x, -----) sarp valgrind-all-trusted:0.02s me: 1.7s (86.5x, 10.8%) -- tinycc -- tinycc valgrind-none-trusted:0.15s me: 8.4s (56.3x, -----) tinycc valgrind-all-trusted:0.15s me: 5.5s (36.5x, 35.1%) -- Finished tests in perf ---------------------------------------------- == 11 programs, 22 timings =================
Created attachment 72135 [details] trusted code optimization patchset v1
Created attachment 72163 [details] memcheck trusted code optimization v1 squashed patch Patchset uploaded in zip.