Beispiel #1
0
 public static void instrument(LoopMonitor monitor, RuntimeValues<?> runtimeValues) {
   While loop = monitor.loop();
   CtWhile astLoop = loop.astLoop();
   Factory factory = astLoop.getFactory();
   CollectableValueFinder finder = CollectableValueFinder.valueFinderFromWhile(astLoop);
   CtStatement catchCallback = appendMonitorCallbacks(factory, monitor, loop, astLoop);
   CtIf newIf = loopBodyWrapper(factory, monitor, loop, astLoop, catchCallback);
   declareOriginalConditionEvaluation(factory, monitor, loop, newIf);
   declareConditionEvaluation(factory, monitor, loop, newIf);
   declareEntrancesCounter(factory, monitor, astLoop);
   traceReachableValues(monitor, loop, newIf, finder, runtimeValues);
 }
Beispiel #2
0
 private static void declareEntrancesCounter(
     Factory factory, LoopMonitor monitor, CtWhile astLoop) {
   CtLocalVariable<Integer> counterCreation =
       newLocalVariableDeclaration(
           factory, int.class, counterName(monitor), 0, astLoop.getParent());
   insertBeforeUnderSameParent(counterCreation, astLoop);
 }