1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Filter refactoring: The constant f_val is simply included inside the instruction

With 32 bits, size of the args is 12 bytes, the f_val is 20 bytes.
With 64 bits, size of the args is 24 bytes, the f_val the same.

This is not so nice on 32 bits, anyway the f_inst itself is
24 vs. 32 bytes and the overall size of filters must be 32k of
instructions to get to one megabyte of RAM eaten by f_inst.

Therefore it seems to be improbable for common user to get into
problems with this change.
This commit is contained in:
Maria Matejka
2018-12-20 15:25:04 +01:00
parent 7f0ac73724
commit ca2ee91a80
3 changed files with 80 additions and 98 deletions

View File

@@ -240,16 +240,7 @@
/* some constants have value in a[1], some in *a[0].p, strange. */
case FI_CONSTANT: /* integer (or simple type) constant, string, set, or prefix_set */
res.type = what->aux;
if (res.type == T_PREFIX_SET)
res.val.ti = what->a[1].p;
else if (res.type == T_SET)
res.val.t = what->a[1].p;
else if (res.type == T_STRING)
res.val.s = what->a[1].p;
else
res.val.i = what->a[1].i;
res = what->val;
break;
case FI_VARIABLE:
case FI_CONSTANT_INDIRECT: