[panda-users] inlining of functions in panda/common.h?

Manolis Stamatogiannakis mstamat at gmail.com
Thu Oct 4 07:40:51 EDT 2018


Done. The commits are contained in the osi_linux_fixes PR.

A couple more functions could also be inlined, but they would require a bit
more substantial code juggling.

M.

On Mon, 1 Oct 2018 at 22:11, Brendan Dolan-Gavitt <brendandg at nyu.edu> wrote:

> Sound okay and minimally invasive to me! Feel free to submit a PR.
>
> On Mon, Oct 1, 2018 at 11:38 AM, Manolis Stamatogiannakis
> <mstamat at gmail.com> wrote:
> > I moved the implementation from common.c to common.h and marked them
> static
> > inline.
> >
> > This seems to be the most portable approach for inlining
> > (https://www.greenend.org.uk/rjk/tech/inline.html).
> >
> > M.
> >
> > On Mon, 1 Oct 2018, 17:26 Brendan Dolan-Gavitt, <brendandg at nyu.edu>
> wrote:
> >>
> >> What's involved in inlining them? Simply marking them as "inline" in the
> >> header?
> >>
> >> On Mon, Oct 1, 2018 at 9:39 AM, Manolis Stamatogiannakis
> >> <mstamat at gmail.com> wrote:
> >> > I had this in the back of my mind for some time, but today I gave it a
> >> > try
> >> > to see the effects.
> >> >
> >> > Many functions declared in panda/common.h are only thin wrappers
> around
> >> > other functions. E.g.:
> >> > int panda_physical_memory_rw(hwaddr addr, uint8_t *buf, int len, int
> >> > is_write);
> >> > hwaddr panda_virt_to_phys(CPUState *env, target_ulong addr);
> >> > int panda_virtual_memory_rw(CPUState *env, target_ulong addr, uint8_t
> >> > *buf,
> >> > int len, int is_write);
> >> > int panda_virtual_memory_read(CPUState *env, target_ulong addr,
> uint8_t
> >> > *buf, int len);
> >> > int panda_virtual_memory_write(CPUState *env, target_ulong addr,
> uint8_t
> >> > *buf, int len);
> >> >
> >> > Is there any reason these have not been implemented as inlines?
> >> >
> >> > After inlining them (a 5' task), my reply replay ran ~5% faster
> >> > (141.7sec ->
> >> > 133.7sec). Not a huge improvement, but given the effort required for
> the
> >> > change, one can't complain.
> >> >
> >> > Thanks,
> >> > Manolis
> >> >
> >> > _______________________________________________
> >> > panda-users mailing list
> >> > panda-users at mit.edu
> >> >
> >> >
> https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.mit.edu_mailman_listinfo_panda-2Dusers&d=DwICAg&c=slrrB7dE8n7gBJbeO0g-IQ&r=A4wu5Zmpus3hDmokNWeJTO0SLjrxguzCAxn30Hc-o48&m=HSkp0HaNEn4JxGH47OBshPtVt8yawjH9TlZ7cW5xaH4&s=Z6_aPLmeXQf7Lrg7FEBZtXPy2bSMUjaDmTTrkGjskP4&e=
> >> >
> >>
> >>
> >>
> >> --
> >> Brendan Dolan-Gavitt
> >> Assistant Professor, Department of Computer Science and Engineering
> >> NYU Tandon School of Engineering
>
>
>
> --
> Brendan Dolan-Gavitt
> Assistant Professor, Department of Computer Science and Engineering
> NYU Tandon School of Engineering
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/panda-users/attachments/20181004/152c0c9c/attachment.html


More information about the panda-users mailing list