Integrated code formatter

H. S. Teoh hsteoh at
Tue Jan 18 17:12:35 UTC 2022

On Tue, Jan 18, 2022 at 07:37:42AM -0800, H. S. Teoh via Digitalmars-d wrote:
> Outlined a few possible approaches to fix this here:
> I'm not sure I have the compiler chops to actually fix this myself,
> though.  This is a little beyond my level of familiarity with dmd
> code.  Would be nice if somebody picked this up.

OK, so to *completely* fix this may be a little beyond me, but a partial
fix that at least covers std.array.array was within reach.  So I changed
dmd to set a new predefined version D_ProfileGC, extended rt/tracegc.d
to wrap the specific druntime call std.array.array uses, and modified
Phobos to call the wrapped function instead when version=D_ProfileGC.

With these changes, I successfully got -profile=gc to detect allocations
from std.array.array!

However, this fix is not complete yet, because currently profilegc.txt
shows the allocation coming from some obscure line deep inside Phobos
internals, which is very user-unfriendly. It will take a bit more work
to properly propagate file/line/function information from user code down
to the point of allocation.


English is useful because it is a mess. Since English is a mess, it maps well onto the problem space, which is also a mess, which we call reality. Similarly, Perl was designed to be a mess, though in the nicest of all possible ways. -- Larry Wall

More information about the Digitalmars-d mailing list