More conversions of ref-counted parameters to references:

Statistics::NodePtr, StaticInstPtr, ethernet PacketPtr.

base/statistics.hh:
    Change NodePtr parameters to Nodeptr &.
cpu/exetrace.hh:
    Change StaticInstPtr parameters to StaticInstPtr &.
dev/etherbus.cc:
dev/etherbus.hh:
dev/etherdump.cc:
dev/etherdump.hh:
dev/etherint.hh:
dev/etherlink.cc:
dev/etherlink.hh:
dev/ethertap.cc:
dev/ethertap.hh:
    change PacketPtr parameters to PacketPtr &.

--HG--
extra : convert_revision : a778efdca33b0ec5beb76cf47db0e9e4728897ee
This commit is contained in:
Steve Reinhardt 2004-02-02 15:45:22 -08:00
parent 7b07b0877f
commit 956aff1291
11 changed files with 19 additions and 18 deletions

View file

@ -2067,7 +2067,7 @@ class UnaryNode : public Node
mutable rvec_t result; mutable rvec_t result;
public: public:
UnaryNode(NodePtr p) : l(p) {} UnaryNode(NodePtr &p) : l(p) {}
const rvec_t &val() const { const rvec_t &val() const {
const rvec_t &lvec = l->val(); const rvec_t &lvec = l->val();
@ -2110,7 +2110,7 @@ class BinaryNode : public Node
mutable rvec_t result; mutable rvec_t result;
public: public:
BinaryNode(NodePtr a, NodePtr b) : l(a), r(b) {} BinaryNode(NodePtr &a, NodePtr &b) : l(a), r(b) {}
const rvec_t &val() const { const rvec_t &val() const {
Op op; Op op;
@ -2179,7 +2179,7 @@ class SumNode : public Node
mutable rvec_t result; mutable rvec_t result;
public: public:
SumNode(NodePtr p) : l(p), result(1) {} SumNode(NodePtr &p) : l(p), result(1) {}
const rvec_t &val() const { const rvec_t &val() const {
const rvec_t &lvec = l->val(); const rvec_t &lvec = l->val();
@ -2999,7 +2999,7 @@ class Temp
* Return the node pointer. * Return the node pointer.
* @return the node pointer. * @return the node pointer.
*/ */
operator NodePtr() { return node;} operator NodePtr&() { return node;}
public: public:
/** /**

View file

@ -91,8 +91,9 @@ class InstRecord : public Record
bool regs_valid; bool regs_valid;
public: public:
InstRecord(Tick _cycle, BaseCPU *_cpu, StaticInstPtr<TheISA> _staticInst, InstRecord(Tick _cycle, BaseCPU *_cpu,
Addr _pc, bool spec, unsigned _thread) const StaticInstPtr<TheISA> &_staticInst,
Addr _pc, bool spec, int _thread)
: Record(_cycle), cpu(_cpu), staticInst(_staticInst), PC(_pc), : Record(_cycle), cpu(_cpu), staticInst(_staticInst), PC(_pc),
misspeculating(spec), thread(_thread) misspeculating(spec), thread(_thread)
{ {

View file

@ -81,7 +81,7 @@ EtherBus::reg(EtherInt *dev)
{ devlist.push_back(dev); } { devlist.push_back(dev); }
bool bool
EtherBus::send(EtherInt *sndr, PacketPtr pkt) EtherBus::send(EtherInt *sndr, PacketPtr &pkt)
{ {
if (busy()) { if (busy()) {
DPRINTF(Ethernet, "ethernet packet not sent, bus busy\n", curTick); DPRINTF(Ethernet, "ethernet packet not sent, bus busy\n", curTick);

View file

@ -73,7 +73,7 @@ class EtherBus : public SimObject
void txDone(); void txDone();
void reg(EtherInt *dev); void reg(EtherInt *dev);
bool busy() const { return (bool)packet; } bool busy() const { return (bool)packet; }
bool send(EtherInt *sender, PacketPtr packet); bool send(EtherInt *sender, PacketPtr &packet);
}; };
#endif // __ETHERBUS_H__ #endif // __ETHERBUS_H__

View file

@ -106,7 +106,7 @@ EtherDump::init()
} }
void void
EtherDump::dumpPacket(PacketPtr packet) EtherDump::dumpPacket(PacketPtr &packet)
{ {
pcap_pkthdr pkthdr; pcap_pkthdr pkthdr;
pkthdr.ts.tv_sec = curtime + (curTick / s_freq); pkthdr.ts.tv_sec = curtime + (curTick / s_freq);

View file

@ -44,7 +44,7 @@ class EtherDump : public SimObject
{ {
private: private:
std::ofstream stream; std::ofstream stream;
void dumpPacket(PacketPtr packet); void dumpPacket(PacketPtr &packet);
void init(); void init();
Tick curtime; Tick curtime;
@ -54,7 +54,7 @@ class EtherDump : public SimObject
public: public:
EtherDump(const std::string &name, const std::string &file); EtherDump(const std::string &name, const std::string &file);
inline void dump(PacketPtr pkt) { if (stream.is_open()) dumpPacket(pkt); } inline void dump(PacketPtr &pkt) { if (stream.is_open()) dumpPacket(pkt); }
}; };
#endif // __ETHERDUMP_H__ #endif // __ETHERDUMP_H__

View file

@ -54,9 +54,9 @@ class EtherInt : public SimObject
virtual ~EtherInt() {} virtual ~EtherInt() {}
void setPeer(EtherInt *p); void setPeer(EtherInt *p);
virtual bool recvPacket(PacketPtr packet) = 0; virtual bool recvPacket(PacketPtr &packet) = 0;
void recvDone() { peer->sendDone(); } void recvDone() { peer->sendDone(); }
bool sendPacket(PacketPtr packet) bool sendPacket(PacketPtr &packet)
{ {
return peer ? peer->recvPacket(packet) : true; return peer ? peer->recvPacket(packet) : true;
} }

View file

@ -102,7 +102,7 @@ EtherLink::Link::txDone()
} }
bool bool
EtherLink::Link::transmit(PacketPtr pkt) EtherLink::Link::transmit(PacketPtr &pkt)
{ {
if (busy()) { if (busy()) {
DPRINTF(Ethernet, "EtherLink packet not sent, link busy\n"); DPRINTF(Ethernet, "EtherLink packet not sent, link busy\n");

View file

@ -92,7 +92,7 @@ class EtherLink : public SimObject
virtual std::string name() const { return objName; } virtual std::string name() const { return objName; }
bool busy() const { return (bool)packet; } bool busy() const { return (bool)packet; }
bool transmit(PacketPtr packet); bool transmit(PacketPtr &packet);
void setTxInt(Interface *i) { assert(!txint); txint = i; } void setTxInt(Interface *i) { assert(!txint); txint = i; }
void setRxInt(Interface *i) { assert(!rxint); rxint = i; } void setRxInt(Interface *i) { assert(!rxint); rxint = i; }
@ -108,7 +108,7 @@ class EtherLink : public SimObject
public: public:
Interface(const std::string &name, Link *txlink, Link *rxlink); Interface(const std::string &name, Link *txlink, Link *rxlink);
bool recvPacket(PacketPtr packet) { return txlink->transmit(packet); } bool recvPacket(PacketPtr &packet) { return txlink->transmit(packet); }
void sendDone() { } void sendDone() { }
}; };

View file

@ -169,7 +169,7 @@ EtherTap::detach()
} }
bool bool
EtherTap::recvPacket(PacketPtr packet) EtherTap::recvPacket(PacketPtr &packet)
{ {
if (dump) if (dump)
dump->dump(packet); dump->dump(packet);

View file

@ -94,7 +94,7 @@ class EtherTap : public EtherInt
EtherTap(const std::string &name, EtherDump *dump, int port, int bufsz); EtherTap(const std::string &name, EtherDump *dump, int port, int bufsz);
virtual ~EtherTap(); virtual ~EtherTap();
virtual bool recvPacket(PacketPtr packet); virtual bool recvPacket(PacketPtr &packet);
virtual void sendDone(); virtual void sendDone();
virtual void serialize(std::ostream &os); virtual void serialize(std::ostream &os);