bird/filter/same.m4
Maria Matejka 4c553c5a5b Filter refactoring: dropped the recursion from the interpreter
This is a major change of how the filters are interpreted. If everything
works how it should, it should not affect you unless you are hacking the
filters themselves.

Anyway, this change should make a huge improvement in the filter performance
as previous benchmarks showed that our major problem lies in the
recursion itself.

There are also some changes in nest and protocols, related mostly to
spreading const declarations throughout the whole BIRD and also to
refactored dynamic attribute definitions. The need of these came up
during the whole work and it is too difficult to split out these
not-so-related changes.
2019-02-20 22:30:54 +01:00

56 lines
1.4 KiB
Text

m4_divert(-1)m4_dnl
#
# BIRD -- Filter Comparator Generator
#
# (c) 2018 Maria Matejka <mq@jmq.cz>
#
# Can be freely distributed and used under the terms of the GNU GPL.
#
# Common aliases
m4_define(DNL, `m4_dnl')
m4_define(INST, `m4_divert(1)break; case $1:
m4_divert(-1)')
m4_define(ARG, `')
m4_define(ARG_ANY, `')
m4_define(LINE, `m4_divert(1)if (!f_same(f1->lines[$2], f2->lines[$2])) return 0;
m4_divert(-1)')
m4_define(LINEP, LINE)
m4_define(SYMBOL, `m4_divert(1){
const struct symbol *s1 = f1->sym, *s2 = f2->sym;
if (strcmp(s1->name, s2->name)) return 0;
if (s1->class != s2->class) return 0;
}
m4_divert(-1)')
m4_define(VALI, `m4_divert(1)if (!val_same(f1->vp, f2->vp)) return 0;
m4_divert(-1)')
m4_define(VALP, `')
m4_define(FRET, `m4_divert(1)if (f1->fret != f2->fret) return 0;
m4_divert(-1)')
m4_define(ECS, `m4_divert(1)if (f1->ecs != f2->ecs) return 0;
m4_divert(-1)')
m4_define(RTC, `m4_divert(1)if (strcmp(f1->rtc->name, f2->rtc->name)) return 0;
m4_divert(-1)')
m4_define(STATIC_ATTR, `m4_divert(1)if (f1->sa.sa_code != f2->sa.sa_code) return 0;
m4_divert(-1)')
m4_define(DYNAMIC_ATTR, `m4_divert(1)if (f1->da.ea_code != f2->da.ea_code) return 0;
m4_divert(-1)')
m4_define(SAME, `m4_divert(1)$1m4_divert(-1)')
m4_m4wrap(`
m4_divert(0)DNL
case FI_NOP: bug("This shall not happen");
m4_undivert(1)
break; default: bug( "Unknown instruction %d (%c)", f1->fi_code, f1->fi_code & 0xff);
')
m4_divert(1)
m4_changequote([[,]])