From 956aff1291990639f8a59a95c6b22e0c17bb8cd8 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Mon, 2 Feb 2004 15:45:22 -0800 Subject: [PATCH] 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 --- base/statistics.hh | 8 ++++---- cpu/exetrace.hh | 5 +++-- dev/etherbus.cc | 2 +- dev/etherbus.hh | 2 +- dev/etherdump.cc | 2 +- dev/etherdump.hh | 4 ++-- dev/etherint.hh | 4 ++-- dev/etherlink.cc | 2 +- dev/etherlink.hh | 4 ++-- dev/ethertap.cc | 2 +- dev/ethertap.hh | 2 +- 11 files changed, 19 insertions(+), 18 deletions(-) diff --git a/base/statistics.hh b/base/statistics.hh index ce20043a3..cbc976053 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -2067,7 +2067,7 @@ class UnaryNode : public Node mutable rvec_t result; public: - UnaryNode(NodePtr p) : l(p) {} + UnaryNode(NodePtr &p) : l(p) {} const rvec_t &val() const { const rvec_t &lvec = l->val(); @@ -2110,7 +2110,7 @@ class BinaryNode : public Node mutable rvec_t result; public: - BinaryNode(NodePtr a, NodePtr b) : l(a), r(b) {} + BinaryNode(NodePtr &a, NodePtr &b) : l(a), r(b) {} const rvec_t &val() const { Op op; @@ -2179,7 +2179,7 @@ class SumNode : public Node mutable rvec_t result; public: - SumNode(NodePtr p) : l(p), result(1) {} + SumNode(NodePtr &p) : l(p), result(1) {} const rvec_t &val() const { const rvec_t &lvec = l->val(); @@ -2999,7 +2999,7 @@ class Temp * Return the node pointer. * @return the node pointer. */ - operator NodePtr() { return node;} + operator NodePtr&() { return node;} public: /** diff --git a/cpu/exetrace.hh b/cpu/exetrace.hh index d05dbe0cd..622ecd729 100644 --- a/cpu/exetrace.hh +++ b/cpu/exetrace.hh @@ -91,8 +91,9 @@ class InstRecord : public Record bool regs_valid; public: - InstRecord(Tick _cycle, BaseCPU *_cpu, StaticInstPtr _staticInst, - Addr _pc, bool spec, unsigned _thread) + InstRecord(Tick _cycle, BaseCPU *_cpu, + const StaticInstPtr &_staticInst, + Addr _pc, bool spec, int _thread) : Record(_cycle), cpu(_cpu), staticInst(_staticInst), PC(_pc), misspeculating(spec), thread(_thread) { diff --git a/dev/etherbus.cc b/dev/etherbus.cc index 3f6036f72..76697dd3e 100644 --- a/dev/etherbus.cc +++ b/dev/etherbus.cc @@ -81,7 +81,7 @@ EtherBus::reg(EtherInt *dev) { devlist.push_back(dev); } bool -EtherBus::send(EtherInt *sndr, PacketPtr pkt) +EtherBus::send(EtherInt *sndr, PacketPtr &pkt) { if (busy()) { DPRINTF(Ethernet, "ethernet packet not sent, bus busy\n", curTick); diff --git a/dev/etherbus.hh b/dev/etherbus.hh index f7f633303..9ef477808 100644 --- a/dev/etherbus.hh +++ b/dev/etherbus.hh @@ -73,7 +73,7 @@ class EtherBus : public SimObject void txDone(); void reg(EtherInt *dev); bool busy() const { return (bool)packet; } - bool send(EtherInt *sender, PacketPtr packet); + bool send(EtherInt *sender, PacketPtr &packet); }; #endif // __ETHERBUS_H__ diff --git a/dev/etherdump.cc b/dev/etherdump.cc index 89f1ce382..6d86adc32 100644 --- a/dev/etherdump.cc +++ b/dev/etherdump.cc @@ -106,7 +106,7 @@ EtherDump::init() } void -EtherDump::dumpPacket(PacketPtr packet) +EtherDump::dumpPacket(PacketPtr &packet) { pcap_pkthdr pkthdr; pkthdr.ts.tv_sec = curtime + (curTick / s_freq); diff --git a/dev/etherdump.hh b/dev/etherdump.hh index b3aefeb74..e22b66166 100644 --- a/dev/etherdump.hh +++ b/dev/etherdump.hh @@ -44,7 +44,7 @@ class EtherDump : public SimObject { private: std::ofstream stream; - void dumpPacket(PacketPtr packet); + void dumpPacket(PacketPtr &packet); void init(); Tick curtime; @@ -54,7 +54,7 @@ class EtherDump : public SimObject public: 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__ diff --git a/dev/etherint.hh b/dev/etherint.hh index dfc9f6fd6..70e29eb7c 100644 --- a/dev/etherint.hh +++ b/dev/etherint.hh @@ -54,9 +54,9 @@ class EtherInt : public SimObject virtual ~EtherInt() {} void setPeer(EtherInt *p); - virtual bool recvPacket(PacketPtr packet) = 0; + virtual bool recvPacket(PacketPtr &packet) = 0; void recvDone() { peer->sendDone(); } - bool sendPacket(PacketPtr packet) + bool sendPacket(PacketPtr &packet) { return peer ? peer->recvPacket(packet) : true; } diff --git a/dev/etherlink.cc b/dev/etherlink.cc index c042cac34..676b1da1c 100644 --- a/dev/etherlink.cc +++ b/dev/etherlink.cc @@ -102,7 +102,7 @@ EtherLink::Link::txDone() } bool -EtherLink::Link::transmit(PacketPtr pkt) +EtherLink::Link::transmit(PacketPtr &pkt) { if (busy()) { DPRINTF(Ethernet, "EtherLink packet not sent, link busy\n"); diff --git a/dev/etherlink.hh b/dev/etherlink.hh index ef587faf7..895bac2e1 100644 --- a/dev/etherlink.hh +++ b/dev/etherlink.hh @@ -92,7 +92,7 @@ class EtherLink : public SimObject virtual std::string name() const { return objName; } bool busy() const { return (bool)packet; } - bool transmit(PacketPtr packet); + bool transmit(PacketPtr &packet); void setTxInt(Interface *i) { assert(!txint); txint = i; } void setRxInt(Interface *i) { assert(!rxint); rxint = i; } @@ -108,7 +108,7 @@ class EtherLink : public SimObject public: 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() { } }; diff --git a/dev/ethertap.cc b/dev/ethertap.cc index 339e7ac78..960d21d73 100644 --- a/dev/ethertap.cc +++ b/dev/ethertap.cc @@ -169,7 +169,7 @@ EtherTap::detach() } bool -EtherTap::recvPacket(PacketPtr packet) +EtherTap::recvPacket(PacketPtr &packet) { if (dump) dump->dump(packet); diff --git a/dev/ethertap.hh b/dev/ethertap.hh index e2b1f640f..0b853a11d 100644 --- a/dev/ethertap.hh +++ b/dev/ethertap.hh @@ -94,7 +94,7 @@ class EtherTap : public EtherInt EtherTap(const std::string &name, EtherDump *dump, int port, int bufsz); virtual ~EtherTap(); - virtual bool recvPacket(PacketPtr packet); + virtual bool recvPacket(PacketPtr &packet); virtual void sendDone(); virtual void serialize(std::ostream &os);