Skip to content

Commit

Permalink
Apply spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
lsk567 committed Jun 16, 2023
1 parent 252912e commit e275892
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.lflang.analyses.evm;

abstract public class Instruction {
public abstract class Instruction {

/** VM Instruction Set */
public enum Opcode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class InstructionDU extends Instruction {
public InstructionDU(TimeValue releaseTime) {
this.opcode = Opcode.DU;
this.releaseTime = releaseTime;
}
}

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.List;
import java.util.Map;
import java.util.Queue;

import org.lflang.TargetConfig;
import org.lflang.analyses.dag.Dag;
import org.lflang.analyses.dag.DagEdge;
Expand Down Expand Up @@ -76,11 +75,10 @@ public void generate() {
System.out.println("Current: " + current);

// Get the upstream nodes.
List<DagNode> upstreamReactionNodes = dag.dagEdgesRev
.getOrDefault(current, new HashMap<>())
.keySet().stream()
.filter(n -> n.nodeType == dagNodeType.REACTION)
.toList();
List<DagNode> upstreamReactionNodes =
dag.dagEdgesRev.getOrDefault(current, new HashMap<>()).keySet().stream()
.filter(n -> n.nodeType == dagNodeType.REACTION)
.toList();
System.out.println("Upstream: " + upstreamReactionNodes);

/* Generate instructions for the current node */
Expand All @@ -101,25 +99,21 @@ public void generate() {
for (DagNode n : upstreamReactionNodes) {
int upstreamOwner = n.getWorker();
if (upstreamOwner != current.getWorker()) {
instructions.get(current.getWorker()).add(
new InstructionWU(
upstreamOwner,
n.nodeReaction
));
instructions
.get(current.getWorker())
.add(new InstructionWU(upstreamOwner, n.nodeReaction));
}
}

instructions.get(current.getWorker()).add(new InstructionEIT(reaction));
instructions.get(current.getWorker()).add(new InstructionINC2());
}
}
else if (current.nodeType == dagNodeType.SYNC) {
} else if (current.nodeType == dagNodeType.SYNC) {
if (current != dag.head && current != dag.tail) {
for (DagNode n : upstreamReactionNodes) {
instructions.get(n.getWorker()).add(new InstructionDU(current.timeStep));
}
}
else if (current == dag.tail) {
} else if (current == dag.tail) {
for (var schedule : instructions) {
schedule.add(new InstructionSAC());
schedule.add(new InstructionDU(current.timeStep));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public InstructionWU(int worker, ReactionInstance reaction) {
this.opcode = Opcode.WU;
this.worker = worker;
this.reaction = reaction;
}
}

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ public StaticScheduler createStaticScheduler(Dag dag) {

/** Generate VM instructions for each DAG partition. */
public void generateInstructionsFromPartitions(Dag dagParitioned) {
InstructionGenerator instGen =
new InstructionGenerator(dagParitioned, this.targetConfig);
InstructionGenerator instGen = new InstructionGenerator(dagParitioned, this.targetConfig);
instGen.generate();
instGen.display();

Expand Down

0 comments on commit e275892

Please sign in to comment.