On Tue, 6 Dec 2011 11:14:25 -0800, nathan binkert <[email protected]> wrote:
Assuming we only ever dynamically allocate a functional request, we could derive FuctionalPacket from Packet and let it have the valid bits there. There are probably some other such similar optimizations we could do when
Andreas' changes go in as well.

If this is only for functional requests, then I think that this is a
fabulous option. One thing to be careful of though is that the Packet
class has no virtual functions and thus no virtual destructor.  The
lack of virtual destructor means that "delete pkt" where pkt is a
Packet * pointing to a FunctionalPacket will not call the correct
destructor which could cause memory leaks if we have a dynamically
allocated object inside (which the bit_vector/vector<bool> would
have).  The solution here would be to create a virtual destructor on
Packet (which would increase the overhead on destruction), or to
ensure that you cast to a FunctionalPacket before destroying the
packet.
This is probably OK. Functional packets are only destroyed by the requestor, not anyone else in the system, and at the point you've created a functional pointer, you should have a pointer to it of the correct type.

Ali



_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to