svn commit: r334702 - head/sys/sys

Ravi Pokala rpokala at freebsd.org
Thu Jun 7 13:52:08 UTC 2018


-----Original Message-----
From: Brooks Davis <brooks at freebsd.org>
Date: 2018-06-07, Thursday at 09:27
To: Ravi Pokala <rpokala at freebsd.org>
Cc: "Jonathan T. Looney" <jtl at freebsd.org>, Mateusz Guzik <mjguzik at gmail.com>, Mateusz Guzik <mjg at freebsd.org>, src-committers <src-committers at freebsd.org>, <svn-src-all at freebsd.org>, <svn-src-head at freebsd.org>
Subject: Re: svn commit: r334702 - head/sys/sys

> On Thu, Jun 07, 2018 at 12:01:00AM -0400, Ravi Pokala wrote:
>>> I believe the theory is that the compiler (remember, this is __builtin_memset) can optimize away portions of the zeroing, or can optimize zeroing for small sizes.
>> 
>> Ahhh! I didn't consider that the compiler would be doing analysis of the larger context, and potentially skipping zeroing parts that are set immediately after the call.
> 
> Clang does this.  It does make for some quite interesting object code,
> but the result is that zeroing with __builtin_memset() is basically free
> for mostly-initialized structures.
> 
> -- Brooks

Yeah, it's a subtle but obvious optimization in hindsight. Thanks for the info.

-Ravi (rpokala@)




More information about the svn-src-head mailing list