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 --
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
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