[Mesa-dev] [PATCH V2] util/disk_cache: support caches for multiple architectures

Timothy Arceri tarceri at itsqueeze.com
Fri Mar 3 23:37:42 UTC 2017



On 03/03/17 23:27, Grazvydas Ignotas wrote:
> On Fri, Mar 3, 2017 at 5:27 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
>> Previously we were deleting the entire cache if a user switched
>> between 32 and 64 bit applications.
>>
>> V2: make the check more generic, it should now work with any
>> platform we are likely to support.
>> ---
>>  src/util/disk_cache.c | 19 +++++++++++++++++++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
>> index 3abdec4..92528a9 100644
>> --- a/src/util/disk_cache.c
>> +++ b/src/util/disk_cache.c
>> @@ -40,20 +40,30 @@
>>  #include "zlib.h"
>>
>>  #include "util/crc32.h"
>>  #include "util/u_atomic.h"
>>  #include "util/mesa-sha1.h"
>>  #include "util/ralloc.h"
>>  #include "main/errors.h"
>>
>>  #include "disk_cache.h"
>>
>> +#if defined(__ILP32__)
>> +#if defined(__x86_64__) || defined(__arm__)
>> +#define CACHE_ARCH "ilp-32"
>> +#else
>> +#define CACHE_ARCH "32"
>> +#endif
>> +#else
>> +#define CACHE_ARCH "64"
>> +#endif
>
> That reports "64" for me on gcc -m32, I think only clang sets
> __ILP32__ for non-x32 32bit build.

Well that's annoying.

> I'd still suggest using sizeof(void
> *) directly in the code, perhaps within some "const char
> *get_arch_bitness_string()" helper, that should be more reliable.

I'm tempted to just push this:
https://patchwork.freedesktop.org/patch/141891/

And worry about issues later if that's not good enough.

>
> GraÅžvydas
>


More information about the mesa-dev mailing list