GC: two major pain point the compiler/druntime can help with

Walter Bright newshound2 at digitalmars.com
Thu May 30 23:11:32 UTC 2024


On 5/21/2024 5:07 AM, deadalnix wrote:
> 1. Static data that contain pointer or not are not differentiated.
> 
> The compiler put all the static data in 2 segments, depending on whether they 
> are zero initialized or not. Then these segment are passed down to the GC to 
> scan. Any application that has large buffer of static data, for instance 
> precomputed result to speedup computations, ends up scanning them again and 
> again for pointers.
> 
> The compiler knows what static data may or may not contain pointers, and could 
> split them up in different segment, and the runtime could only pass down the 
> appropriate segment. This is an almost free win.

Sounds like a good idea.

Since we don't control what the C compiler does, the D compiler would have to 
put the "noscan" segment as the extra segment.

There's also what happens with the BSS segment, which is initialized with all 
zeros. There'd need to be a "noscan" bss segment, too.



More information about the Digitalmars-d mailing list