Inlining entering or exiting reactions is based on the following criteria:
Note that this criteria is based on the average number of inlined statements for the number of reaction statements. For example, if the number of reactive statements is 5 and the number of transitions is 10, the average is 5 statements.
An exit reaction is inlined when none of the following scenarios are encountered:
● The operator stop_activity is used for any ancestor of the control activity with which the statechart is connected, at least one state has more than a single descendant, and at least one of its descendants has an exiting reaction.
● A transition exiting from a state exists and has more than a single descendant, and at least one of its descendants has an exiting reaction.When inlining take place, the exit reaction code is added to the transition code segment after the transition action itself, but before the entering action code. If an inlining scenario is encountered but inlining cannot be performed, MicroC does one of the following:
● If there are entering reactions, MicroC adds a call to the exiting reaction function (cgExit...) to the transition code segment. The cgExit... function will not be called at the end of the statechart code.
● In the absence of an entering reaction, MicroC does not add a call to the transition code segment. The call to cgExit... is done at the end of the statechart code, as occurs when optimization is not used.