mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Filter: Improve handling of stack frames in filter bytecode
When f_line is done, we have to pop the stack frame. The old code just removed nominal number of args/vars. Change it to use stored ventry value modified by number of returned values. This allows to allocate variables on a stack frame during execution of f_lines instead of just at start. But we need to know the number of returned values for a f_line. It is 1 for term, 0 for cmd. Store that to f_line during linearization.
This commit is contained in:
committed by
Ondrej Zajicek
parent
f31f4e6eef
commit
a2527ee53d
@@ -46,14 +46,15 @@ struct f_line {
|
||||
uint len; /* Line length */
|
||||
u8 args; /* Function: Args required */
|
||||
u8 vars;
|
||||
u8 results; /* Results left on stack: cmd -> 0, term -> 1 */
|
||||
struct f_arg *arg_list;
|
||||
struct f_line_item items[0]; /* The items themselves */
|
||||
};
|
||||
|
||||
/* Convert the f_inst infix tree to the f_line structures */
|
||||
struct f_line *f_linearize_concat(const struct f_inst * const inst[], uint count);
|
||||
static inline struct f_line *f_linearize(const struct f_inst *root)
|
||||
{ return f_linearize_concat(&root, 1); }
|
||||
struct f_line *f_linearize_concat(const struct f_inst * const inst[], uint count, uint results);
|
||||
static inline struct f_line *f_linearize(const struct f_inst *root, uint results)
|
||||
{ return f_linearize_concat(&root, 1, results); }
|
||||
|
||||
void f_dump_line(const struct f_line *, uint indent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user