aboutsummaryrefslogtreecommitdiffstats
path: root/prog/target.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2019-08-21 20:05:22 +0200
committerDmitry Vyukov <dvyukov@google.com>2019-08-30 12:51:28 -0700
commitbcd7bcc2968d1db4d4eb16c50afa76bdcffb6302 (patch)
tree4cea13908fbf66515279c53e21bdcb672d10e01e /prog/target.go
parent9adfa8760f6ba6ed23dc7fe9eb900f8b684e0052 (diff)
prog: speed up resource ctors detection
When we build a list of resource constructors we over and over iterate through all types in a syscall to find resource types. Speed it up by iterating only once to build a list of constructors for each resource and then reuse it. This significantly speeds up syz-exeprog startup time on Raspberry Pi Zero.
Diffstat (limited to 'prog/target.go')
-rw-r--r--prog/target.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/prog/target.go b/prog/target.go
index da9b3255c..d02a3dd37 100644
--- a/prog/target.go
+++ b/prog/target.go
@@ -168,9 +168,10 @@ func (target *Target) initTarget() {
})
}
+ target.populateResourceCtors()
target.resourceCtors = make(map[string][]*Syscall)
for _, res := range target.Resources {
- target.resourceCtors[res.Name] = target.calcResourceCtors(res.Kind, false)
+ target.resourceCtors[res.Name] = target.calcResourceCtors(res, false)
}
initAnyTypes(target)
}