mem: Fix (ab)use of emplace to avoid temporary object creation
authorAndreas Hansson <andreas.hansson@arm.com>
Mon, 13 Jul 2015 12:46:28 +0000 (08:46 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Mon, 13 Jul 2015 12:46:28 +0000 (08:46 -0400)
src/mem/bridge.cc
src/mem/cache/mshr.cc
src/mem/cache/prefetch/queued.cc
src/mem/packet_queue.cc
src/mem/simple_mem.cc

index 6bc8c18f2e9fc32a06e8119363a2162d7587d035..ecaf6de0483dbce5b9ad4904d25bbdd2d3b4a119 100644 (file)
@@ -217,7 +217,7 @@ Bridge::BridgeMasterPort::schedTimingReq(PacketPtr pkt, Tick when)
 
     assert(transmitList.size() != reqQueueLimit);
 
-    transmitList.emplace_back(DeferredPacket(pkt, when));
+    transmitList.emplace_back(pkt, when);
 }
 
 
@@ -232,7 +232,7 @@ Bridge::BridgeSlavePort::schedTimingResp(PacketPtr pkt, Tick when)
         bridge.schedule(sendEvent, when);
     }
 
-    transmitList.emplace_back(DeferredPacket(pkt, when));
+    transmitList.emplace_back(pkt, when);
 }
 
 void
index 78900ed4e6fe4e4376c3b8a84606ff547d717510..5b7eb0c06474198aa3fe1b8a46781a3d67cc0df7 100644 (file)
@@ -104,7 +104,7 @@ MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
         }
     }
 
-    emplace_back(Target(pkt, readyTime, order, source, markPending));
+    emplace_back(pkt, readyTime, order, source, markPending);
 }
 
 
index 97ea4eee6f2d7d63a809353b08cdb8c1f3eda0ff..58b33a4ae148d795c7a70ed187853527c4200da6 100644 (file)
@@ -149,7 +149,7 @@ QueuedPrefetcher::notify(const PacketPtr &pkt)
             DPRINTF(HWPrefetch, "Prefetch queued. "
                     "addr:%#x tick:%lld.\n", pf_addr, pf_time);
 
-            pfq.emplace_back(DeferredPacket(pf_time, pf_pkt));
+            pfq.emplace_back(pf_time, pf_pkt);
         }
     }
 
index ff248d388852c981df89aa17915d4b9810d405a4..e7ad1cc472b4b6f1e552e37bf21421870690076f 100644 (file)
@@ -142,7 +142,7 @@ PacketQueue::schedSendTiming(PacketPtr pkt, Tick when, bool force_order)
         // note that currently we ignore a potentially outstanding retry
         // and could in theory put a new packet at the head of the
         // transmit list before retrying the existing packet
-        transmitList.emplace_front(DeferredPacket(when, pkt));
+        transmitList.emplace_front(when, pkt);
         schedSendEvent(when);
         return;
     }
@@ -157,7 +157,7 @@ PacketQueue::schedSendTiming(PacketPtr pkt, Tick when, bool force_order)
 
     // list is non-empty and this belongs at the end
     if (when >= transmitList.back().tick) {
-        transmitList.emplace_back(DeferredPacket(when, pkt));
+        transmitList.emplace_back(when, pkt);
         return;
     }
 
@@ -169,7 +169,7 @@ PacketQueue::schedSendTiming(PacketPtr pkt, Tick when, bool force_order)
     ++i; // already checked for insertion at front
     while (i != transmitList.end() && when >= i->tick)
         ++i;
-    transmitList.emplace(i, DeferredPacket(when, pkt));
+    transmitList.emplace(i, when, pkt);
 }
 
 void
index 8938b2a55c6488bb072647aa9177986c4c766790..f68066e75a2d0fb0ab7d5f1916b5f96482b6b8d4 100644 (file)
@@ -161,7 +161,7 @@ SimpleMemory::recvTimingReq(PacketPtr pkt)
         // to keep things simple (and in order), we put the packet at
         // the end even if the latency suggests it should be sent
         // before the packet(s) before it
-        packetQueue.emplace_back(DeferredPacket(pkt, curTick() + getLatency()));
+        packetQueue.emplace_back(pkt, curTick() + getLatency());
         if (!retryResp && !dequeueEvent.scheduled())
             schedule(dequeueEvent, packetQueue.back().tick);
     } else {