Re: Problem using .zerofill / -segaddr to create very large segments
Re: Problem using .zerofill / -segaddr to create very large segments
- Subject: Re: Problem using .zerofill / -segaddr to create very large segments
- From: Greg Parker <email@hidden>
- Date: Tue, 22 Sep 2009 18:01:10 -0700
On Sep 22, 2009, at 5:50 PM, Jay Reynolds Freeman wrote:
On Sep 22, 2009, at 5:42 PM, Greg Parker wrote:
You are thinking relocatable binary files, I believe. Think "linked
lists" and "structs with pointers to other structs", instead --
that is
what is in this big memory-mapped block.
> The traditional way to pic-ify such data structures is to store
> relative offsets instead of absolute pointers.
Notable performance hit and serious addition of complexity:
Replace *foo by *(something->getBaseAddress() + fooOffset)
in about a zillion places.
The trick to save performance is to store an offset relative to the
location where the offset is stored. Then `*foo` becomes `foo+*foo`.
And you can save space by using 4-byte offsets if you know the
complete data structure spans less than 4GB (though for you that
appears not to be the case).
Snow Leopard's Objective-C runtime uses both of those for the selector
table in the dyld shared cache. Usually the shared cache loads at the
same address everywhere, but this makes it work without modification
otherwise.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden