Version 2.5.7
[lttng-ust.git] / liblttng-ust / lttng-filter-specialize.c
index ef0d811bf5c342418a146ed52799694047857183..a729e427f9dead2c3ebdaffc931f79cb9ff79b39 100644 (file)
@@ -79,10 +79,13 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                                if (vstack_bx(stack)->type == REG_S64)
                                        insn->op = FILTER_OP_EQ_S64;
                                else
-                                       insn->op = FILTER_OP_EQ_DOUBLE;
+                                       insn->op = FILTER_OP_EQ_DOUBLE_S64;
                                break;
                        case REG_DOUBLE:
-                               insn->op = FILTER_OP_EQ_DOUBLE;
+                               if (vstack_bx(stack)->type == REG_S64)
+                                       insn->op = FILTER_OP_EQ_S64_DOUBLE;
+                               else
+                                       insn->op = FILTER_OP_EQ_DOUBLE;
                                break;
                        }
                        /* Pop 2, push 1 */
@@ -112,10 +115,13 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                                if (vstack_bx(stack)->type == REG_S64)
                                        insn->op = FILTER_OP_NE_S64;
                                else
-                                       insn->op = FILTER_OP_NE_DOUBLE;
+                                       insn->op = FILTER_OP_NE_DOUBLE_S64;
                                break;
                        case REG_DOUBLE:
-                               insn->op = FILTER_OP_NE_DOUBLE;
+                               if (vstack_bx(stack)->type == REG_S64)
+                                       insn->op = FILTER_OP_NE_S64_DOUBLE;
+                               else
+                                       insn->op = FILTER_OP_NE_DOUBLE;
                                break;
                        }
                        /* Pop 2, push 1 */
@@ -145,10 +151,13 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                                if (vstack_bx(stack)->type == REG_S64)
                                        insn->op = FILTER_OP_GT_S64;
                                else
-                                       insn->op = FILTER_OP_GT_DOUBLE;
+                                       insn->op = FILTER_OP_GT_DOUBLE_S64;
                                break;
                        case REG_DOUBLE:
-                               insn->op = FILTER_OP_GT_DOUBLE;
+                               if (vstack_bx(stack)->type == REG_S64)
+                                       insn->op = FILTER_OP_GT_S64_DOUBLE;
+                               else
+                                       insn->op = FILTER_OP_GT_DOUBLE;
                                break;
                        }
                        /* Pop 2, push 1 */
@@ -178,10 +187,13 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                                if (vstack_bx(stack)->type == REG_S64)
                                        insn->op = FILTER_OP_LT_S64;
                                else
-                                       insn->op = FILTER_OP_LT_DOUBLE;
+                                       insn->op = FILTER_OP_LT_DOUBLE_S64;
                                break;
                        case REG_DOUBLE:
-                               insn->op = FILTER_OP_LT_DOUBLE;
+                               if (vstack_bx(stack)->type == REG_S64)
+                                       insn->op = FILTER_OP_LT_S64_DOUBLE;
+                               else
+                                       insn->op = FILTER_OP_LT_DOUBLE;
                                break;
                        }
                        /* Pop 2, push 1 */
@@ -211,10 +223,13 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                                if (vstack_bx(stack)->type == REG_S64)
                                        insn->op = FILTER_OP_GE_S64;
                                else
-                                       insn->op = FILTER_OP_GE_DOUBLE;
+                                       insn->op = FILTER_OP_GE_DOUBLE_S64;
                                break;
                        case REG_DOUBLE:
-                               insn->op = FILTER_OP_GE_DOUBLE;
+                               if (vstack_bx(stack)->type == REG_S64)
+                                       insn->op = FILTER_OP_GE_S64_DOUBLE;
+                               else
+                                       insn->op = FILTER_OP_GE_DOUBLE;
                                break;
                        }
                        /* Pop 2, push 1 */
@@ -243,10 +258,13 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                                if (vstack_bx(stack)->type == REG_S64)
                                        insn->op = FILTER_OP_LE_S64;
                                else
-                                       insn->op = FILTER_OP_LE_DOUBLE;
+                                       insn->op = FILTER_OP_LE_DOUBLE_S64;
                                break;
                        case REG_DOUBLE:
-                               insn->op = FILTER_OP_LE_DOUBLE;
+                               if (vstack_bx(stack)->type == REG_S64)
+                                       insn->op = FILTER_OP_LE_S64_DOUBLE;
+                               else
+                                       insn->op = FILTER_OP_LE_DOUBLE;
                                break;
                        }
                        vstack_ax(stack)->type = REG_S64;
@@ -272,6 +290,18 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                case FILTER_OP_LT_DOUBLE:
                case FILTER_OP_GE_DOUBLE:
                case FILTER_OP_LE_DOUBLE:
+               case FILTER_OP_EQ_DOUBLE_S64:
+               case FILTER_OP_NE_DOUBLE_S64:
+               case FILTER_OP_GT_DOUBLE_S64:
+               case FILTER_OP_LT_DOUBLE_S64:
+               case FILTER_OP_GE_DOUBLE_S64:
+               case FILTER_OP_LE_DOUBLE_S64:
+               case FILTER_OP_EQ_S64_DOUBLE:
+               case FILTER_OP_NE_S64_DOUBLE:
+               case FILTER_OP_GT_S64_DOUBLE:
+               case FILTER_OP_LT_S64_DOUBLE:
+               case FILTER_OP_GE_S64_DOUBLE:
+               case FILTER_OP_LE_S64_DOUBLE:
                {
                        /* Pop 2, push 1 */
                        if (vstack_pop(stack)) {
@@ -366,19 +396,33 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                case FILTER_OP_AND:
                case FILTER_OP_OR:
                {
+                       /* Continue to next instruction */
+                       /* Pop 1 when jump not taken */
+                       if (vstack_pop(stack)) {
+                               ret = -EINVAL;
+                               goto end;
+                       }
                        next_pc += sizeof(struct logical_op);
                        break;
                }
 
-               /* load */
+               /* load field ref */
                case FILTER_OP_LOAD_FIELD_REF:
                {
                        ERR("Unknown field ref type\n");
                        ret = -EINVAL;
                        goto end;
                }
+               /* get context ref */
+               case FILTER_OP_GET_CONTEXT_REF:
+               {
+                       ERR("Unknown get context ref type\n");
+                       ret = -EINVAL;
+                       goto end;
+               }
                case FILTER_OP_LOAD_FIELD_REF_STRING:
                case FILTER_OP_LOAD_FIELD_REF_SEQUENCE:
+               case FILTER_OP_GET_CONTEXT_REF_STRING:
                {
                        if (vstack_push(stack)) {
                                ret = -EINVAL;
@@ -389,6 +433,7 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                        break;
                }
                case FILTER_OP_LOAD_FIELD_REF_S64:
+               case FILTER_OP_GET_CONTEXT_REF_S64:
                {
                        if (vstack_push(stack)) {
                                ret = -EINVAL;
@@ -399,6 +444,7 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                        break;
                }
                case FILTER_OP_LOAD_FIELD_REF_DOUBLE:
+               case FILTER_OP_GET_CONTEXT_REF_DOUBLE:
                {
                        if (vstack_push(stack)) {
                                ret = -EINVAL;
@@ -409,6 +455,7 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                        break;
                }
 
+               /* load from immediate operand */
                case FILTER_OP_LOAD_STRING:
                {
                        struct load_op *insn = (struct load_op *) pc;
@@ -486,7 +533,6 @@ int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode)
                        break;
                }
 
-
                }
        }
 end:
This page took 0.025463 seconds and 4 git commands to generate.