GSoC'19: Any LLVM based idea? If not let's think one!

Nicholas Wilson iamthewilsonator at hotmail.com
Sun Dec 16 05:59:37 UTC 2018


On Saturday, 15 December 2018 at 19:52:42 UTC, Reshabh Sharma 
wrote:
>>See also: https://github.com/ldc-developers/ldc/pull/2397
>>
> On Thursday, 13 December 2018 at 19:17:15 UTC, Johan Engelen 
> wrote:
>> On Wednesday, 12 December 2018 at 22:50:16 UTC, Johan Engelen 
>> wrote:
>>>
>>> - exploiting immutability of variables (notably of structs 
>>> such as string slices)
>>> - devirtualization
>>
>> Btw, I think these are somewhat similar and that the first may 
>> lead to larger performance gains. Once the first works, the 
>> second follows almost automatically (after a deeper study of D 
>> language semantics of object runtime type).
>>
>
> Thanks, I don't have much knowledge about this so I'll go with 
> your words :) then I would insist that we can have "exploiting 
> immutability of variables" as a project idea.
>
> Can you please suggest some resources for getting a bit more 
> idea about how others have exploited immutability of variables 
> or is there a generic term for this (I could not find much 
> online :/ ).

(In case you haven't seen it (C++ devirtualisation) 
https://www.youtube.com/watch?v=Dt4UehzzcsE&index=36&list=PL_R5A0lGi1AARZysSx4VzpaLAzny4es2e&t=0s )

Unlike C++ where const isn't any good for optimisation, in D an 
immutable variable will never change and immutable is transitive: 
no mutable references to it are allowed, only const (which is a 
guarantee to not change the data through this reference) and 
immutable, neither of which may be used to change the value _or 
anything reachable from it_.
As a consequence of this not only can you safely cache the value 
and any values derived from it, the data referenced by an 
immutable pointer will never alias mutable data (it may alias 
const data but if it does then that data is immutable so it will 
never change).

The devirtulisation then follows from the fact that the vtable is 
immutable and assigned once in construction (unlike C++).

> I can help in drafting a project idea for this and if it could 
> get a mentor then I'm willing to be the part (If I qualify to 
> be) else it will definitely catch some eyes!

If you're having trouble finding a mentor, I could do it.


More information about the digitalmars-d-ldc mailing list