Re: [PATCH V5 04/16] rv/include: Add deterministic automata monitor definition via C macros

From: Daniel Bristot de Oliveira
Date: Mon Jul 18 2022 - 03:54:29 EST


On 7/17/22 17:18, Tao Zhou wrote:
>> +static int task_mon_slot_##name = RV_PER_TASK_MONITOR_INIT; \
> In patch1, RV_PER_TASK_MONITOR_INIT is defined as:
>
> #define RV_PER_TASK_MONITORS 1
> #define RV_PER_TASK_MONITOR_INIT (RV_PER_TASK_MONITORS)
>
> RV_PER_TASK_MONITOR_INIT is 1 now, seems not the index of the first only
> element in vector. Now no map here, one task has one monitor though if I
> am not wrong.
> So task_mon_slot_##name must be defined to the index of first element.
> Modify the macro definition of RV_PER_TASK_MONITOR_INIT to the index of
> first element in vector.
>
> #define RV_PER_TASK_MONITOR_INIT (RV_PER_TASK_MONITORS) - 1

nop, (RV_PER_TASK_MONITORS) is an invalid vector value, so we can detect things like:
disabling a disabled monitor.

(I forgot to reset it when disabling a monitor... added)

-- Daniel