Re: [gem5-dev] Review Request 2492: mem: Use const pointers for port proxy write functions
On Nov. 29, 2014, 8:29 p.m., Steve Reinhardt wrote: src/mem/packet.hh, line 822 http://reviews.gem5.org/r/2492/diff/1/?file=42516#file42516line822 Would it make sense to have an internal 'const' flag that we assert is cleared when calling the non-const getPtr() accessors? That could even be enabled optionally only for debug builds if desired. I have a follow up patch that is a bit more kosher regarding the const handling. The challenge is that a lot of the devices have a single function that read/write packets with a boolean parameter for is_read. Thus, they all need non-const pointers and thus taint the packet. Until that is split or reorganised I do not think there is much point. Good idea though :-) - Andreas --- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2492/#review5570 --- On Nov. 17, 2014, 6:14 a.m., Andreas Hansson wrote: --- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2492/ --- (Updated Nov. 17, 2014, 6:14 a.m.) Review request for Default. Repository: gem5 Description --- Changeset 10542:6cbdd036f4b9 --- mem: Use const pointers for port proxy write functions This patch changes the various write functions in the port proxies to use const pointers for all sources (similar to how memcpy works). The one unfortunate aspect is the need for a const_cast in the packet, to avoid having to juggle a const and a non-const data pointer. This design decision can always be re-evaluated at a later stage. Diffs - src/mem/fs_translating_port_proxy.hh 1a9e235cab09 src/mem/fs_translating_port_proxy.cc 1a9e235cab09 src/mem/packet.hh 1a9e235cab09 src/mem/port_proxy.hh 1a9e235cab09 src/mem/port_proxy.cc 1a9e235cab09 src/mem/se_translating_port_proxy.hh 1a9e235cab09 src/mem/se_translating_port_proxy.cc 1a9e235cab09 Diff: http://reviews.gem5.org/r/2492/diff/ Testing --- Thanks, Andreas Hansson ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
Re: [gem5-dev] Review Request 2492: mem: Use const pointers for port proxy write functions
--- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2492/#review5570 --- Ship it! src/mem/packet.hh http://reviews.gem5.org/r/2492/#comment4993 Would it make sense to have an internal 'const' flag that we assert is cleared when calling the non-const getPtr() accessors? That could even be enabled optionally only for debug builds if desired. - Steve Reinhardt On Nov. 16, 2014, 10:14 p.m., Andreas Hansson wrote: --- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2492/ --- (Updated Nov. 16, 2014, 10:14 p.m.) Review request for Default. Repository: gem5 Description --- Changeset 10542:6cbdd036f4b9 --- mem: Use const pointers for port proxy write functions This patch changes the various write functions in the port proxies to use const pointers for all sources (similar to how memcpy works). The one unfortunate aspect is the need for a const_cast in the packet, to avoid having to juggle a const and a non-const data pointer. This design decision can always be re-evaluated at a later stage. Diffs - src/mem/fs_translating_port_proxy.hh 1a9e235cab09 src/mem/fs_translating_port_proxy.cc 1a9e235cab09 src/mem/packet.hh 1a9e235cab09 src/mem/port_proxy.hh 1a9e235cab09 src/mem/port_proxy.cc 1a9e235cab09 src/mem/se_translating_port_proxy.hh 1a9e235cab09 src/mem/se_translating_port_proxy.cc 1a9e235cab09 Diff: http://reviews.gem5.org/r/2492/diff/ Testing --- Thanks, Andreas Hansson ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
Re: [gem5-dev] Review Request 2492: mem: Use const pointers for port proxy write functions
On Nov. 18, 2014, 3:36 p.m., Nilay Vaish wrote: src/mem/port_proxy.cc, line 80 http://reviews.gem5.org/r/2492/diff/1/?file=42518#file42518line80 Do we need this scope resolution? We do. It took me the better part of a day to track it down even... - Andreas --- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2492/#review5468 --- On Nov. 17, 2014, 6:14 a.m., Andreas Hansson wrote: --- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2492/ --- (Updated Nov. 17, 2014, 6:14 a.m.) Review request for Default. Repository: gem5 Description --- Changeset 10542:6cbdd036f4b9 --- mem: Use const pointers for port proxy write functions This patch changes the various write functions in the port proxies to use const pointers for all sources (similar to how memcpy works). The one unfortunate aspect is the need for a const_cast in the packet, to avoid having to juggle a const and a non-const data pointer. This design decision can always be re-evaluated at a later stage. Diffs - src/mem/fs_translating_port_proxy.hh 1a9e235cab09 src/mem/fs_translating_port_proxy.cc 1a9e235cab09 src/mem/packet.hh 1a9e235cab09 src/mem/port_proxy.hh 1a9e235cab09 src/mem/port_proxy.cc 1a9e235cab09 src/mem/se_translating_port_proxy.hh 1a9e235cab09 src/mem/se_translating_port_proxy.cc 1a9e235cab09 Diff: http://reviews.gem5.org/r/2492/diff/ Testing --- Thanks, Andreas Hansson ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
Re: [gem5-dev] Review Request 2492: mem: Use const pointers for port proxy write functions
--- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2492/#review5475 --- Ship it! Ship It! - Nilay Vaish On Nov. 17, 2014, 6:14 a.m., Andreas Hansson wrote: --- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2492/ --- (Updated Nov. 17, 2014, 6:14 a.m.) Review request for Default. Repository: gem5 Description --- Changeset 10542:6cbdd036f4b9 --- mem: Use const pointers for port proxy write functions This patch changes the various write functions in the port proxies to use const pointers for all sources (similar to how memcpy works). The one unfortunate aspect is the need for a const_cast in the packet, to avoid having to juggle a const and a non-const data pointer. This design decision can always be re-evaluated at a later stage. Diffs - src/mem/fs_translating_port_proxy.hh 1a9e235cab09 src/mem/fs_translating_port_proxy.cc 1a9e235cab09 src/mem/packet.hh 1a9e235cab09 src/mem/port_proxy.hh 1a9e235cab09 src/mem/port_proxy.cc 1a9e235cab09 src/mem/se_translating_port_proxy.hh 1a9e235cab09 src/mem/se_translating_port_proxy.cc 1a9e235cab09 Diff: http://reviews.gem5.org/r/2492/diff/ Testing --- Thanks, Andreas Hansson ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev