Re: cache clearing from keeping code and data in the same segment
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On 19 Jan 2009, at 11:36, Joel Reymont wrote: I very much doubt that. Why do you think that is the case? Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Keeping code and data in the same segment apparently results in the clearing of the instruction cache on every data access. Keeping code and read/write data close to each other (putting them in the same segment may qualify) may result in the icache getting invalidated on data writes (to deal with self-modifying code), but I can't imagine how or why memory reads would result in icache invalidations (read-only data is common in code segments on many platforms). Such flushing, if any, would performed by the cpu though, the OS has no influence over that. Note that this would most likely be x86-specific. On e.g. the PPC you have to manually invalidate the icache when using self-modifying code. Also note that in general it's a bad idea to put code and data close to each other (even if no automatic flushing whatsoever happens), because it pollutes both the icache and dcache: the icache will partly contain data (which is never fetched from the icache) and the data cache will partly contain instructions (which are never fetched from the dcache), thereby reducing the effectiveness of both. This email sent to site_archiver@lists.apple.com
participants (1)
-
Jonas Maebe