inorder: replace schedEvent() code with reschedule().
authorSteve Reinhardt <steve.reinhardt@amd.com>
Sat, 8 Jan 2011 05:50:29 +0000 (21:50 -0800)
committerSteve Reinhardt <steve.reinhardt@amd.com>
Sat, 8 Jan 2011 05:50:29 +0000 (21:50 -0800)
There were several copies of similar functions that looked
like they all replicated reschedule(), so I replaced them
with direct calls.  Keeping this separate from the previous
cset since there may be some subtle functional differences
if the code ever reschedules an event that is scheduled but
not squashed (though none were detected in the regressions).

src/cpu/inorder/cpu.cc
src/cpu/inorder/cpu.hh
src/cpu/inorder/resource.cc
src/cpu/inorder/resource_pool.cc

index bb324ce642ac35d9c2454b88e40174a08edb6736..5b5f524f2fc677a4389182b0d203e3d60634a0a3 100644 (file)
@@ -157,12 +157,8 @@ InOrderCPU::CPUEvent::description()
 void
 InOrderCPU::CPUEvent::scheduleEvent(int delay)
 {
-    Tick when = cpu->nextCycle(curTick + cpu->ticks(delay));
-
-    if (squashed())
-        cpu->reschedule(this, when);
-    else if (!scheduled())
-        cpu->schedule(this, when);
+    assert(!scheduled() || squashed());
+    cpu->reschedule(this, cpu->nextCycle(curTick + cpu->ticks(delay)), true);
 }
 
 void
index 42bae0d31a7d9abadab76eafbd08e115447c46f9..38978dbd7040e3bc775d44955543814e7efd3943 100644 (file)
@@ -156,12 +156,8 @@ class InOrderCPU : public BaseCPU
     /** Schedule tick event, regardless of its current state. */
     void scheduleTickEvent(int delay)
     {
-        Tick when = nextCycle(curTick + ticks(delay));
-
-        if (tickEvent.squashed())
-            reschedule(&tickEvent, when);
-        else if (!tickEvent.scheduled())
-            schedule(&tickEvent, when);
+        assert(!tickEvent.scheduled() || tickEvent.squashed());
+        reschedule(&tickEvent, nextCycle(curTick + ticks(delay)), true);
     }
 
     /** Unschedule tick event, regardless of its current state. */
index 4eab89687484217bc2df3d6c00605632fb18a4c4..0d8dbb3e4184263a17098654fcf291c9494a58f6 100644 (file)
@@ -502,11 +502,7 @@ ResourceEvent::description()
 void
 ResourceEvent::scheduleEvent(int delay)
 {
-    InOrderCPU *cpu = resource->cpu;
-    Tick when = curTick + resource->ticks(delay);
-
-    if (squashed())
-        cpu->reschedule(this, when);
-    else if (!scheduled())
-        cpu->schedule(this, when);
+    assert(!scheduled() || squashed());
+    resource->cpu->reschedule(this,
+                              curTick + resource->ticks(delay), true);
 }
index 97ea889fde28357c426b4c8ee2431d794c9a29ca..e199d2bc2a589ebe15e8a1cbed12cc97a598815d 100644 (file)
@@ -541,13 +541,8 @@ void
 ResourcePool::ResPoolEvent::scheduleEvent(int delay)
 {
     InOrderCPU *cpu = resPool->cpu;
-    Tick when = cpu->nextCycle(curTick + cpu->ticks(delay));
-
-    if (squashed()) {
-        cpu->reschedule(this, when);
-    } else if (!scheduled()) {
-        cpu->schedule(this, when);
-    }
+    assert(!scheduled() || squashed());
+    cpu->reschedule(this, cpu->nextCycle(curTick + cpu->ticks(delay)), true);
 }
 
 /** Unschedule resource event, regardless of its current state. */