cleanup obsolete stuff
authoradam <adam@megacz.com>
Tue, 12 Feb 2008 09:15:00 +0000 (10:15 +0100)
committeradam <adam@megacz.com>
Tue, 12 Feb 2008 09:15:00 +0000 (10:15 +0100)
src/edu/berkeley/fleet/api/Instruction.java
src/edu/berkeley/fleet/interpreter/InstructionPump.java
src/edu/berkeley/fleet/interpreter/Interpreter.java

index af9e9ce..81af0df 100644 (file)
@@ -8,7 +8,6 @@ public abstract class Instruction {
 
     public boolean isLooping() { return true; }
     public boolean isRepeating() { return false; }
-    public boolean isStanding() { return false; }
     public boolean isSK() { return false; }
     public boolean isDL() { return false; }
 
index 941662c..7058ae4 100644 (file)
@@ -20,9 +20,6 @@ abstract class InstructionPump extends InterpreterPump {
     /** all instructions waiting to be executed (excludes executing) */
     private Queue<Instruction> instructions = new LinkedList<Instruction>();
 
-    /** count of how many "standing instruction only" kills remain to be executed */
-    private int killNextStandingInstruction = 0;
-
     public int loopCounter = 0;
     private int repeatCounter = 1;
 
@@ -38,27 +35,16 @@ abstract class InstructionPump extends InterpreterPump {
             instructions.remove();
     }
 
-    public void kill(int count, boolean killOnlyStandingInstructions) {
-        if (count==0) return;
+    public void kill() {
         repeatCounter = 1;
-        if (!killOnlyStandingInstructions) {
-            if (executing != null) { executing = null; count--; }
-            for(;count > 0;count--) {
-                if (instructions.size()==0)
-                    throw new RuntimeException("deadlocked " + this + " by killing too many instructions");
-                instructions.remove();
-            }
-        } else {
-            if (count != 1) throw new RuntimeException("this should never happen");
-            this.killNextStandingInstruction++;
-        }
+        if (executing != null) { executing = null; return; }
+        if (instructions.size()==0)
+            throw new RuntimeException("deadlocked " + this + " by killing too many instructions");
+        instructions.remove();
     }
 
     /** an instruction arrives from the instruction horn */
-    void addInstruction(Instruction instr) {
-        if (killNextStandingInstruction > 0) { /* FIXME technically we should refuse to take the next instruction here */ }
-        instructions.add(instr);
-    }
+    void addInstruction(Instruction instr) { instructions.add(instr); }
 
     protected void shutdown(boolean leaveAsInbox) {
         if (!(executing != null || instructions.size() > 0)) return;
@@ -159,7 +145,6 @@ abstract class InstructionPump extends InterpreterPump {
         } else if (executing.isLooping() && oldLoopCounter > 0) {
             addInstruction(executing);
             executing = null;
-        } else if (executing.isStanding()) {
         } else {
             executing = null;
         }
index b82ac4d..cc5650b 100644 (file)
@@ -95,7 +95,7 @@ public class Interpreter extends Fleet implements Fleet.WithDynamicShips {
 
         } else if (i instanceof Instruction.Kill) {
             InterpreterPump pump = (InterpreterPump)(((Instruction.Kill)i).pump);
-            ((InstructionPump)pump).kill(((Instruction.Kill)i).count+1, false);
+            ((InstructionPump)pump).kill();
 
         } else if (i instanceof Instruction.Massacre) {
             InterpreterPump pump = (InterpreterPump)(((Instruction.Massacre)i).pump);