Skip to content

Commit

Permalink
Lead out message queue optimization to API
Browse files Browse the repository at this point in the history
  • Loading branch information
grbeni committed Sep 26, 2023
1 parent f981bde commit 878b864
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Gamma2XstsUppaalTransformerSerializer {
val xStsTransformer = new Gamma2XstsTransformerSerializer(component,
arguments, targetFolderUri,
fileName, minSchedulingConstraint, maxSchedulingConstraint,
optimize, false,
optimize, false, false,
transitionMerging,
slicingProperties, annotatableElements,
initialState, initialStateSetting)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public void execute(AnalysisModelTransformation transformation) throws IOExcepti
component, reference.getArguments(),
targetFolderUri, fileName,
minSchedulingConstraint, maxSchedulingConstraint,
transformation.isOptimize(), true,
transformation.isOptimize(), true, true,
TransitionMerging.HIERARCHICAL,
transformation.getPropertyPackage(), new AnnotatablePreprocessableElements(
testedComponentsForStates, testedComponentsForTransitions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Gamma2XstsNuxmvTransformerSerializer {
val xStsTransformer = new Gamma2XstsTransformerSerializer(component,
arguments, targetFolderUri,
fileName, minSchedulingConstraint, maxSchedulingConstraint,
optimize, true, // Optimize arrays?
optimize, true, /* Optimize arrays? */ true, /* Optimize message queues */
transitionMerging,
slicingProperties, annotatableElements,
initialState, initialStateSetting)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Gamma2XstsPromelaTransformerSerializer {
val xStsTransformer = new Gamma2XstsTransformerSerializer(component,
arguments, targetFolderUri,
fileName, minSchedulingConstraint, maxSchedulingConstraint,
optimize, true, // Optimize arrays?
optimize, true, /* Optimize arrays? */ false, /* Optimize message queues? */
transitionMerging,
slicingProperties, annotatableElements,
initialState, initialStateSetting)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ScenarioStatechartTraceGenerator {
val name = statechart.name
val compInstanceRef = new ComponentInstanceReferences(newArrayList,newArrayList)
val transformator = new Gamma2XstsTransformerSerializer(statechart, arguments, absoluteParentFolder, name, schedulingConstraint, schedulingConstraint,
true, false, TransitionMerging.HIERARCHICAL, null,
true, false, false, TransitionMerging.HIERARCHICAL, null,
new AnnotatablePreprocessableElements(null, compInstanceRef, null, null, null,
InteractionCoverageCriterion.EVERY_INTERACTION, InteractionCoverageCriterion.EVERY_INTERACTION, null,
DataflowCoverageCriterion.ALL_USE, null, DataflowCoverageCriterion.ALL_USE), null, null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ class MessageQueueOptimizer {
val addAction = flattenedQueueVariable.createAssignmentAction(clonedRhs)

addAction.replace(action)
return
}
else { // q[size] := x;
val sizeVariable = index.declaration
Expand All @@ -230,8 +229,8 @@ class MessageQueueOptimizer {

val newAddAction = ifActions.weave
newAddAction.replace(action)
return
}
return
}
}
throw new IllegalArgumentException("Not known action: " + action)
Expand Down Expand Up @@ -304,8 +303,8 @@ class MessageQueueOptimizer {
val notEmptyAssumption = notEmptyExpression.createAssumeAction

action.appendToAction(notEmptyAssumption)
return
}
return
}
throw new IllegalArgumentException("Not known action: " + action)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class GammaToXstsTransformer {
protected final InitialStateSetting initialStateSetting
protected final boolean optimize
protected final boolean optimizeArrays
protected final boolean optimizeMessageQueues = false
protected final boolean optimizeMessageQueues
// Auxiliary objects
protected final extension GammaEcoreUtil ecoreUtil = GammaEcoreUtil.INSTANCE
protected final extension ActionSerializer actionSerializer = ActionSerializer.INSTANCE
Expand All @@ -82,26 +82,28 @@ class GammaToXstsTransformer {
protected final Logger logger = Logger.getLogger("GammaLogger")

new() {
this(null, true, true, false, TransitionMerging.HIERARCHICAL)
this(null, true, true, false, false, TransitionMerging.HIERARCHICAL)
}

new(Integer schedulingConstraint, boolean transformOrthogonalActions,
boolean optimize, boolean optimizeArrays, TransitionMerging transitionMerging) {
boolean optimize, boolean optimizeArrays, boolean optimizeMessageQueues,
TransitionMerging transitionMerging) {
this(schedulingConstraint, transformOrthogonalActions,
optimize, optimizeArrays, transitionMerging,
null, null)
optimize, optimizeArrays, optimizeMessageQueues,
transitionMerging, null, null)
}

new(Integer schedulingConstraint, boolean transformOrthogonalActions,
boolean optimize, boolean optimizeArrays, TransitionMerging transitionMerging,
boolean optimize, boolean optimizeArrays, boolean optimizeMessageQueues,
TransitionMerging transitionMerging,
PropertyPackage initialState, InitialStateSetting initialStateSetting) {
this(schedulingConstraint, schedulingConstraint,
transformOrthogonalActions, optimize, optimizeArrays, transitionMerging,
initialState, initialStateSetting)
transformOrthogonalActions, optimize, optimizeArrays, optimizeMessageQueues,
transitionMerging, initialState, initialStateSetting)
}

new(Integer minSchedulingConstraint, Integer maxSchedulingConstraint,
boolean transformOrthogonalActions, boolean optimize, boolean optimizeArrays,
boolean transformOrthogonalActions, boolean optimize, boolean optimizeArrays, boolean optimizeMessageQueues,
TransitionMerging transitionMerging,
PropertyPackage initialState, InitialStateSetting initialStateSetting) {
this.gammaToLowlevelTransformer = new GammaToLowlevelTransformer
Expand All @@ -113,6 +115,7 @@ class GammaToXstsTransformer {
this.initialStateSetting = initialStateSetting
this.optimize = optimize
this.optimizeArrays = optimizeArrays
this.optimizeMessageQueues = optimizeMessageQueues
}

def preprocessAndExecuteAndSerialize(Package _package,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Gamma2XstsTransformerSerializer {
// Configuration
protected final boolean optimize
protected final boolean optimizeArray
protected final boolean optimizeMessageQueues
protected final TransitionMerging transitionMerging
// Slicing
protected final PropertyPackage slicingProperties
Expand Down Expand Up @@ -70,7 +71,7 @@ class Gamma2XstsTransformerSerializer {
String targetFolderUri, String fileName,
Integer schedulingConstraint) {
this(component, arguments, targetFolderUri, fileName, schedulingConstraint, schedulingConstraint,
true, false, TransitionMerging.HIERARCHICAL,
true, false, false, TransitionMerging.HIERARCHICAL,
null, new AnnotatablePreprocessableElements(null, null, null, null, null,
InteractionCoverageCriterion.EVERY_INTERACTION, InteractionCoverageCriterion.EVERY_INTERACTION,
null, DataflowCoverageCriterion.ALL_USE,
Expand All @@ -81,7 +82,7 @@ class Gamma2XstsTransformerSerializer {
new(Component component, List<Expression> arguments,
String targetFolderUri, String fileName,
Integer minSchedulingConstraint, Integer maxSchedulingConstraint,
boolean optimize, boolean optimizeArray,
boolean optimize, boolean optimizeArray, boolean optimizeMessageQueues,
TransitionMerging transitionMerging,
PropertyPackage slicingProperties,
AnnotatablePreprocessableElements annotatableElements,
Expand All @@ -95,6 +96,7 @@ class Gamma2XstsTransformerSerializer {
//
this.optimize = optimize
this.optimizeArray = optimizeArray
this.optimizeMessageQueues = optimizeMessageQueues
this.transitionMerging = transitionMerging
//
this.slicingProperties = slicingProperties
Expand All @@ -119,7 +121,8 @@ class Gamma2XstsTransformerSerializer {
targetFolderUri, fileName)
slicerAnnotatorAndPropertyGenerator.execute
val gammaToXSTSTransformer = new GammaToXstsTransformer(
minSchedulingConstraint, maxSchedulingConstraint, true, true, optimizeArray,
minSchedulingConstraint, maxSchedulingConstraint,
true, true, optimizeArray, optimizeMessageQueues,
transitionMerging, initialState, initialStateSetting)
// Normal transformation
val xSts = gammaToXSTSTransformer.execute(newGammaPackage)
Expand Down

0 comments on commit 878b864

Please sign in to comment.