Filter: add FILTER_OP_RETURN_S64 instruction
[lttng-ust.git] / liblttng-ust / lttng-filter-specialize.c
index 7cbd8c592c4a782801ceae99b1d7ebd44921ee56..1ade2883005bdc93f4f7b33abeb1bcad4c5a02ee 100644 (file)
@@ -621,6 +621,17 @@ int lttng_filter_specialize_bytecode(struct lttng_event *event,
                        goto end;
 
                case FILTER_OP_RETURN:
+                       if (vstack_ax(stack)->type == REG_S64)
+                               *(filter_opcode_t *) pc = FILTER_OP_RETURN_S64;
+                       ret = 0;
+                       goto end;
+
+               case FILTER_OP_RETURN_S64:
+                       if (vstack_ax(stack)->type != REG_S64) {
+                               ERR("Unexpected register type\n");
+                               ret = -EINVAL;
+                               goto end;
+                       }
                        ret = 0;
                        goto end;
 
@@ -630,8 +641,6 @@ int lttng_filter_specialize_bytecode(struct lttng_event *event,
                case FILTER_OP_MOD:
                case FILTER_OP_PLUS:
                case FILTER_OP_MINUS:
-               case FILTER_OP_RSHIFT:
-               case FILTER_OP_LSHIFT:
                        ERR("unsupported bytecode op %u\n",
                                (unsigned int) *(filter_opcode_t *) pc);
                        ret = -EINVAL;
@@ -959,6 +968,8 @@ int lttng_filter_specialize_bytecode(struct lttng_event *event,
                case FILTER_OP_LT_S64_DOUBLE:
                case FILTER_OP_GE_S64_DOUBLE:
                case FILTER_OP_LE_S64_DOUBLE:
+               case FILTER_OP_BIT_RSHIFT:
+               case FILTER_OP_BIT_LSHIFT:
                case FILTER_OP_BIT_AND:
                case FILTER_OP_BIT_OR:
                case FILTER_OP_BIT_XOR:
@@ -1046,6 +1057,13 @@ int lttng_filter_specialize_bytecode(struct lttng_event *event,
                        break;
                }
 
+               case FILTER_OP_UNARY_BIT_NOT:
+               {
+                       /* Pop 1, push 1 */
+                       next_pc += sizeof(struct unary_op);
+                       break;
+               }
+
                case FILTER_OP_UNARY_PLUS_S64:
                case FILTER_OP_UNARY_MINUS_S64:
                case FILTER_OP_UNARY_NOT_S64:
This page took 0.023862 seconds and 4 git commands to generate.