struct lttng_bytecode_runtime {
/* Associated bytecode */
struct lttng_bytecode_node *bc;
- uint64_t (*filter)(void *filter_data,
- struct lttng_probe_ctx *lttng_probe_ctx,
- const char *filter_stack_data);
+ union {
+ uint64_t (*filter)(void *filter_data,
+ struct lttng_probe_ctx *lttng_probe_ctx,
+ const char *filter_stack_data);
+ } interpreter_funcs;
int link_failed;
struct list_head node; /* list of bytecode runtime in event */
struct lttng_ctx *ctx;
__event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \
tp_locvar, _args); \
lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
- if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \
+ if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
__stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
__filter_record = 1; \
break; \
__event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \
tp_locvar); \
lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
- if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \
+ if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
__stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
__filter_record = 1; \
break; \
__event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \
tp_locvar, _args); \
lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
- if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \
+ if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
__stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \
__filter_record = 1; \
} \
__event_prepare_filter_stack__##_name(__stackvar.__filter_stack_data, \
tp_locvar); \
lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
- if (unlikely(bc_runtime->filter(bc_runtime, &__lttng_probe_ctx, \
+ if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
__stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \
__filter_record = 1; \
} \
if (ret) {
goto link_error;
}
- runtime->p.filter = lttng_bytecode_filter_interpret;
+
+ switch (bytecode->type) {
+ case LTTNG_BYTECODE_NODE_TYPE_FILTER:
+ runtime->p.interpreter_funcs.filter = lttng_bytecode_filter_interpret;
+ break;
+ default:
+ WARN_ON(1);
+ }
+
runtime->p.link_failed = 0;
list_add_rcu(&runtime->p.node, insert_loc);
dbg_printk("Linking successful.\n");
return 0;
link_error:
- runtime->p.filter = lttng_bytecode_filter_interpret_false;
+
+ switch (bytecode->type) {
+ case LTTNG_BYTECODE_NODE_TYPE_FILTER:
+ runtime->p.interpreter_funcs.filter = lttng_bytecode_filter_interpret_false;
+ break;
+ default:
+ WARN_ON(1);
+ }
runtime->p.link_failed = 1;
list_add_rcu(&runtime->p.node, insert_loc);
alloc_error:
struct lttng_bytecode_node *bc = runtime->bc;
if (!bc->enabler->enabled || runtime->link_failed)
- runtime->filter = lttng_bytecode_filter_interpret_false;
+ runtime->interpreter_funcs.filter = lttng_bytecode_filter_interpret_false;
else
- runtime->filter = lttng_bytecode_filter_interpret;
+ runtime->interpreter_funcs.filter = lttng_bytecode_filter_interpret;
}
/*