Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2018-04-23 09:07:13 +0000
committerEd Willink2018-04-23 09:07:13 +0000
commita434c90d2aa111ae2de3621dca9da15f05636269 (patch)
treea685c379dc01210d3e0bf2e8f4d9f41e961c6e83
parent62a80cfb92defe265b138e2bea6d9039c3eb6e68 (diff)
downloadorg.eclipse.qvtd-ewillink/532429a.tar.gz
org.eclipse.qvtd-ewillink/532429a.tar.xz
org.eclipse.qvtd-ewillink/532429a.zip
wip early ConditionCheck usageewillink/532429a
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/checks/CheckedConditionAnalysis.java10
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/MappingPartitioner.java20
2 files changed, 26 insertions, 4 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/checks/CheckedConditionAnalysis.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/checks/CheckedConditionAnalysis.java
index af346ab95..a331d6e72 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/checks/CheckedConditionAnalysis.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/checks/CheckedConditionAnalysis.java
@@ -23,6 +23,7 @@ import org.eclipse.ocl.pivot.CompleteModel;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.util.Visitable;
+import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.qvtd.compiler.internal.qvtb2qvts.ScheduleManager;
import org.eclipse.qvtd.compiler.internal.qvts2qvts.utilities.ReachabilityForest;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
@@ -157,7 +158,8 @@ public class CheckedConditionAnalysis
}
}
Property checkedProperty = checkedEdge.getProperty();
- if (allCheckedProperties.contains(checkedProperty)) {
+ Set<@NonNull Property> allCheckedProperties2 = allCheckedProperties;
+ if ((allCheckedProperties2 == null) || allCheckedProperties2.contains(checkedProperty)) {
if (checkedNavigableEdges == null) {
checkedNavigableEdges = new HashSet<>();
}
@@ -286,7 +288,7 @@ public class CheckedConditionAnalysis
/**
* All properties (and their opposites) that need to be checked for readiness before access.
*/
- private final @NonNull Set<@NonNull Property> allCheckedProperties;
+ private final @Nullable Set<@NonNull Property> allCheckedProperties;
/**
* The unconditional old edges provide the pattern matching workload.
@@ -316,7 +318,7 @@ public class CheckedConditionAnalysis
/**
* Return all properties (and their opposites) that need checking for readiness prior to access.
*/
- private @NonNull Set<@NonNull Property> computeCheckedProperties() {
+ protected @Nullable Set<@NonNull Property> computeCheckedProperties() {
//
// Better, we would not be pessimistic about input/output typedModel ambiguity in endogeneous
// mappings, but that incurs many typedModel accuracy issues.
@@ -356,7 +358,7 @@ public class CheckedConditionAnalysis
}
public @NonNull Set<@NonNull Property> getAllCheckedProperties() {
- return allCheckedProperties;
+ return ClassUtil.nonNullState(allCheckedProperties);
}
public @NonNull Iterable<@NonNull Edge> getOldUnconditionalEdges() {
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/MappingPartitioner.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/MappingPartitioner.java
index eca6e6e81..a4f47e43b 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/MappingPartitioner.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/MappingPartitioner.java
@@ -29,6 +29,8 @@ import org.eclipse.qvtd.compiler.internal.qvtb2qvts.RegionHelper;
import org.eclipse.qvtd.compiler.internal.qvtb2qvts.ScheduleManager;
import org.eclipse.qvtd.compiler.internal.qvtm2qvts.QVTm2QVTs;
import org.eclipse.qvtd.compiler.internal.qvtr2qvtc.QVTrNameGenerator;
+import org.eclipse.qvtd.compiler.internal.qvts2qvts.checks.CheckedCondition;
+import org.eclipse.qvtd.compiler.internal.qvts2qvts.checks.CheckedConditionAnalysis;
import org.eclipse.qvtd.compiler.internal.qvts2qvts.utilities.ReachabilityForest;
import org.eclipse.qvtd.compiler.internal.utilities.CompilerUtil;
import org.eclipse.qvtd.pivot.qvtschedule.DispatchRegion;
@@ -741,6 +743,12 @@ public class MappingPartitioner implements Nameable
return oldPrimaryNavigableEdges;
}
+ private @NonNull Iterable<@NonNull Node> getOldReachabilityRootNodes() {
+ Iterable<@NonNull Node> traceNodes = region.getHeadNodes();
+ Iterable<@NonNull Node> constantInputNodes = getConstantInputNodes();
+ return Iterables.concat(traceNodes, constantInputNodes);
+ }
+
public @NonNull Iterable<@NonNull Edge> getPredicatedEdges() {
return predicatedEdges;
}
@@ -1037,6 +1045,18 @@ public class MappingPartitioner implements Nameable
return Collections.singletonList(region);
}
boolean isCyclic = transformationPartitioner.getCycleAnalysis(this) != null;
+ if (isCyclic) {
+ ReachabilityForest checkedReachabilityForest = new ReachabilityForest(getOldReachabilityRootNodes(), getOldPrimaryNavigableEdges());
+ CheckedConditionAnalysis analysis = new CheckedConditionAnalysis(scheduleManager, checkedReachabilityForest, region)
+ {
+ @Override
+ protected @Nullable Set<@NonNull Property> computeCheckedProperties() {
+ return null;
+ }
+ };
+ Set<@NonNull CheckedCondition> checkedConditions = analysis.computeCheckedConditions();
+ System.out.println(checkedConditions);
+ }
List<@NonNull Node> predicatedWhenNodes = getPredicatedWhenNodes();
List<@NonNull Node> realizedExecutionNodes = getRealizedExecutionNodes();
boolean needsActivator = false;

Back to the top