[master] 75fcc13e5 vcc: Mark subs statically reachable via dynamic subs as "dynamic"
Nils Goroll
nils.goroll at uplex.de
Mon Feb 8 17:52:04 UTC 2021
commit 75fcc13e5b714a7bfc640f2617df6b1052d33138
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Sat Jan 30 20:27:04 2021 +0100
vcc: Mark subs statically reachable via dynamic subs as "dynamic"
In follow up commits, we will need a marker for subs which can be
reachable via dynamically referenced SUBs.
We use "more references than calls" is this marker. When walking
the call trees, we add one reference for all subs which are called from
a SUB having this marker, thus marking those, too.
diff --git a/lib/libvcc/vcc_xref.c b/lib/libvcc/vcc_xref.c
index 55a4198de..286e81ee0 100644
--- a/lib/libvcc/vcc_xref.c
+++ b/lib/libvcc/vcc_xref.c
@@ -195,6 +195,10 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
vcc_ErrWhere(tl, p->name);
return (1);
}
+
+ // more references than calls -> sub is referenced for dynamic calls
+ u = (p->sym->nref > p->called);
+
p->active = 1;
VTAILQ_FOREACH(pc, &p->calls, list) {
if (pc->sym->proc == NULL) {
@@ -204,6 +208,7 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
return (1);
}
pc->sym->proc->called++;
+ pc->sym->nref += u;
if (vcc_CheckActionRecurse(tl, pc->sym->proc, bitmap)) {
VSB_printf(tl->sb, "\n...called from \"%.*s\"\n",
PF(p->name));
More information about the varnish-commit
mailing list