[master] 3d23688 Add a VSB for function prologues
Poul-Henning Kamp
phk at FreeBSD.org
Tue Dec 12 13:11:07 UTC 2017
commit 3d236885e806441fd2d9cbfe7c4d5c58ad716f5f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Dec 12 09:45:54 2017 +0000
Add a VSB for function prologues
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index e46c09e..28975b0 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -105,6 +105,8 @@ vcc_NewProc(struct vcc *tl, struct symbol *sym)
VTAILQ_INIT(&p->calls);
VTAILQ_INIT(&p->uses);
VTAILQ_INSERT_TAIL(&tl->procs, p, list);
+ p->prologue = VSB_new_auto();
+ AN(p->prologue);
p->body = VSB_new_auto();
AN(p->body);
p->cname = VSB_new_auto();
@@ -117,12 +119,14 @@ static void
vcc_EmitProc(struct vcc *tl, struct proc *p)
{
AZ(VSB_finish(p->cname));
+ AZ(VSB_finish(p->prologue));
AZ(VSB_finish(p->body));
Fh(tl, 1, "vcl_func_f %s;\n", VSB_data(p->cname));
Fc(tl, 1, "\nvoid v_matchproto_(vcl_func_f)\n");
Fc(tl, 1, "%s(VRT_CTX)\n", VSB_data(p->cname));
- Fc(tl, 1, "{\n%s}\n", VSB_data(p->body));
+ Fc(tl, 1, "{\n%s\n%s}\n", VSB_data(p->prologue), VSB_data(p->body));
VSB_destroy(&p->body);
+ VSB_destroy(&p->prologue);
VSB_destroy(&p->cname);
}
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 2209f23..bade028 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -160,6 +160,7 @@ struct proc {
unsigned active;
struct token *return_tok[VCL_RET_MAX];
struct vsb *cname;
+ struct vsb *prologue;
struct vsb *body;
};
More information about the varnish-commit
mailing list