-
Notifications
You must be signed in to change notification settings - Fork 15
Spur (Image) Memory Layout
Since Spur is not only the new object header and image format, but also the new memory manager in Cog, some additional memory constraints come with it.
The first objects in the heap (at "oldSpaceStart" and thus the first ones in the image) are nil, false and true. Aftert those, comes the "freeListObj" and after that the "hiddenRootsObj".
The hiddenRootsObj is interesting because its first pointer points to the first page of the class table, which maps class hashes/indexes to class oops. Each class table page has 1024 slots (the class table minor index is 10 bits wide) and there are 12 table pages (the remaining 12 of the total 22 class index bits). The first 12 slots of the hiddenRootsObj point to those pages, although nil is a valid and common value for each but the first of these references when there are significantly less than 4 mil. classes.
For the implementation of Spur image synthesis (via tracing or otherwise), SpurMemoryManager>>initializeObjectMemory:, its callees and assertions are highly relevant.
(source: SpurMemoryManager class comments and code)