SoW-2019-0002: Dynamic Snapshot
[deliverable/lttng-ust.git] / liblttng-ust / lttng-filter-interpreter.c
index f246ce2a0b3383d1f000b3e17f253a77308ef6b1..04d0c073e4a3fa8121e9462c9e860a2f0fda587e 100644 (file)
@@ -338,7 +338,7 @@ static int context_get_index(struct lttng_ctx *ctx,
        return 0;
 }
 
-static int dynamic_get_index(struct lttng_session *session,
+static int dynamic_get_index(struct lttng_ctx *ctx,
                struct bytecode_runtime *runtime,
                uint64_t index, struct estack_entry *stack_top)
 {
@@ -405,9 +405,6 @@ static int dynamic_get_index(struct lttng_session *session,
        case LOAD_ROOT_CONTEXT:
        case LOAD_ROOT_APP_CONTEXT:     /* Fall-through */
        {
-               struct lttng_ctx *ctx;
-
-               ctx = rcu_dereference(session->ctx);
                ret = context_get_index(ctx,
                                &stack_top->u.ptr,
                                gid->ctx_index);
@@ -602,7 +599,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                const char *filter_stack_data)
 {
        struct bytecode_runtime *bytecode = filter_data;
-       struct lttng_session *session = bytecode->p.session;
+       struct lttng_ctx *ctx = rcu_dereference(*bytecode->p.ctx);
        void *pc, *next_pc, *start_pc;
        int ret = -EINVAL;
        uint64_t retval = 0;
@@ -1981,13 +1978,11 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
-                       struct lttng_ctx *ctx;
                        struct lttng_ctx_field *ctx_field;
                        struct lttng_ctx_value v;
 
                        dbg_printf("get context ref offset %u type dynamic\n",
                                ref->offset);
-                       ctx = rcu_dereference(session->ctx);
                        ctx_field = &ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
@@ -2031,13 +2026,11 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
-                       struct lttng_ctx *ctx;
                        struct lttng_ctx_field *ctx_field;
                        struct lttng_ctx_value v;
 
                        dbg_printf("get context ref offset %u type string\n",
                                ref->offset);
-                       ctx = rcu_dereference(session->ctx);
                        ctx_field = &ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
@@ -2060,13 +2053,11 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
-                       struct lttng_ctx *ctx;
                        struct lttng_ctx_field *ctx_field;
                        struct lttng_ctx_value v;
 
                        dbg_printf("get context ref offset %u type s64\n",
                                ref->offset);
-                       ctx = rcu_dereference(session->ctx);
                        ctx_field = &ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
@@ -2081,13 +2072,11 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
-                       struct lttng_ctx *ctx;
                        struct lttng_ctx_field *ctx_field;
                        struct lttng_ctx_value v;
 
                        dbg_printf("get context ref offset %u type double\n",
                                ref->offset);
-                       ctx = rcu_dereference(session->ctx);
                        ctx_field = &ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
@@ -2173,7 +2162,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        struct get_index_u16 *index = (struct get_index_u16 *) insn->data;
 
                        dbg_printf("op get index u16\n");
-                       ret = dynamic_get_index(session, bytecode, index->index, estack_ax(stack, top));
+                       ret = dynamic_get_index(ctx, bytecode, index->index, estack_ax(stack, top));
                        if (ret)
                                goto end;
                        estack_ax_v = estack_ax(stack, top)->u.v;
@@ -2188,7 +2177,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        struct get_index_u64 *index = (struct get_index_u64 *) insn->data;
 
                        dbg_printf("op get index u64\n");
-                       ret = dynamic_get_index(session, bytecode, index->index, estack_ax(stack, top));
+                       ret = dynamic_get_index(ctx, bytecode, index->index, estack_ax(stack, top));
                        if (ret)
                                goto end;
                        estack_ax_v = estack_ax(stack, top)->u.v;
This page took 0.036301 seconds and 5 git commands to generate.