[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v2 2/5] cputlb: Replace switches in load/store_helper with call
From: |
Richard Henderson |
Subject: |
Re: [RFC v2 2/5] cputlb: Replace switches in load/store_helper with callback |
Date: |
Thu, 19 Sep 2019 08:10:21 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/19/19 7:53 AM, David Hildenbrand wrote:
> On 18.09.19 20:02, Richard Henderson wrote:
>> Add a function parameter to perform the actual load/store to ram.
>> With optimization, this results in identical code.
>>
>> Signed-off-by: Richard Henderson <address@hidden>
>> ---
>> accel/tcg/cputlb.c | 159 +++++++++++++++++++++++----------------------
>> 1 file changed, 83 insertions(+), 76 deletions(-)
>
> I would have guessed the compiler propagates the constant and eliminates
> the switch completely for the variants. After all, we now have more LOC ...
>
> I would have moved the actual read/write to a separate function
> containing the switch statement instead.
I tried that.
The compiler does fold away the constant and eliminate the switch for the code
as-is. But it somehow fails to do so for op ^ MO_BSWAP, where op is constant.
I don't know why.
These little inline functions were the third try and the only one for which all
of the indirection folded away. Not so much here, but in the next patch which
passes in the reverse-endian function as well.
>> +/* Wrap the unaligned load helpers to that they have a common signature. */
>> +static inline uint64_t wrap_ldub(const void *haddr)
>> +{
>> + return ldub_p(haddr);
>
> I wonder if you should just add proper type cast to all of the <
> uint64_t accessors (e.g., here (uint8_t) ). Shouldn't hurt and makes
> people wonder less how the conversion from the int these accessors
> return to uint64_t will turn out.
>
> But yeah, you're simply moving code here.
Perhaps. I'm not really a fan of redundant casts.
r~
- [Qemu-devel] [RFC v2 0/5] Move notdirty handling to cputlb, Richard Henderson, 2019/09/18
- [Qemu-devel] [RFC v2 1/5] cputlb: Disable __always_inline__ without optimization, Richard Henderson, 2019/09/18
- [Qemu-devel] [RFC v2 2/5] cputlb: Replace switches in load/store_helper with callback, Richard Henderson, 2019/09/18
- [Qemu-devel] [RFC v2 4/5] exec: Adjust notdirty tracing, Richard Henderson, 2019/09/18
- [Qemu-devel] [RFC v2 5/5] cputlb: Move NOTDIRTY handling from I/O path to TLB path, Richard Henderson, 2019/09/18
- [Qemu-devel] [RFC v2 3/5] cputlb: Introduce TLB_BSWAP, Richard Henderson, 2019/09/18
- Re: [Qemu-devel] [RFC v2 0/5] Move notdirty handling to cputlb, no-reply, 2019/09/19
- Re: [Qemu-devel] [RFC v2 0/5] Move notdirty handling to cputlb, no-reply, 2019/09/19
- Re: [Qemu-devel] [RFC v2 0/5] Move notdirty handling to cputlb, no-reply, 2019/09/19
- Re: [RFC v2 0/5] Move notdirty handling to cputlb, Richard Henderson, 2019/09/21