diff options
author | Ed Willink | 2017-01-12 10:24:28 +0000 |
---|---|---|
committer | Ed Willink | 2017-02-03 10:08:37 +0000 |
commit | f8134bd053cce23e7358e58e9052df62317f5b10 (patch) | |
tree | 62bf0c2b6712494514e2bb55c49c6bbf13c173d5 | |
parent | ee2d7723af61dbe7fdb62c6ae1f598f8da8fe121 (diff) | |
download | org.eclipse.qvtd-f8134bd053cce23e7358e58e9052df62317f5b10.tar.gz org.eclipse.qvtd-f8134bd053cce23e7358e58e9052df62317f5b10.tar.xz org.eclipse.qvtd-f8134bd053cce23e7358e58e9052df62317f5b10.zip |
[487692] Eliminate dead CyclicScheduledRegion
12 files changed, 62 insertions, 1179 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java index 9e0e4ce8c..60ff0a07b 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractRegion.java @@ -1944,11 +1944,6 @@ public abstract class AbstractRegion implements Region, ToDOT.ToDOTable } @Override - public boolean isCyclicScheduledRegion() { - return false; - } - - @Override public boolean isOperationRegion() { return false; } diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractScheduledRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractScheduledRegion.java index 1b0eb8ef4..f390a36d5 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractScheduledRegion.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractScheduledRegion.java @@ -91,19 +91,6 @@ public abstract class AbstractScheduledRegion extends AbstractRegion implements } @Override - public @NonNull CyclicScheduledRegion createCyclicScheduledRegion(@NonNull Iterable<@NonNull Region> cycle) { - for (@NonNull Region region : cycle) { - removeRegion(region); - } - CyclicScheduledRegion cyclicRegion = new CyclicScheduledRegion(this, cycle); - addRegion(cyclicRegion); - if (QVTp2QVTs.DEBUG_GRAPHS.isActive()) { - cyclicRegion.writeDebugGraphs("3-cycle"); - } - return cyclicRegion; - } - - @Override public void createLocalSchedule() { // // Partition single region recursive connections into base cases recursive case connections with associated region recursions. diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractVisitor.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractVisitor.java index 4dd530d1c..1f3d3ce15 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractVisitor.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractVisitor.java @@ -43,11 +43,6 @@ public abstract class AbstractVisitor<R> implements Visitor<R> } @Override - public R visitCyclicScheduledRegion(@NonNull CyclicScheduledRegion cyclicScheduledRegion) { - return visitRegion(cyclicScheduledRegion); - } - - @Override public R visitEdge(@NonNull Edge edge) { return visiting(edge); } diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/CyclicScheduledRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/CyclicScheduledRegion.java deleted file mode 100644 index 8c41edbf9..000000000 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/CyclicScheduledRegion.java +++ /dev/null @@ -1,678 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Willink Transformations and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * E.D.Willink - Initial API and implementation - *******************************************************************************/ -package org.eclipse.qvtd.compiler.internal.qvtp2qvts; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.analysis.ClassDatumAnalysis; -import org.eclipse.qvtd.compiler.internal.utilities.SymbolNameBuilder; -import org.eclipse.qvtd.pivot.qvtbase.graphs.GraphStringBuilder; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - -/** - * A CyclicScheduledRegion contains the inner regions of a cycle. - */ -public class CyclicScheduledRegion extends AbstractScheduledRegion -{ - public static NodeRole.@NonNull Phase mergePhase(NodeRole.@NonNull Phase phase1, NodeRole.@Nullable Phase phase2) { - if (phase2 == null) { - return phase1; - } - switch (phase1) { - case CONSTANT:{ - switch (phase2) { - case CONSTANT: return NodeRole.Phase.CONSTANT; - case LOADED: return NodeRole.Phase.LOADED; - case PREDICATED: return NodeRole.Phase.PREDICATED; - case REALIZED: return NodeRole.Phase.REALIZED; - } - } - case LOADED:{ - switch (phase2) { - case CONSTANT: return NodeRole.Phase.LOADED; - case LOADED: return NodeRole.Phase.LOADED; - case PREDICATED: return NodeRole.Phase.PREDICATED; - case REALIZED: return NodeRole.Phase.REALIZED; - } - } - case PREDICATED:{ - switch (phase2) { - case CONSTANT: return NodeRole.Phase.PREDICATED; - case LOADED: return NodeRole.Phase.PREDICATED; - case PREDICATED: return NodeRole.Phase.PREDICATED; - case REALIZED: return NodeRole.Phase.REALIZED; - } - } - case REALIZED:{ - switch (phase2) { - case CONSTANT: return NodeRole.Phase.REALIZED; - case LOADED: return NodeRole.Phase.REALIZED; - case PREDICATED: return NodeRole.Phase.REALIZED; - case REALIZED: return NodeRole.Phase.REALIZED; - } - } - } - throw new UnsupportedOperationException(); - } - - protected final @NonNull ScheduledRegion parentScheduledRegion; - - /** - * The nodes to which inputs are passed. - */ - private @NonNull List<@NonNull Node> headNodes = new ArrayList<@NonNull Node>(); - - /** - * The nodes to which inputs are passed. - */ - // private @NonNull List<@NonNull Node> extraGuardNodes = new ArrayList<@NonNull Node>(); - - /** - * The nodes from which outputs are passed. - */ - // private @NonNull List<@NonNull Node> tailNodes = new ArrayList<@NonNull Node>(); - - public CyclicScheduledRegion(@NonNull ScheduledRegion parentScheduledRegion, @NonNull Iterable<@NonNull Region> regions) { - super(parentScheduledRegion.getMultiRegion()); - this.parentScheduledRegion = parentScheduledRegion; - for (@NonNull Region region : regions) { - addRegion(region); - } - createHeadNodes(); - // createExtraHeadNodes(); - // createTailNodes(); - // relocateInternalConnections(); - // for (@NonNull Node headNode : headNodes) { - // for (@NonNull Node tailNode : tailNodes) { - // Edges.PRIMARY_RECURSION.createEdge(this, headNode, tailNode); - // } - // } - // toGraph(new DOTStringBuilder()); - // toGraph(new GraphMLStringBuilder()); - } - - @Override - public <R> R accept(@NonNull Visitor<R> visitor) { - return visitor.visitCyclicScheduledRegion(this); - } - - /* private void createExtraHeadNodes() { - Map<@NonNull ClassDatumAnalysis, @NonNull Set<@NonNull Node>> type2extraNodes = new HashMap<@NonNull ClassDatumAnalysis, @NonNull Set<@NonNull Node>>(); - for (@NonNull Region innerRegion : getRegions()) { - for (@NonNull Node guardNode : innerRegion.getGuardNodes()) { - if (guardNode.getNodeRole().isExtraGuardVariable()) { - ClassDatumAnalysis classDatumAnalysis = guardNode.getClassDatumAnalysis(); - Set<@NonNull Node> extraNodes = type2extraNodes.get(classDatumAnalysis); - if (extraNodes == null) { - extraNodes = new HashSet<@NonNull Node>(); - type2extraNodes.put(classDatumAnalysis, extraNodes); - } - extraNodes.add(guardNode); - } - } - } - int i = 0; - for (@NonNull ClassDatumAnalysis classDatumAnalysis : type2extraNodes.keySet()) { - Set<@NonNull Node> extraNodes = type2extraNodes.get(classDatumAnalysis); - assert extraNodes != null; - NodeRole.Phase nodeRolePhase = null; - for (@NonNull Node extraNode : extraNodes) { - NodeRole.Phase targetNodeRolePhase = extraNode.getNodeRole().getPhase(); - nodeRolePhase = mergePhase(targetNodeRolePhase, nodeRolePhase); - } - assert nodeRolePhase != null; - Node extraGuardNode = Nodes.INPUT.createNode(this, nodeRolePhase, "«extra-" + (extraGuardNodes.size()+1) + "»", classDatumAnalysis); - extraGuardNodes.add(extraGuardNode); - NodeConnection nodeConnection = getNodeConnection(Collections.singletonList(extraGuardNode), classDatumAnalysis); - for (@NonNull Node extraNode : extraNodes) { - nodeConnection.addUsedTargetNode(extraNode, false); - } - } - } */ - - @Override - protected @NonNull SymbolNameBuilder computeSymbolName() { - List<@NonNull String> names = new ArrayList<@NonNull String>(); - for (@NonNull NodeConnection connection : getIncomingPassedConnections()) { - String name = connection.getClassDatumAnalysis().getCompleteClass().getName(); - assert name != null; - names.add(name); - } - Collections.sort(names); - SymbolNameBuilder s = new SymbolNameBuilder(); - s.appendString("r_"); - for (@NonNull String name : names) { - s.appendString("_"); - s.appendName(name); - } - return s; - } - - private void createHeadNodes() { - // - // Identify the same-typed passed connections to be merged. - // - Map<@NonNull ClassDatumAnalysis, @NonNull Set<@NonNull NodeConnection>> classDatumAnalysis2connections = new HashMap<@NonNull ClassDatumAnalysis, @NonNull Set<@NonNull NodeConnection>>(); - for (@NonNull Region innerRegion : getRegions()) { - for (@NonNull NodeConnection connection : innerRegion.getIncomingPassedConnections()) { - ClassDatumAnalysis classDatumAnalysis = connection.getClassDatumAnalysis(); - Set<@NonNull NodeConnection> connections = classDatumAnalysis2connections.get(classDatumAnalysis); - if (connections == null) { - connections = new HashSet<@NonNull NodeConnection>(); - classDatumAnalysis2connections.put(classDatumAnalysis, connections); - } - connections.add(connection); - } - } - // - // Create a head to partition each same-typed set of incoming connection into an external and internal connection. - // - for (@NonNull ClassDatumAnalysis classDatumAnalysis : classDatumAnalysis2connections.keySet()) { - Set<@NonNull NodeConnection> oldConnections = classDatumAnalysis2connections.get(classDatumAnalysis); - assert oldConnections != null; - Node headNode = createHeadNode(classDatumAnalysis, oldConnections); - headNodes.add(headNode); - } - } - - private @NonNull Node createHeadNode(@NonNull ClassDatumAnalysis classDatumAnalysis, @NonNull Set<@NonNull NodeConnection> oldConnections) { - // - // Identify the sources of the same-typed connections. - // - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - Set<@NonNull Node> externalSourceNodes = new HashSet<@NonNull Node>(); - Set<@NonNull Node> internalSourceNodes = new HashSet<@NonNull Node>(); - ScheduledRegion commonRegion = null; - for (@NonNull NodeConnection oldConnection : oldConnections) { - if (commonRegion == null) { - commonRegion = oldConnection.getRegion(); - } - else { - // FIXME compute common regions - } - for (@NonNull Node sourceNode : oldConnection.getSources()) { - Region sourceRegion = sourceNode.getRegion(); - if (!regions.contains(sourceRegion)) { - externalSourceNodes.add(sourceNode); - } - else { - internalSourceNodes.add(sourceNode); - } - } - } - assert commonRegion != null; - // - // Identify whether the head is LOADED/PREDICATED and what it connects to internally. - // - NodeRole.Phase nodeRolePhase = null; - Map<@NonNull Node, @NonNull NodeConnection> targetNode2oldConnection = new HashMap<@NonNull Node, @NonNull NodeConnection>(); - for (@NonNull NodeConnection oldConnection : oldConnections) { - for (Map.Entry<@NonNull Node, @NonNull ConnectionRole> entry : oldConnection.getTargets().entrySet()) { - @NonNull Node targetNode = entry.getKey(); - @NonNull ConnectionRole connectionRole = entry.getValue(); - if (connectionRole.isPassed()) { - Region targetRegion = targetNode.getRegion(); - if (regions.contains(targetRegion)) { - NodeRole.Phase targetNodeRolePhase = targetNode.getNodeRole().getPhase(); - nodeRolePhase = mergePhase(targetNodeRolePhase, nodeRolePhase); - targetNode2oldConnection.put(targetNode, oldConnection); - } - } - } - } - assert nodeRolePhase != null; - // - // Create the head. - // - String name = "«head" + (headNodes.size() > 0 ? Integer.toString(headNodes.size()) : "") + "»"; - Node headNode = RegionUtil.createInputNode(this, nodeRolePhase, name, classDatumAnalysis); - System.out.println("Create: " + headNode); - // - // Create the external connection from the composite externalSources to the new head. - // - NodeConnection newExternalConnection = commonRegion.getNodeConnection(externalSourceNodes, classDatumAnalysis); - newExternalConnection.addPassedTargetNode(headNode); - // - // Create the internal connection from the head to the old targets disconnecting them from their old connections. - // - NodeConnection newInternalConnection = getNodeConnection(Collections.singletonList(headNode), classDatumAnalysis); - for (Map.Entry<@NonNull Node, @NonNull NodeConnection> entry : targetNode2oldConnection.entrySet()) { - @NonNull Node targetNode = entry.getKey(); - @NonNull NodeConnection oldConnection = entry.getValue(); - targetNode.removeIncomingConnection(oldConnection); - oldConnection.removeTarget(targetNode); - newInternalConnection.addPassedTargetNode(targetNode); - } - // - // Destroy obsolete connections. - // - for (@NonNull NodeConnection oldConnection : oldConnections) { - if ((newExternalConnection != oldConnection) && Iterables.isEmpty(oldConnection.getTargetNodes())) { - oldConnection.destroy(); - System.out.println("Destroy: " + oldConnection); - } - } - return headNode; - } - /* @NonNull NodeConnection externalConnection; - if (externalConnections.size() > 1) { - Set<@NonNull Node> externalSourceNodes = null; -// Set<@NonNull Node> internalSourceNodes = null; - for (@NonNull Node sourceNode : connection.getSources()) { - Region sourceRegion = sourceNode.getRegion(); - if (!regions.contains(sourceRegion)) { - } -// else {} -- internalSources resolved after unifying connections -// if (internalSourceNodes == null) { -// internalSourceNodes = new HashSet<@NonNull Node>(); -// } -// internalSourceNodes.add(sourceNode); -// } - } - if (externalSourceNodes != null) { - Set<@NonNull NodeConnection> connections = classDatumAnalysis2connections.get(externalSourceNodes); - if (connections == null) { - connections = new HashSet<@NonNull NodeConnection>(); - externalSourceNodes2connections.put(externalSourceNodes, connections); - } - connections.add(connection); - } - } - } - // - // Create a replacement connection to each passed set of externalSources without the internal sources. - // - for (@NonNull Set<@NonNull Node> externalSourceNodes : externalSourceNodes2connections.keySet()) { - Set<@NonNull NodeConnection> oldConnections = externalSourceNodes2connections.get(externalSourceNodes); - assert oldConnections != null; - Set<@NonNull Node> internalTargetNodes = new HashSet<@NonNull Node>(); - NodeRole.Phase nodeRolePhase = null; - NodeConnection anOldConnection = oldConnections.iterator().next(); - ClassDatumAnalysis classDatumAnalysis = anOldConnection.getClassDatumAnalysis(); - NodeConnection newExternalConnection = anOldConnection.getRegion().getNodeConnection(externalSourceNodes, classDatumAnalysis); - for (@NonNull NodeConnection oldConnection : oldConnections) { - if (newExternalConnection != oldConnection) { - for (Map.Entry<@NonNull Node, @NonNull ConnectionRole> entry : oldConnection.getTargets().entrySet()) { - @NonNull Node targetNode = entry.getKey(); - @NonNull ConnectionRole connectionRole = entry.getValue(); - if (connectionRole.isPassed()) { - Region targetRegion = targetNode.getRegion(); - if (regions.contains(targetRegion)) { - targetNode.removeIncomingConnection(oldConnection); - oldConnection.removeTarget(targetNode); - newExternalConnection.addPassedTargetNode(targetNode); - internalTargetNodes.add(targetNode); - NodeRole.Phase targetNodeRolePhase = targetNode.getNodeRole().getPhase(); - nodeRolePhase = mergePhase(targetNodeRolePhase, nodeRolePhase); - } - } - } - } - } - assert nodeRolePhase != null; - String name = "-head-" + classDatumAnalysis.toString(); //outerConnection.getName(); - Node headNode = Nodes.INPUT.createNode(this, nodeRolePhase, name, classDatumAnalysis); - headNodes.add(headNode); - newExternalConnection.addPassedTargetNode(headNode); - for (@NonNull NodeConnection oldConnection : oldConnections) { - if ((newExternalConnection != oldConnection) && Iterables.isEmpty(oldConnection.getTargetNodes())) { - oldConnection.destroy(); - } - } - NodeConnection newInternalConnection = getNodeConnection(Collections.singletonList(headNode), classDatumAnalysis); - for (@NonNull Node internalTargetNode : internalTargetNodes) { - newInternalConnection.addPassedTargetNode(internalTargetNode); - } - } */ - /* for (@NonNull NodeConnection outerConnection : incomingConnections2headNodes.keySet()) { - Set<@NonNull Node> targetNodes = incomingConnections2headNodes.get(outerConnection); - assert targetNodes != null; - NodeRole.Phase nodeRolePhase = null; - for (@NonNull Node targetNode : targetNodes) { - NodeRole.Phase targetNodeRolePhase = targetNode.getNodeRole().getPhase(); - nodeRolePhase = mergePhase(targetNodeRolePhase, nodeRolePhase); - } - assert nodeRolePhase != null; - ClassDatumAnalysis classDatumAnalysis = outerConnection.getClassDatumAnalysis(); - String name = "-head-" + classDatumAnalysis.toString(); //outerConnection.getName(); - Node headNode = Nodes.INPUT.createNode(this, nodeRolePhase, name, classDatumAnalysis); - outerConnection.addPassedTargetNode(headNode); -// List<@NonNull Node> headNodeList = Collections.singletonList(headNode); -// NodeConnection innerConnection = getNodeConnection(headNodeList, classDatumAnalysis); -// for (@NonNull Node targetNode : targetNodes) { -// targetNode.removeIncomingConnection(outerConnection); -// outerConnection.removeTarget(targetNode); -// if (!Iterables.contains(innerConnection.getTargetNodes(), targetNode)) { -// innerConnection.addPassedTargetNode(targetNode); -// } -// } -// addConnection(innerConnection); -// outerConnection.addSubConnection(innerConnection); - headNodes.add(headNode); - } */ - // } - - /** - * Every outgoing connection that passes a value must have a tail node to accumulate the value to be passed. - * - private void createTailNodes() { - Map<@NonNull NodeConnection, @NonNull Set<@NonNull Node>> outgoingConnections2tailNodes = new HashMap<@NonNull NodeConnection, @NonNull Set<@NonNull Node>>(); - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region innerRegion : regions) { - for (@NonNull NodeConnection connection : innerRegion.getOutgoingPassedConnections()) { - for (@NonNull Node targetNode : connection.getTargetNodes()) { - Region targetRegion = targetNode.getRegion(); - if (!regions.contains(targetRegion)) { - Set<@NonNull Node> innerTailNodes = outgoingConnections2tailNodes.get(connection); - if (innerTailNodes == null) { - innerTailNodes = new HashSet<@NonNull Node>(); - outgoingConnections2tailNodes.put(connection, innerTailNodes); - } - for (@NonNull Node sourceNode : connection.getSourceNodes()) { - Region sourceRegion = sourceNode.getRegion(); - if (regions.contains(sourceRegion)) { - innerTailNodes.add(sourceNode); - } - } - } - } - } - } - for (@NonNull NodeConnection outerConnection : outgoingConnections2tailNodes.keySet()) { - Set<@NonNull Node> sourceNodes = outgoingConnections2tailNodes.get(outerConnection); - assert sourceNodes != null; - NodeRole.Phase nodeRolePhase = null; - for (@NonNull Node sourceNode : sourceNodes) { - NodeRole.Phase sourceNodeRolePhase = sourceNode.getNodeRole().getPhase(); - nodeRolePhase = mergePhase(sourceNodeRolePhase, nodeRolePhase); - } - assert nodeRolePhase != null; - ClassDatumAnalysis classDatumAnalysis = outerConnection.getClassDatumAnalysis(); - String name = "-tail-" + classDatumAnalysis.toString(); //outerConnection.getName(); - Node tailNode = Nodes.OUTPUT.createNode(this, nodeRolePhase, name, classDatumAnalysis); -// @NonNull List<@NonNull Node> tailNodeList = Collections.singletonList(tailNode); - NodeConnection innerConnection = getNodeConnection(sourceNodes, classDatumAnalysis); - innerConnection.addPassedTargetNode(tailNode); -// addConnection(innerConnection); - tailNodes.add(tailNode); - outerConnection.getRegion().replaceSources(outerConnection, sourceNodes, tailNode); -// outerConnection.addSubConnection(innerConnection); - } - }*/ - - @Override - public @NonNull String getName() { - List<@NonNull String> names = new ArrayList<@NonNull String>(); - for (@NonNull Region region : getRegions()) { - names.add(region.getName()); - } - Collections.sort(names);; - StringBuilder s = new StringBuilder(); - // s.append(getClass().getSimpleName()); - for (String name : names) { - if (s.length() > 0) { - s.append("\\n"); - } - s.append(name); - } - return s.toString(); - } - - @Override - public @NonNull String getColor() { - return "brown"; - } - - // @Override - // public @NonNull Collection<@NonNull Connection> getConnections() { - // return Sets.newHashSet(Iterables.concat(getIncomingConnections(), getOutgoingConnections())); - // } - - // @Override - // public @NonNull List<@NonNull NodeConnection> getHeadConnections() { - // return getIncomingPassedConnections(); - // } - - @Override - public @NonNull List<@NonNull Node> getHeadNodes() { - return headNodes; - } - - @Override - public @NonNull Iterable<@NonNull DatumConnection> getIncomingConnections() { // FIXME cache - return Sets.newHashSet(Iterables.concat(getIncomingPassedConnections(), getIncomingUsedConnections())); - /* Set<@NonNull DatumConnection> connections = new HashSet<@NonNull DatumConnection>(); - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region region : regions) { - for (@NonNull DatumConnection connection : region.getIncomingConnections()) { - for (@NonNull Region sourceRegion : connection.getSourceRegions()) { - if (!regions.contains(sourceRegion) && !connections.contains(connection)) { - connections.add(connection); - } - } - } - } - return connections; */ - } - - /* @Override - public @NonNull List<@NonNull NodeConnection> getIncomingPassedConnections() { // FIXME cache - List<@NonNull NodeConnection> connections = new ArrayList<@NonNull NodeConnection>(); - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region region : regions) { - for (@NonNull NodeConnection connection : region.getIncomingPassedConnections()) { - for (@NonNull Region sourceRegion : connection.getSourceRegions()) { - if (!regions.contains(sourceRegion) && !connections.contains(connection)) { - connections.add(connection); - } - } - } - } - return connections; - } */ - - @Override - public @NonNull List<@NonNull NodeConnection> getIncomingUsedConnections() { // FIXME cache - List<@NonNull NodeConnection> connections = new ArrayList<@NonNull NodeConnection>(); - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region region : regions) { - for (@NonNull NodeConnection connection : region.getIncomingUsedConnections()) { - for (@NonNull Region sourceRegion : connection.getSourceRegions()) { - if (!regions.contains(sourceRegion) && !connections.contains(connection)) { - connections.add(connection); - } - } - } - } - return connections; - } - - @Override - public @NonNull List<@NonNull DatumConnection> getNextConnections() { // FIXME cache - Set<@NonNull DatumConnection> connections = new HashSet<@NonNull DatumConnection>(); - for (@NonNull Node headNode : headNodes) { - for (@NonNull NodeConnection connection : headNode.getOutgoingPassedConnections()) { - connections.add(connection); - } - } - Iterables.addAll(connections, getOutgoingUsedConnections()); - return Lists.newArrayList(connections); - /* List<@NonNull DatumConnection> connections = new ArrayList<@NonNull DatumConnection>(); - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region region : regions) { - for (@NonNull DatumConnection connection : region.getOutgoingConnections()) { - for (@NonNull Region targetRegion : connection.getTargetRegions()) { - if (!regions.contains(targetRegion) && !connections.contains(connection)) { - connections.add(connection); - } - } - } - } - return connections; */ - } - - @Override - public @NonNull List<@NonNull DatumConnection> getOutgoingConnections() { // FIXME cache - Set<@NonNull DatumConnection> connections = new HashSet<@NonNull DatumConnection>(); - Iterables.addAll(connections, getOutgoingPassedConnections()); - Iterables.addAll(connections, getOutgoingUsedConnections()); - return Lists.newArrayList(connections); - /* List<@NonNull DatumConnection> connections = new ArrayList<@NonNull DatumConnection>(); - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region region : regions) { - for (@NonNull DatumConnection connection : region.getOutgoingConnections()) { - for (@NonNull Region targetRegion : connection.getTargetRegions()) { - if (!regions.contains(targetRegion) && !connections.contains(connection)) { - connections.add(connection); - } - } - } - } - return connections; */ - } - - @Override - public @NonNull Iterable<@NonNull NodeConnection> getOutgoingPassedConnections() { // FIXME cache - // throw new UnsupportedOperationException(); - /* List<@NonNull NodeConnection> connections = new ArrayList<@NonNull NodeConnection>(); - for (@NonNull Node headNode : headNodes) { - for (@NonNull NodeConnection connection : headNode.getOutgoingPassedConnections()) { - connections.add(connection); - } - } - return connections; */ - Set<@NonNull NodeConnection> connections = new HashSet<@NonNull NodeConnection>(); - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region region : regions) { - // System.out.println("Region: " + region); - for (@NonNull NodeConnection connection : region.getOutgoingPassedConnections()) { - // System.out.println(" connection: " + connection); - for (Map.Entry<@NonNull Node, @NonNull ConnectionRole> targetEntry : connection.getTargets().entrySet()) { - if (targetEntry.getValue().isPassed()) { // && !connections.contains(connection)) { - Node targetNode = targetEntry.getKey(); - Region targetRegion = targetNode.getRegion(); - // System.out.println(" target region: " + targetRegion); - if (!regions.contains(targetRegion)) { - // System.out.println(" add: "); - connections.add(connection); - } - } - } - } - } - // for (@NonNull NodeConnection connection : connections) { - // System.out.println(" -- " + connection); - // } - return connections; - } - - @Override - public @NonNull List<@NonNull NodeConnection> getOutgoingUsedConnections() { // FIXME cache - List<@NonNull NodeConnection> connections = new ArrayList<@NonNull NodeConnection>(); - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region region : regions) { - for (@NonNull NodeConnection connection : region.getOutgoingUsedConnections()) { - for (@NonNull Region targetRegion : connection.getTargetRegions()) { - if (!regions.contains(targetRegion) && !connections.contains(connection)) { - connections.add(connection); - } - } - } - } - return connections; - } - - @Override - public @NonNull RootScheduledRegion getRootScheduledRegion() { - return parentScheduledRegion.getRootScheduledRegion(); - } - - @Override - public boolean isCyclicScheduledRegion() { - return true; - } - - /** - * Every outgoing connection whose source and target regions are internal is relocated to this region. - * - private void relocateInternalConnections() { - Set<@NonNull Region> regions = new HashSet<@NonNull Region>(getRegions()); - for (@NonNull Region innerRegion : regions) { - for (@NonNull DatumConnection connection : innerRegion.getOutgoingConnections()) { - boolean isInternal = true; - for (@NonNull Region targetRegion : connection.getTargetRegions()) { - if (!regions.contains(targetRegion)) { - isInternal = false; - break; - } - } - if (isInternal) { - for (@NonNull Region sourceRegion : connection.getSourceRegions()) { - if (!regions.contains(sourceRegion)) { - isInternal = false; - break; - } - } - } - if (isInternal && (connection.getRegion() != this)) { - if (connection instanceof EdgeConnection) { - EdgeConnection oldEdgeConnection = (EdgeConnection)connection; - EdgeConnection newEdgeConnection = getEdgeConnection(oldEdgeConnection.getSources(), oldEdgeConnection.getProperty()); - Map<@NonNull NavigationEdge, @NonNull ConnectionRole> targets = new HashMap<@NonNull NavigationEdge, @NonNull ConnectionRole>(oldEdgeConnection.getTargets()); - connection.getRegion().removeConnection(connection); - for (Map.Entry<@NonNull NavigationEdge, @NonNull ConnectionRole> entry : targets.entrySet()) { - newEdgeConnection.addUsedTargetEdge(entry.getKey(), entry.getValue().isMandatory()); - } - } - else { - NodeConnection oldNodeConnection = (NodeConnection)connection; - NodeConnection newNodeConnection = getNodeConnection(oldNodeConnection.getSources(), oldNodeConnection.getClassDatumAnalysis()); - Map<@NonNull Node, @NonNull ConnectionRole> targets = new HashMap<@NonNull Node, @NonNull ConnectionRole>(oldNodeConnection.getTargets()); - connection.getRegion().removeConnection(connection); - for (Map.Entry<@NonNull Node, @NonNull ConnectionRole> entry : targets.entrySet()) { - newNodeConnection.addUsedTargetNode(entry.getKey(), entry.getValue().isMandatory()); - } - } - } - } - } - } */ - - @Override - public void toGraph(@NonNull GraphStringBuilder s) { - s.setLabel(getName()); - s.pushCluster(); - for (@NonNull Region region : getRegions()) { - region.toGraph(s); - } - for (@NonNull Node node : getNodes()) { - s.appendNode(node); - } - for (@NonNull Edge edge : getEdges()) { - s.appendEdge(edge.getSource(), edge, edge.getTarget()); - } - for (@NonNull Connection connection : getConnections()) { - connection.toGraph(s); - } - s.popCluster(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/OperationRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/OperationRegion.java index 432423165..689a8c652 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/OperationRegion.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/OperationRegion.java @@ -17,7 +17,6 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.ocl.pivot.CallExp; -import org.eclipse.ocl.pivot.Class; import org.eclipse.ocl.pivot.CollectionType; import org.eclipse.ocl.pivot.CompleteClass; import org.eclipse.ocl.pivot.DataType; @@ -32,6 +31,7 @@ import org.eclipse.ocl.pivot.Variable; import org.eclipse.ocl.pivot.VariableDeclaration; import org.eclipse.ocl.pivot.VoidType; import org.eclipse.ocl.pivot.utilities.ClassUtil; +import org.eclipse.ocl.pivot.utilities.PivotUtil; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.analysis.ClassDatumAnalysis; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.analysis.OperationDependencyAnalysis; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.analysis.OperationDependencyPaths; @@ -145,9 +145,9 @@ public class OperationRegion extends AbstractRegion if (primaryClass instanceof CollectionType) { Property iterateProperty = schedulerConstants.getIterateProperty(primaryClass); - Type elementType = ((CollectionType)primaryClass).getElementType(); + Type elementType = PivotUtil.getElementType((CollectionType)primaryClass); TypedModel typedModel2 = classDatumAnalysis.getTypedModel(); - ClassDatumAnalysis elementClassDatumAnalysis = schedulerConstants.getClassDatumAnalysis((@NonNull Class) elementType, typedModel2); + ClassDatumAnalysis elementClassDatumAnalysis = schedulerConstants.getClassDatumAnalysis((org.eclipse.ocl.pivot.Class) elementType, typedModel2); Node elementNode = RegionUtil.createOperationElementNode(this, name, elementClassDatumAnalysis, dependencyNode2); //(region, name, typedElement, argNodes)Node(region, name, callExp, sourceNode)Node(this, name, iterateProperty, dependencyNode2); RegionUtil.createNavigationEdge(dependencyNode2, iterateProperty, elementNode, false); diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Region.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Region.java index 65aeafb19..ada337dae 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Region.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Region.java @@ -147,7 +147,6 @@ public interface Region extends Visitable, GraphNode, Nameable, Symbolable */ @NonNull List<@NonNull NodeConnection> getUsedConnections(); boolean isChildCompositionRegion(); - boolean isCyclicScheduledRegion(); boolean isOperationRegion(); boolean isRootCompositionRegion(); void refineBindings(@NonNull Region bindingRegion); diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ScheduledRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ScheduledRegion.java index 8c5674c55..5f14fab12 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ScheduledRegion.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/ScheduledRegion.java @@ -25,7 +25,6 @@ public interface ScheduledRegion extends Region void addEdgeConnection(@NonNull EdgeConnection edgeConnection); void addNodeConnection(@NonNull NodeConnection nodeConnection); void addRegion(@NonNull Region region); - @NonNull CyclicScheduledRegion createCyclicScheduledRegion(@NonNull Iterable<@NonNull Region> cycle); void createLocalSchedule(); void createLocalSchedule2(@NonNull List<@NonNull Region> orderedRegions); @NonNull NodeConnection getAttributeConnection(@NonNull Iterable<@NonNull Node> sourceNodes, @NonNull CompleteClass owningClass, @NonNull Property property, @NonNull ClassDatumAnalysis classDatumAnalysis); diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Visitor.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Visitor.java index a8d8ff0f0..db40ec9c3 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Visitor.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Visitor.java @@ -19,7 +19,6 @@ public interface Visitor<R> R visitBasicEdgeConnection(@NonNull BasicEdgeConnection basicEdgeConnection); R visitBasicNodeConnection(@NonNull BasicNodeConnection basicNodeConnection); - R visitCyclicScheduledRegion(@NonNull CyclicScheduledRegion cyclicScheduledRegion); R visitEdge(@NonNull Edge edge); R visitMappingRegion(@NonNull MappingRegion mappingRegion); R visitNavigableEdge(@NonNull NavigableEdge navigableEdge); diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java deleted file mode 100644 index d3bc128c7..000000000 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java +++ /dev/null @@ -1,363 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Willink Transformations and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * E.D.Willink - Initial API and implementation - *******************************************************************************/ -package org.eclipse.qvtd.compiler.internal.qvts2qvti; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.ocl.pivot.CollectionType; -import org.eclipse.ocl.pivot.OCLExpression; -import org.eclipse.ocl.pivot.Operation; -import org.eclipse.ocl.pivot.OperationCallExp; -import org.eclipse.ocl.pivot.Type; -import org.eclipse.ocl.pivot.VariableDeclaration; -import org.eclipse.ocl.pivot.VariableExp; -import org.eclipse.ocl.pivot.ids.IdManager; -import org.eclipse.ocl.pivot.ids.OperationId; -import org.eclipse.ocl.pivot.ids.ParametersId; -import org.eclipse.ocl.pivot.ids.TypeId; -import org.eclipse.ocl.pivot.utilities.PivotUtil; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.CyclicScheduledRegion; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Node; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.NodeConnection; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Region; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.analysis.ClassDatumAnalysis; -import org.eclipse.qvtd.pivot.qvtimperative.AddStatement; -import org.eclipse.qvtd.pivot.qvtimperative.AppendParameter; -import org.eclipse.qvtd.pivot.qvtimperative.BufferStatement; -import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable; -import org.eclipse.qvtd.pivot.qvtimperative.MappingCall; -import org.eclipse.qvtd.pivot.qvtimperative.MappingParameterBinding; -import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement; -import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory; - -import com.google.common.collect.Iterables; - -public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mapping -{ - /** - * RecursionContext coordinates the variables associated with one (of many) recursive connections in a CyclicRegion. - */ - private class RecursionContext - { - /** - * The recursing type. - */ - private final @NonNull ClassDatumAnalysis classDatumAnalysis; - - /** - * A distinctive number for distinctive auto-generated per-recursion names. - */ - private final int index; - - /** - * The accumulated output connection for the recursed type. - */ - private NodeConnection accumulatedConnection; - - /** - * The guard variable for the recursed type. - */ - private final @NonNull AppendParameter guardVariable; - - /** - * The local accumulation variable for the recursed type. Already processed values may be present. - */ - private final @NonNull BufferStatement localVariable; - - /** - * The filtered local accumulation variable for the recursed type. Already processed values have been removed. - */ - private @Nullable BufferStatement newVariable; - - /** - * The accumulated output variable for the recursed type. - */ - private AppendParameter accumulatedVariable; - - public RecursionContext(@NonNull Node headNode) { - this.classDatumAnalysis = headNode.getClassDatumAnalysis(); - this.index = classDatumAnalysis2recursion.size(); - // - // Create the domain guard variable. - // - org.eclipse.ocl.pivot.Class elementType = classDatumAnalysis.getCompleteClass().getPrimaryClass(); - guardVariable = helper.createAppendParameter(getSafeName(headNode), elementType, false); - mapping.getOwnedMappingParameters().add(guardVariable); - - Iterable<@NonNull NodeConnection> outgoingConnections = headNode.getOutgoingPassedConnections(); - assert Iterables.size(outgoingConnections) == 1; - NodeConnection outgoingConnection = Iterables.get(outgoingConnections, 0); - // Class elementType = classDatumAnalysis.getCompleteClass().getPrimaryClass(); - // Variable variable = PivotUtil.createVariable(getSafeName(headNode), elementType, false, null); - // guardPattern.getVariable().add(variable); - // Variable oldVariable = classDatumAnalysis2headVariable.put(classDatumAnalysis, variable); - // assert oldVariable == null; - NodeConnection incomingConnection = headNode.getIncomingPassedConnection(); - assert incomingConnection != null; - connection2variable.put(incomingConnection, guardVariable); - // - // Create the local accumulation variable. - // - // Iterable<@NonNull NodeConnection> internallyPassedConnections = headNode.getOutgoingPassedConnections(); - // assert Iterables.size(internallyPassedConnections) == 1; - // ClassDatumAnalysis incomingClassDatumAnalysis = incomingConnection.getClassDatumAnalysis(); - // NodeConnection internallyPassedConnection = Iterables.get(internallyPassedConnections, 0); - // ClassDatumAnalysis outgoingClassDatumAnalysis = internallyPassedConnection.getClassDatumAnalysis(); - // if ((outgoingClassDatumAnalysis == incomingClassDatumAnalysis) - // && !incoming2outgoing.values().contains(internallyPassedConnection)) { // Multiple should not occur, but line them up pair-wise - // incoming2outgoing.put(incomingConnection, internallyPassedConnection); - Type asType = getConnectionSourcesType(incomingConnection); - String localName = getSafeName("«local" + (index > 0 ? Integer.toString(index) : "") + "»"); - localVariable = helper.createBufferStatement(localName, true, asType, true, null); - mapping.getOwnedStatements().add(localVariable); - connection2variable.put(outgoingConnection, localVariable); - // - if ((asType instanceof CollectionType) && ((CollectionType)asType).isUnique()) { - String newName = getSafeName("«new" + (index > 0 ? Integer.toString(index) : "") + "»"); - BufferStatement newVariable2 = newVariable = helper.createBufferStatement(newName, true, asType, true, null); - mapping.getOwnedStatements().add(newVariable2); - connection2variable.put(outgoingConnection, newVariable2); - } - else { - allRecursionsAreUnique = false; - } - } - - @SuppressWarnings("unused") - public @Nullable NodeConnection getAccumulatedConnection() { - return accumulatedConnection; - } - - public @Nullable ConnectionVariable getAccumulatedVariable() { - return accumulatedVariable; - } - - public @NonNull ClassDatumAnalysis getClassDatumAnalysis() { - return classDatumAnalysis; - } - - public @NonNull ConnectionVariable getGuardVariable() { - return guardVariable; - } - - public @NonNull ConnectionVariable getLocalVariable() { - return localVariable; - } - - public @Nullable ConnectionVariable getNewVariable() { - return newVariable; - } - - public void setAccumulatedConnection(@NonNull NodeConnection accumulatedConnection) { - this.accumulatedConnection = accumulatedConnection; - // - // Select a/the outgoing recursive intermediate connection. - // - NodeConnection intermediateConnection = accumulatedConnection; - AppendParameter accumulatedVariable2 = accumulatedVariable = createAppendParameter(intermediateConnection); - mapping.getOwnedMappingParameters().add(accumulatedVariable2); - connection2variable.put(intermediateConnection, accumulatedVariable2); - } - } - - /** - * The recursions. - */ - private final @NonNull Map<@NonNull ClassDatumAnalysis, @NonNull RecursionContext> classDatumAnalysis2recursion = new HashMap<>(); - - /** - * True if all recursions use Set accumulators allowing the unqiueness to be determined by excliusion rather than - * by re-invocation suppression. - */ - private boolean allRecursionsAreUnique = false; - - /** - * Cache of the domains created for each recursiing typed model - */ - // private final @NonNull Map<@NonNull TypedModel, @NonNull ImperativeDomain> typedModel2domain = new HashMap<>(); - - public CyclicScheduledRegion2Mapping(@NonNull QVTs2QVTiVisitor visitor, @NonNull CyclicScheduledRegion region) { - super(visitor, region); - // - // Create a guard for each head and place it in a corresponding domain. - // Create a local accumulation variable for each head and place it the the middle bottom domain. - // Create an outgoing accumulation variable for each head and place it the the middle guard domain. - // - for (@NonNull Node headNode : region.getHeadNodes()) { - // - // Create/locate the domain and guard pattern for the guard. - // - RecursionContext newRecursion = new RecursionContext(headNode); - RecursionContext oldRecursion = classDatumAnalysis2recursion.put(newRecursion.getClassDatumAnalysis(), newRecursion); - assert oldRecursion == null; - } - for (@NonNull NodeConnection accumulatedConnection : region.getIntermediateConnections()) { - ClassDatumAnalysis classDatumAnalysis = accumulatedConnection.getClassDatumAnalysis(); - RecursionContext recursion = classDatumAnalysis2recursion.get(classDatumAnalysis); - if (recursion != null) { - recursion.setAccumulatedConnection(accumulatedConnection); - } - } - // - // Create any non-recursion connectionVariable guards - // - createAppendParameters(); - } - - /** - * Create the guard variables for the intermediate connections that are not recursions. - */ - @Override - protected void createAppendParameters() { - List<@NonNull NodeConnection> intermediateConnections = region.getIntermediateConnections(); - for (@NonNull NodeConnection intermediateConnection : intermediateConnections) { - AppendParameter connectionVariable = (AppendParameter) connection2variable.get(intermediateConnection); - if (connectionVariable == null) { - String name = intermediateConnection.getName(); - assert name != null; - connectionVariable = helper.createAppendParameter(getSafeName(name), getConnectionSourcesType(intermediateConnection), true); - connection2variable.put(intermediateConnection, connectionVariable); - mapping.getOwnedMappingParameters().add(connectionVariable); - } - } - } - - @Override - public @NonNull MappingCall createMappingCall(@NonNull List<@NonNull MappingParameterBinding> mappingParameterBindings) { - MappingCall mappingCall = super.createMappingCall(mappingParameterBindings); - if (!allRecursionsAreUnique) { - mappingCall.getReferredMapping().setIsStrict(true); // FIXME share code - } - return mappingCall; - } - - @Override - protected @NonNull OCLExpression createSelectByKind(@NonNull Node resultNode) { - throw new UnsupportedOperationException(); - /* Variable resultVariable = classDatumAnalysis2headVariable.get(resultNode.getClassDatumAnalysis()); - if (resultVariable == null) { - OCLExpression asSource = createNullLiteralExp(); //PivotUtil.createVariableExp(getChildrenVariable()); - CompleteClass sourceCompleteClass = resultNode.getCompleteClass(); - CollectionType sourceCollectionType = (CollectionType) sourceCompleteClass.getPrimaryClass(); - Type sourceElementType = sourceCollectionType.getElementType(); - assert sourceElementType != null; - CompleteClass sourceElementClass = visitor.getEnvironmentFactory().getCompleteModel().getCompleteClass(sourceElementType); - OCLExpression asTypeExp = createTypeExp(sourceElementClass); - OCLExpression selectExp = createOperationCallExp(asSource, getSelectByKindOperation(), asTypeExp); - resultVariable = PivotUtil.createVariable(resultNode.getName(), selectExp); - mapping.getBottomPattern().getVariable().add(resultVariable); - classDatumAnalysis2headVariable.put(resultNode.getClassDatumAnalysis(), resultVariable); - } - return PivotUtil.createVariableExp(resultVariable); */ - } - - @Override - public void createStatements() { - List<@NonNull MappingStatement> mappingStatements = new ArrayList<>(); - for (@NonNull Region callableRegion : region.getCallableChildren()) { - AbstractRegion2Mapping calledRegion2Mapping = visitor.getRegion2Mapping(callableRegion); - Map<@NonNull VariableDeclaration, @NonNull OCLExpression> guardVariable2expression = new HashMap<>(); - for (@NonNull Node calledHeadNode : callableRegion.getHeadNodes()) { - NodeConnection headConnection = calledHeadNode.getIncomingConnection(); - assert headConnection != null; - Node callingHeadNode = Iterables.get(headConnection.getSourceNodes(), 0); - ConnectionVariable callingHeadVariable = getGuardVariable(callingHeadNode); - VariableDeclaration calledHeadVariable = calledRegion2Mapping.getGuardVariable(calledHeadNode); - guardVariable2expression.put(calledHeadVariable, PivotUtil.createVariableExp(callingHeadVariable)); - } - for (@NonNull NodeConnection intermediateConnection : callableRegion.getIntermediateConnections()) { - RecursionContext recursion = classDatumAnalysis2recursion.get(intermediateConnection.getClassDatumAnalysis()); - if (recursion != null) { - ConnectionVariable callingLocalVariable = recursion.getLocalVariable(); - // NodeConnection tailConnection = recursion.getAccumulatedConnection(); - // if (tailConnection != null) { - ConnectionVariable calledTailVariable = calledRegion2Mapping.getConnectionVariable(intermediateConnection); - guardVariable2expression.put(calledTailVariable, PivotUtil.createVariableExp(callingLocalVariable)); - // } - } - } - mappingStatements.add(createCall(callableRegion, guardVariable2expression)); - } - // - // Create connection assignments to pass local creations to the accumulated result. - // - for (@NonNull RecursionContext recursion : classDatumAnalysis2recursion.values()) { - ConnectionVariable accumulatedVariable = recursion.getAccumulatedVariable(); - if (accumulatedVariable != null) { - ConnectionVariable localVariable = recursion.getLocalVariable(); - ConnectionVariable newVariable = recursion.getNewVariable(); - if (newVariable != null) { - ParametersId parametersId = IdManager.getParametersId(TypeId.COLLECTION.getSpecializedId(TypeId.OCL_ANY)); - OperationId operationId = TypeId.COLLECTION.getOperationId(1, "excludingAll", parametersId); - Operation operation = visitor.getEnvironmentFactory().getIdResolver().getOperation(operationId); - VariableExp localVariableExp = PivotUtil.createVariableExp(localVariable); - VariableExp resultVariableExp = PivotUtil.createVariableExp(accumulatedVariable); - OperationCallExp excludingAllCallExp = helper.createOperationCallExp(localVariableExp, operation, Collections.singletonList(resultVariableExp)); - excludingAllCallExp.setType(localVariableExp.getType()); - excludingAllCallExp.setIsRequired(localVariableExp.isIsRequired()); - - - AddStatement addStatement1 = QVTimperativeFactory.eINSTANCE.createAddStatement(); - addStatement1.setTargetVariable(newVariable); - addStatement1.setOwnedExpression(excludingAllCallExp); - mappingStatements.add(addStatement1); - } - else { - newVariable = localVariable; - } - // - AddStatement addStatement2 = QVTimperativeFactory.eINSTANCE.createAddStatement(); - addStatement2.setTargetVariable(accumulatedVariable); - addStatement2.setOwnedExpression(PivotUtil.createVariableExp(newVariable)); - mappingStatements.add(addStatement2); - } - } - // - // Create the recursive call recursing all the recursive connections. - // - Map<@NonNull VariableDeclaration, @NonNull OCLExpression> guardVariable2expression = new HashMap<>(); - for (@NonNull RecursionContext recursion : classDatumAnalysis2recursion.values()) { - ConnectionVariable guardVariable = recursion.getGuardVariable(); - ConnectionVariable newVariable = recursion.getNewVariable(); - if (newVariable == null) { - newVariable = recursion.getLocalVariable(); - } - VariableExp localVariableExp = PivotUtil.createVariableExp(newVariable); - guardVariable2expression.put(guardVariable, localVariableExp); - } - mappingStatements.add(createCall(region, guardVariable2expression)); - mapping.getOwnedStatements().addAll(mappingStatements); - } - - @Override - public @NonNull List<@NonNull Node> getGuardNodes() { - return getHeadNodes(); - } - - @Override - public @NonNull AppendParameter getGuardVariable(@NonNull Node node) { - assert getHeadNodes().contains(node); - ClassDatumAnalysis classDatumAnalysis = node.getClassDatumAnalysis(); - RecursionContext recursion = classDatumAnalysis2recursion.get(classDatumAnalysis); - assert recursion != null; - return (AppendParameter) recursion.getGuardVariable(); - } - - private @NonNull List<@NonNull Node> getHeadNodes() { - return region.getHeadNodes(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/QVTs2QVTiVisitor.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/QVTs2QVTiVisitor.java index e73eb516b..faed38947 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/QVTs2QVTiVisitor.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/QVTs2QVTiVisitor.java @@ -39,7 +39,6 @@ import org.eclipse.qvtd.compiler.ProblemHandler; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.AbstractRegion; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.BasicEdgeConnection; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.BasicNodeConnection; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.CyclicScheduledRegion; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Edge; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.MappingRegion; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.NavigableEdge; @@ -188,10 +187,7 @@ public class QVTs2QVTiVisitor extends QVTimperativeHelper implements Visitor<Ele AbstractRegion2Mapping region2mapping = region2region2mapping.get(region); assert region2mapping == null : "Re-AbstractRegion2Mapping for " + region; // assert !region.isConnectionRegion(); - if (region.isCyclicScheduledRegion()) { - region2mapping = new CyclicScheduledRegion2Mapping(this, (CyclicScheduledRegion)region); - } - else if (region.isRootCompositionRegion()) { + if (region.isRootCompositionRegion()) { region2mapping = new RootRegion2Mapping(this, (RootCompositionRegion)region); } else { @@ -364,35 +360,6 @@ public class QVTs2QVTiVisitor extends QVTimperativeHelper implements Visitor<Ele } @Override - public @Nullable Element visitCyclicScheduledRegion(@NonNull CyclicScheduledRegion cyclicScheduledRegion) { - List<@NonNull Region> callableRegions = new ArrayList<@NonNull Region>(); - for (@NonNull Region region : cyclicScheduledRegion.getRegions()) { - if (region.isOperationRegion()) {} - // else if (region.isConnectionRegion()) { - // callableRegions.add(region); - // } - else { - callableRegions.add(region); - } - } - - List<@NonNull Region> sortedRegions = AbstractRegion.EarliestRegionComparator.sort(callableRegions); - for (@NonNull Region region : sortedRegions) { - // if (!region.isConnectionRegion()) { - createRegion2Mapping(region); - // } - } - for (@NonNull Region region : sortedRegions) { - // if (!region.isConnectionRegion()) { - AbstractRegion2Mapping region2Mapping = getRegion2Mapping(region); - region2Mapping.createStatements(); - // } - } - AbstractRegion2Mapping region2mapping = getRegion2Mapping(cyclicScheduledRegion); - return region2mapping.getMapping(); - } - - @Override public Element visitEdge(@NonNull Edge edge) { return visiting(edge); } diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/CyclesAnalyzer.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/CyclesAnalyzer.java index 179f5c9b3..31368d8fd 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/CyclesAnalyzer.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/CyclesAnalyzer.java @@ -10,33 +10,16 @@ *******************************************************************************/ package org.eclipse.qvtd.compiler.internal.qvts2qvts; -import java.util.ArrayList; -import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Set; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.jdt.annotation.Nullable; import org.eclipse.ocl.pivot.utilities.ClassUtil; -import org.eclipse.ocl.pivot.utilities.NameUtil; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.ConnectionRole; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.CyclicScheduledRegion; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Node; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.NodeConnection; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Region; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.ScheduledRegion; -import org.eclipse.qvtd.compiler.internal.qvtp2qvts.QVTp2QVTs; import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Symbolable; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import com.google.common.collect.Sets.SetView; - /** * CyclesAnalyzer provides the depth analysis of all regions using all connections to locate cycles. */ @@ -62,28 +45,28 @@ public class CyclesAnalyzer /** * The regions that source incoming connections to this region for which no depth has yet been determined. */ - private final @NonNull Set<@NonNull RegionStatus> depthlessSourceRegions = new HashSet<@NonNull RegionStatus>(); + // private final @NonNull Set<@NonNull RegionStatus> depthlessSourceRegions = new HashSet<@NonNull RegionStatus>(); /** * The largest depth of the sources whose depth is known. null if none known. */ - private @Nullable Integer partialSourceDepth = null; + // private @Nullable Integer partialSourceDepth = null; /** * The depth of this region. Set non-null once known. */ - private @Nullable Integer depth = null; + // private @Nullable Integer depth = null; - private @NonNull Set<@NonNull Region> debugSourceRegions = new HashSet<@NonNull Region>(); - private @NonNull Set<@NonNull Region> debugTargetRegions = new HashSet<@NonNull Region>(); + // private @NonNull Set<@NonNull Region> debugSourceRegions = new HashSet<@NonNull Region>(); + // private @NonNull Set<@NonNull Region> debugTargetRegions = new HashSet<@NonNull Region>(); public RegionStatus(@NonNull Region region) { this.region = region; - debugSourceRegions.addAll(getPreviousRegions(region)); - debugTargetRegions.addAll(getNextRegions(region)); + // debugSourceRegions.addAll(getPreviousRegions(region)); + // debugTargetRegions.addAll(getNextRegions(region)); } - private void check(@NonNull List<@NonNull RegionStatus> unblockedRegionStatuses, int orderedThreshold) { + /* private void check(@NonNull List<@NonNull RegionStatus> unblockedRegionStatuses, int orderedThreshold) { if (region instanceof CyclicScheduledRegion) { computeDepth(); } @@ -134,9 +117,9 @@ public class CyclesAnalyzer for (@NonNull RegionStatus sourceRegion : depthlessSourceRegions) { assert debugSourceRegions.contains(sourceRegion.region); } - } + } */ - private @Nullable Integer computeDepth() { + /* private @Nullable Integer computeDepth() { Set<@NonNull Region> sourceRegions = new HashSet<@NonNull Region>(); sourceRegions.addAll(getPreviousRegions(region)); Integer checkDepth = null; @@ -150,32 +133,32 @@ public class CyclesAnalyzer } } return checkDepth; - } + } */ - private @Nullable Integer getDepth() { - return depth; - } + // private @Nullable Integer getDepth() { + // return depth; + // } - @NonNull Region getRegion() { - return region; - } + // @NonNull Region getRegion() { + // return region; + // } - public @Nullable RegionCycle getDepthlessSourceClosure() { + /* public @Nullable RegionCycle getDepthlessSourceClosure() { if (depthlessSourceRegions.isEmpty()) { return null; } Set<@NonNull Region> depthlessClosure = new HashSet<@NonNull Region>(); getDepthlessSourceClosure(depthlessClosure); return new RegionCycle(depthlessClosure); - } + } */ - private void getDepthlessSourceClosure(@NonNull Set<@NonNull Region> depthlessClosure) { + /* private void getDepthlessSourceClosure(@NonNull Set<@NonNull Region> depthlessClosure) { for (@NonNull RegionStatus sourceRegionStatus : depthlessSourceRegions) { if (depthlessClosure.add(sourceRegionStatus.getRegion())) { sourceRegionStatus.getDepthlessSourceClosure(depthlessClosure); } } - } + } */ /** * Return true if this is a root region and set its depth to zero. @@ -194,7 +177,7 @@ public class CyclesAnalyzer /** * Analyze all the incoming connections to build the set of source regions whose depth is unknown. * Returns true if this is a root region and consequently has a known depth. - */ + * public boolean initializeSources() { for (@NonNull Region sourceRegion : getPreviousRegions(region)) { RegionStatus sourceRegionStatus = region2status.get(sourceRegion); @@ -231,11 +214,11 @@ public class CyclesAnalyzer // setDepth(partialSourceDepth+1); // } return true; - } + } */ /** * Propagate the region depth to its descendants. - */ + * public void propagate(@NonNull List<@NonNull RegionStatus> unblockedRegionStatuses) { assert depthlessSourceRegions.isEmpty(); Integer checkDepth = computeDepth(); @@ -274,9 +257,9 @@ public class CyclesAnalyzer unblockedRegionStatuses.add(this); } } - } + } */ - public void replaceCycle(@NonNull Set<@NonNull RegionStatus> oldRegionStatuses, @NonNull RegionStatus cyclicRegionStatus) { + /* public void replaceCycle(@NonNull Set<@NonNull RegionStatus> oldRegionStatuses, @NonNull RegionStatus cyclicRegionStatus) { boolean debugGotSource = false; boolean debugGotTarget = false; for (RegionStatus oldRegionStatus : oldRegionStatuses) { @@ -315,7 +298,7 @@ public class CyclesAnalyzer QVTp2QVTs.REGION_CYCLES.println(" <= " + depthlessSourceRegions.size() + " " + cyclicRegionStatus); } - } + } */ @Override public String toString() { @@ -333,9 +316,9 @@ public class CyclesAnalyzer /** * The result. */ - private final @NonNull List<@NonNull RegionCycle> orderedCycles = new ArrayList<>(); + // private final @NonNull List<@NonNull RegionCycle> orderedCycles = new ArrayList<>(); - private final @NonNull Set<@NonNull RegionStatus> blockedRegions; + // private final @NonNull Set<@NonNull RegionStatus> blockedRegions; public CyclesAnalyzer(@NonNull ScheduledRegion scheduledRegion, @NonNull Iterable<@NonNull Region> regions) { this.scheduledRegion = scheduledRegion; @@ -346,7 +329,7 @@ public class CyclesAnalyzer assert !region.isOperationRegion(); region2status.put(region, new RegionStatus(region)); } - blockedRegions = new HashSet<@NonNull RegionStatus>(region2status.values()); + /* blockedRegions = new HashSet<@NonNull RegionStatus>(region2status.values()); // // Initialize the RegionStatuses. // @@ -447,10 +430,10 @@ public class CyclesAnalyzer // cyclicRegionStatus.propagate(unblockedRegionStatuses); // } } - } + } */ } - private void checkAll(@NonNull List<@NonNull RegionStatus> unblockedRegionStatuses, int orderedThreshold) { + /* private void checkAll(@NonNull List<@NonNull RegionStatus> unblockedRegionStatuses, int orderedThreshold) { // assert Sets.intersection(blockedRegions, Sets.newHashSet(unblockedRegionStatuses.subList(0, i))).isEmpty(); // assert Sets.intersection(blockedRegions, Sets.newHashSet(unblockedRegionStatuses.subList(i, unblockedRegionStatuses.size()))).size() == blockedRegions.size(); // assert i + blockedRegions.size() == Sets.newHashSet(region2status.values()).size(); @@ -467,9 +450,9 @@ public class CyclesAnalyzer for (@NonNull RegionStatus regionStatus : allRegionStatuses1) { regionStatus.check(unblockedRegionStatuses, orderedThreshold); } - } + } */ - private @NonNull Set<@NonNull Region> getNextRegions(@NonNull Region region) { + /* private @NonNull Set<@NonNull Region> getNextRegions(@NonNull Region region) { Set<@NonNull Region> nextRegions = new HashSet<@NonNull Region>(); for (@NonNull NodeConnection outgoingConnection : region.getOutgoingPassedConnections()) { for (Map.Entry<@NonNull Node, @NonNull ConnectionRole> targetEntry : outgoingConnection.getTargets().entrySet()) { @@ -479,16 +462,16 @@ public class CyclesAnalyzer } } return nextRegions; - } + } */ /** * Return the cycles ordered smallest first, or null if non cycles. - */ + * public @Nullable List<@NonNull RegionCycle> getOrderedCycles() { return orderedCycles; } - private @NonNull Set<@NonNull Region> getPreviousRegions(@NonNull Region region) { +/* private @NonNull Set<@NonNull Region> getPreviousRegions(@NonNull Region region) { Set<@NonNull Region> previousRegions = new HashSet<@NonNull Region>(); for (@NonNull NodeConnection incomingConnection : region.getIncomingPassedConnections()) { for (@NonNull Region sourceRegion : incomingConnection.getSourceRegions()) { @@ -499,9 +482,9 @@ public class CyclesAnalyzer } } return previousRegions; - } + } */ - private void putAll(@NonNull Map<@NonNull Region, @NonNull List<@NonNull NodeConnection>> region2connections, + /* private void putAll(@NonNull Map<@NonNull Region, @NonNull List<@NonNull NodeConnection>> region2connections, @NonNull Set<@NonNull Region> regions, @NonNull NodeConnection connection) { for (@NonNull Region region : regions) { List<@NonNull NodeConnection> connections = region2connections.get(region); @@ -511,9 +494,9 @@ public class CyclesAnalyzer } connections.add(connection); } - } + } */ - private @Nullable RegionCycle removeCycle() { + /* private @Nullable RegionCycle removeCycle() { // // Locate the cycles. // @@ -545,9 +528,9 @@ public class CyclesAnalyzer RegionCycle smallestCycle = cyclesList.get(0); assert smallestCycle != null; return smallestCycle; - } + } */ - private void showAll(@NonNull String prefix, @NonNull Set<@NonNull Region> regions) { + /* private void showAll(@NonNull String prefix, @NonNull Set<@NonNull Region> regions) { List<@NonNull Region> sortedRegions = Lists.newArrayList(regions); Collections.sort(sortedRegions, SymbolableComparator.INSTANCE); StringBuilder s = new StringBuilder(); @@ -559,9 +542,9 @@ public class CyclesAnalyzer first = false; } QVTp2QVTs.REGION_CYCLES.println(s.toString()); - } + } */ - private void showAll(@NonNull String prefix, @NonNull Map<@NonNull Region, @NonNull List<@NonNull NodeConnection>> region2connections) { + /* private void showAll(@NonNull String prefix, @NonNull Map<@NonNull Region, @NonNull List<@NonNull NodeConnection>> region2connections) { List<@NonNull Region> sortedRegions = Lists.newArrayList(region2connections.keySet()); Collections.sort(sortedRegions, SymbolableComparator.INSTANCE); for (@NonNull Region region : sortedRegions) { @@ -579,9 +562,9 @@ public class CyclesAnalyzer } QVTp2QVTs.REGION_CYCLES.println(s.toString()); } - } + } */ - private void showNew(@NonNull CyclicScheduledRegion cyclicRegion) { + /* private void showNew(@NonNull CyclicScheduledRegion cyclicRegion) { Set<@NonNull NodeConnection> externalConnections = new HashSet<@NonNull NodeConnection>(); QVTp2QVTs.REGION_CYCLES.println("New Region: " + cyclicRegion); @NonNull @@ -602,9 +585,9 @@ public class CyclesAnalyzer for (@NonNull NodeConnection externalConnection : sortedExternalConnections) { QVTp2QVTs.REGION_CYCLES.println("New Connection: " + externalConnection); } - } + } */ - private void showOld(@NonNull Iterable<@NonNull Region> oldRegions) { + /* private void showOld(@NonNull Iterable<@NonNull Region> oldRegions) { Set<@NonNull Region> debugOldRegions = Sets.newHashSet(oldRegions); List<@NonNull Region> sortedOldRegions = Lists.newArrayList(oldRegions); @@ -648,5 +631,5 @@ public class CyclesAnalyzer showAll("external source: ", allExternalSourceRegions); showAll("internal target: ", allInternalTargetRegions); showAll("external target: ", allExternalTargetRegions); - } + } */ }
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/QVTs2QVTs.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/QVTs2QVTs.java index fd42a7dc5..2382fe6bb 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/QVTs2QVTs.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/QVTs2QVTs.java @@ -63,10 +63,10 @@ public class QVTs2QVTs extends QVTimperativeHelper // List<@NonNull ScheduledRegion> allScheduledRegions = new ArrayList<>(); allScheduledRegions.add(rootScheduledRegion); - CyclesAnalyzer cyclesAnalyzer = new CyclesAnalyzer(rootScheduledRegion, rootScheduledRegion.getCallableRegions()); - List<@NonNull RegionCycle> regionCycles = cyclesAnalyzer.getOrderedCycles(); - if (regionCycles != null) { - /* for (@NonNull RegionCycle regionCycle : regionCycles) { + // CyclesAnalyzer cyclesAnalyzer = new CyclesAnalyzer(rootScheduledRegion, rootScheduledRegion.getCallableRegions()); + // List<@NonNull RegionCycle> regionCycles = cyclesAnalyzer.getOrderedCycles(); + // if (regionCycles != null) { + /* for (@NonNull RegionCycle regionCycle : regionCycles) { Iterable<@NonNull Region> regions = regionCycle.getRegions(); if (Iterables.size(regions) == 1) { regions.iterator().next().setIsCyclic(); @@ -76,10 +76,10 @@ public class QVTs2QVTs extends QVTimperativeHelper allScheduledRegions.add(cyclicRegion); } } */ - } - if (QVTp2QVTs.DEBUG_GRAPHS.isActive()) { - rootScheduledRegion.writeDebugGraphs("4-cycles", true, true, false); - } + // } + // if (QVTp2QVTs.DEBUG_GRAPHS.isActive()) { + // rootScheduledRegion.writeDebugGraphs("4-cycles", true, true, false); + // } // // Create the schedule for each directed acyclic scheduled region. // |