Open miho opened 9 years ago
The current implementation only inserts one invocation into the loop. Chained or nested invocations are left outside of the loop.
To improve the current instrumentation implementation we should introduce a clean event api that can publish events to registered observers without changing the instrumented code. Therefore, we should add an API like the previously, Groovy specific VRLInstrumentationUtil
class and
static void VRLInstrumentationUtil.__preEvent(...)
static void VRLInstrumentationUtil.__postEvent(...)
and ideally invocation generators that generate the static method calls in the corresponding model:
static void VRLInstrumentationUtil.generatePreEvent(...)
static void VRLInstrumentationUtil.generatePostEvent(...)
Basic CSG instrumentation works!
another example:
Event generation for return statements has a bug (no event can be fired after returning from a method).
Example:
__vrl_reserved_intermediate_var_6);
VRLInstrumentationUtil.__preEvent("14", "return",
__vrl_reserved_intermediate_var_6);
return __vrl_reserved_intermediate_var_6;
VRLInstrumentationUtil.__postEvent("14", "return");
}
Therefore, we need to swap the return statement invocation and its post-event invocation:
__vrl_reserved_intermediate_var_6);
VRLInstrumentationUtil.__preEvent("14", "return",
__vrl_reserved_intermediate_var_6);
VRLInstrumentationUtil.__postEvent("14", "return");
return __vrl_reserved_intermediate_var_6;
}
The same applies to continue and break.
Instead of a Groovy based transform we need a model based instrumentation in the future to ensure that instrumentation also works for other (potential) language bindings. Instead of a special utility method the idea is to directly insert pre/post events into the source.
Example 1:
will be transformed to something like:
For chained invocations and operators we need to introduce additional tmp-variables:
Example 2:
will be transformed to something like:
We will also need to introduce a mapping between events and visual nodes to use the instrumentation from the ui.
Loops:
Loops need special treatment:
will be transformed to:
For complex condition arguments we need to extract the whole invocation chain and move it into the while loop.