This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: RFA: Optimization to write_register_bytes()
- To: Fernando Nasser <fnasser at cygnus dot com>
- Subject: Re: RFA: Optimization to write_register_bytes()
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Sat, 10 Jun 2000 11:11:53 +1000
- CC: gdb-patches at sourceware dot cygnus dot com
- Organization: Cygnus Solutions
- References: <39117943.9609EB0C@cygnus.com> <391198C4.ABC15EEE@cygnus.com> <3911C84D.FC1E138E@cygnus.com> <391210A0.C9DA7860@cygnus.com> <39122F53.6278AF70@cygnus.com> <391243C4.F4B8286A@cygnus.com> <39128035.82819D7B@cygnus.com> <39407599.9D14F301@cygnus.
Fernando Nasser wrote:
>
> This patch includes the changes requested by Andrew Cagney.
>
> Here is the new version, with ChangeLog for approval.
>
> Thanks.
> Fernando
>
> 2000-06-09 Fernando Nasser <fnasser@totem.to.cygnus.com>
>
> * findvar.c (write_register_bytes): Cut loop short after the
> register that contains the last bytes in the range is written.
> This makes things a little faster and also prevents that we try to
> write to alias registers. Also, we do not write if contents have
> not changed.
>
> *************** write_register_bytes (myregstart, myaddr
> *** 848,854 ****
>
> /* Is this register completely within the range the user is writing? */
> else if (myregstart <= regstart && regend <= myregend)
> ! write_register_gen (regno, myaddr + (regstart - myregstart));
>
> /* The register partially overlaps the range being written. */
> else
> --- 856,866 ----
>
> /* Is this register completely within the range the user is writing? */
> else if (myregstart <= regstart && regend <= myregend)
> ! {
> ! write_register_gen (regno, myaddr + (regstart - myregstart));
> ! if (regend >= myregend)
> ! break;
> ! }
FYI, I've seen nothing that demonstrates that this change is safe :-(
Unless someone examines every register layout for every target we've
forced to assume otherwize :-(
I'm not even 100% sure of the change I suggested - keep track of which
bytes have been written so that when the number remaining gets to zero
exit. There could easily be a target that has two physical registers
mapped onto a single region - it may expect separate writes for each.
> /* The register partially overlaps the range being written. */
> else
> *************** write_register_bytes (myregstart, myaddr
> *** 863,873 ****
> --- 875,895 ----
> Update it from the target before scribbling on it. */
> read_register_gen (regno, regbuf);
>
> + /* If new value == old value, then don't bother doing the
> + actual store. */
> + if (memcmp (registers + overlapstart,
> + myaddr + (overlapstart - myregstart),
> + overlapend - overlapstart) == 0)
> + continue;
> +
Here, why clone write_register_gen() why not just call it? We're trying
to reduce the number of places where people blat that register buffer
not increase them.
Sorry,
Andrew