prog: mutate programs more aggressively

Currently we stop mutating with 50% probability.
Stop mutating with 33% probability instead.
Benchmark shows both coverage increase and corpus reduction:

                    baseline          oneof3            diff
coverage               65467           65604             137
corpus                 35423           35354             -69
exec total           5474879         5023268         -451611
This commit is contained in:
Dmitry Vyukov 2017-01-20 14:33:35 +01:00
parent b218a25ecb
commit c4901df5c3

View File

@ -24,7 +24,7 @@ func (p *Prog) Mutate(rs rand.Source, ncalls int, ct *ChoiceTable, corpus []*Pro
} else {
// Mutate current prog without splicing.
retry := false
for stop := false; !stop || retry; stop = r.bin() {
for stop := false; !stop || retry; stop = r.oneOf(3) {
retry = false
r.choose(
20, func() {
@ -54,7 +54,7 @@ func (p *Prog) Mutate(rs rand.Source, ncalls int, ct *ChoiceTable, corpus []*Pro
return
}
s := analyze(ct, p, c)
for stop := false; !stop; stop = r.bin() {
for stop := false; !stop; stop = r.oneOf(3) {
args, bases := mutationArgs(c)
if len(args) == 0 {
retry = true