Thoughts about D

Walter Bright newshound2 at digitalmars.com
Fri Dec 1 11:07:32 UTC 2017


On 11/30/2017 8:34 PM, Nicholas Wilson wrote:
> What I meant in terms of icache pollution is with the 'cold' is instead of 
> generating:
> 
> if(!cond)
>      _d_assert(__FILE__, __LINE__,message);
> //rest of code
> 
> it should actually generate,
> 
> if (!cond)
>      goto failed;
> //rest of code
> 
> failed:
>       _d_assert(__FILE__, __LINE__,message);//call is cold & out of line. no 
> icache pollution
> 
> I'm not sure that it does that given the triviality of the example, but it looks 
> like it doesn't.

You're right, it would be better to generate code that way. But it currently 
does not (I should fix that). It's not completely correct that icache isn't 
polluted. Functions that are tightly coupled can be located adjacent for better 
cache performance, and the various asserts would push them apart. Also, the 
conditional jumps may need to be the longer variety due to the longer distance, 
rather than the 2 byte one.



More information about the Digitalmars-d mailing list