Bus: Only call end() on an stl object once in a loop

--HG--
extra : convert_revision : 238dcd6da7577b533e52ada2107591c4e9168ebd
This commit is contained in:
Ali Saidi 2007-08-10 16:14:01 -04:00
parent 3d40cba8d4
commit 5c38668ed6
2 changed files with 15 additions and 20 deletions

View file

@ -40,11 +40,13 @@
#define M5_ATTR_NORETURN __attribute__((noreturn))
#define M5_PRAGMA_NORETURN(x)
#define M5_DUMMY_RETURN
#define M5_VAR_USED __attribute__((unused))
#elif defined(__SUNPRO_CC)
// this doesn't do anything with sun cc, but why not
#define M5_ATTR_NORETURN __sun_attr__((__noreturn__))
#define M5_DUMMY_RETURN return (0);
#define DO_PRAGMA(x) _Pragma(#x)
#define M5_VAR_USED
#define M5_PRAGMA_NORETURN(x) DO_PRAGMA(does_not_return(x))
#else
#error "Need to define compiler options in base/compiler.hh"

View file

@ -211,19 +211,13 @@ Bus::recvTiming(PacketPtr pkt)
dest_port_id = findPort(pkt->getAddr());
dest_port = (dest_port_id == defaultId) ?
defaultPort : interfaces[dest_port_id];
for (SnoopIter s_iter = snoopPorts.begin();
s_iter != snoopPorts.end();
s_iter++) {
SnoopIter s_end = snoopPorts.end();
for (SnoopIter s_iter = snoopPorts.begin(); s_iter != s_end; s_iter++) {
BusPort *p = *s_iter;
if (p != dest_port && p != src_port) {
#ifndef NDEBUG
// cache is not allowed to refuse snoop
bool success = p->sendTiming(pkt);
bool success M5_VAR_USED = p->sendTiming(pkt);
assert(success);
#else
// avoid unused variable warning
p->sendTiming(pkt);
#endif
}
}
} else {
@ -320,9 +314,9 @@ Bus::findPort(Addr addr)
// Check if this matches the default range
if (dest_id == -1) {
for (AddrRangeIter iter = defaultRange.begin();
iter != defaultRange.end(); iter++) {
if (*iter == addr) {
AddrRangeIter a_end = defaultRange.end();
for (AddrRangeIter i = defaultRange.begin(); i != a_end; i++) {
if (*i == addr) {
DPRINTF(Bus, " found addr %#llx on default\n", addr);
return defaultId;
}
@ -437,9 +431,8 @@ Bus::recvFunctional(PacketPtr pkt)
assert(pkt->isRequest()); // hasn't already been satisfied
for (SnoopIter s_iter = snoopPorts.begin();
s_iter != snoopPorts.end();
s_iter++) {
SnoopIter s_end = snoopPorts.end();
for (SnoopIter s_iter = snoopPorts.begin(); s_iter != s_end; s_iter++) {
BusPort *p = *s_iter;
if (p != port && p->getId() != src_id) {
p->sendFunctional(pkt);
@ -589,14 +582,14 @@ Bus::findBlockSize(int id)
int max_bs = -1;
for (PortIter portIter = portMap.begin();
portIter != portMap.end(); portIter++) {
int tmp_bs = interfaces[portIter->second]->peerBlockSize();
PortIter p_end = portMap.end();
for (PortIter p_iter = portMap.begin(); p_iter != p_end; p_iter++) {
int tmp_bs = interfaces[p_iter->second]->peerBlockSize();
if (tmp_bs > max_bs)
max_bs = tmp_bs;
}
for (SnoopIter s_iter = snoopPorts.begin();
s_iter != snoopPorts.end(); s_iter++) {
SnoopIter s_end = snoopPorts.end();
for (SnoopIter s_iter = snoopPorts.begin(); s_iter != s_end; s_iter++) {
int tmp_bs = (*s_iter)->peerBlockSize();
if (tmp_bs > max_bs)
max_bs = tmp_bs;