This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][patch] Control caching of memory mapped regions
>> - ? ? ?if (p->second->is_locked())
>> + ? ? ?if (p->second->is_locked() || !p->second->is_data_owned())
>> ? ? ? should_delete = false;
>
> I'm having a little trouble understanding the test of is_data_owned().
> is_data_owned() will return true if the data_ownership_ field is not
> DATA_NOT_OWNED. ?The only time that field will be DATA_NOT_OWNED is
> for the whole file view created for an in-memory file, which is only
> done for testing. ?So in normal usage is_data_owned() will always
> return true. ?Given the tests above, that seems to suggest that
> should_delete is pretty much always going to be false. ?That is
> obviously not what your results show, so what am I missing?
I think you're missing the "!" -- is_data_owned() will always return
true in normal execution, so !is_data_owned() will be false, and the
condition remains as before: simply if (p->second->is_locked()). I had
to add that just to keep it from deleting the whole file view in the
unit tests. Yeah, the double negative is confusing; I welcome
suggestions for a better name -- maybe something like
is_permanent_view() or is_testing_view()?
-cary