0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-19 11:55:21 +00:00

Filter: recursion to loop

It was supposed to do tail-recursion in interpret() but it didn't
compile as such. Converting it to loop makes a significant filter
performance improvement for flat filters.
This commit is contained in:
Jan Maria Matejka 2017-11-29 11:38:01 +01:00
parent 5a14df3950
commit 7c601e6b7b

View File

@ -633,15 +633,13 @@ static struct f_val
interpret(struct f_inst *what)
{
struct symbol *sym;
struct f_val v1, v2, res, *vp;
struct f_val v1, v2, res = { .type = T_VOID }, *vp;
unsigned u1, u2;
int i;
u32 as;
for ( ; what; what = what->next) {
res.type = T_VOID;
if (!what)
return res;
switch(what->fi_code) {
case FI_COMMA:
TWOARGS;
@ -1510,9 +1508,7 @@ interpret(struct f_inst *what)
default:
bug( "Unknown instruction %d (%c)", what->fi_code, what->fi_code & 0xff);
}
if (what->next)
return interpret(what->next);
}}
return res;
}