/*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
assert(cyclic != NO_STATE);
maskSetBit(limex->repeatCyclicMask, cyclic);
}
+ /* also include tugs in repeat cyclic mask */
+ for (NFAVertex v : args.tugs) {
+ u32 v_state = args.state_ids.at(v);
+ assert(v_state != NO_STATE);
+ maskSetBit(limex->repeatCyclicMask, v_state);
+ }
}
static
/*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* followers */ \
u_##size compressMask; /**< switch off before compress */ \
u_##size exceptionMask; \
- u_##size repeatCyclicMask; \
+ u_##size repeatCyclicMask; /**< also includes tug states */ \
u_##size zombieMask; /**< zombie if in any of the set states */ \
u_##size shift[MAX_SHIFT_COUNT]; \
u32 shiftCount; /**< number of shift masks used */ \
/*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
DEBUG_PRINTF("repeat %u\n", i);
const struct NFARepeatInfo *info = GET_NFA_REPEAT_INFO_FN(limex, i);
- if (!TESTBIT_STATE(s, info->cyclicState)) {
+ const ENG_STATE_T *tug_mask =
+ (const ENG_STATE_T *)((const char *)info + info->tugMaskOffset);
+ /* repeat may still be inspected if its tug state is on */
+ if (!TESTBIT_STATE(s, info->cyclicState)
+ && ISZERO_STATE(AND_STATE(s, LOAD_FROM_ENG(tug_mask)))) {
DEBUG_PRINTF("is dead\n");
continue;
}
const struct RepeatInfo *repeat = getRepeatInfo(info);
- if (repeatHasMatch(repeat, &ctrl[i], state_base + info->stateOffset,
- offset) == REPEAT_STALE) {
- DEBUG_PRINTF("is stale, clearing state\n");
- CLEARBIT_STATE(&s, info->cyclicState);
- continue;
- }
-
DEBUG_PRINTF("packing state (packedCtrlOffset=%u)\n",
info->packedCtrlOffset);
repeatPack(state_base + info->packedCtrlOffset, repeat, &ctrl[i],
for (u32 i = 0; i < limex->repeatCount; i++) {
DEBUG_PRINTF("repeat %u\n", i);
const struct NFARepeatInfo *info = GET_NFA_REPEAT_INFO_FN(limex, i);
+ const ENG_STATE_T *tug_mask =
+ (const ENG_STATE_T *)((const char *)info + info->tugMaskOffset);
- if (!TESTBIT_STATE(cyclics, info->cyclicState)) {
+ if (!TESTBIT_STATE(cyclics, info->cyclicState)
+ && ISZERO_STATE(AND_STATE(cyclics, LOAD_FROM_ENG(tug_mask)))) {
DEBUG_PRINTF("is dead\n");
continue;
}
/*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
u64a repeatLastTopBitmap(const union RepeatControl *ctrl) {
const struct RepeatBitmapControl *xs = &ctrl->bitmap;
+ if (!xs->bitmap) {
+ /* last top was too long ago */
+ return 0;
+ }
return xs->offset + 63 - clz64(xs->bitmap);
}