www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - SAOC LLDB D integration: 9th Weekly Update

Hi D community!

I'm here again, to describe what I've done during the ninth week of
Symmetry
Autumn of Code.



I started this week updating the rest of the patches to reflect the
suggestions made in the first patch, such as use a different
OutputBuffer and other nit codestyle changes. It turns out to be very
unproductive week, unfortunately, since I got some runtime errors such
as heap buffer overflows and heap usage after free() calls leading to
very weird bugs because of my dumb idea of refactoring the existing
code.

TL;DR of the situation, I made a vim macro to substitute the existing
OutputString to an OutputBuffer and, since comma expressions are a
thing, situations like `buffer.append(ptr, size);` got silently
translated to `buffer << ptr, size;`. Since I preallocated the buffer,
the segfaults were intermittent. Furthermore, the semantics of my
previous Free() method included resetting the buffer after a free(),
leading to some heap usage after free().

Anyway, you can check the changes I've made
[here](https://github.com/ljmf00/llvm-project/tree/add-d-demangler-splitted
).





DWARF now generates an artificial tag when `-main` argument is passed
indicating that the symbol is generated by the compiler. The change can
be found [here](https://github.com/dlang/dmd/pull/13301). In the
meanwhile, I accidentally found and
[fixed](https://github.com/dlang/dmd/pull/13302) a pre-release
regression caused by the OutBuffer move when testing this.



Instead of printing `_AArray_<key>_<value>` where `<key>` and `<value>`
is the string representation of the TY, we now have the type name we
are used to `<value>[<key>]`. This also eliminates the problem where
fake TY types are internally used -- e.g. `string` types are faked to
`ucent` types. You can see the change
[here](https://github.com/dlang/dmd/pull/13296) and the [associated
issue](https://issues.dlang.org/show_bug.cgi?id=3D22508).



I dug into the backend codegen to understand a bit more about how the
calling convention is currently being processed. I ended up with a
working test although very weird errors are happening and I cannot have
a reduced reproducible test case to locally understand the problem and
go forward with this, although Martin Kinkelin suggested something that
I can start with. You can find the WIP PR
[here](https://github.com/dlang/dmd/pull/13287).



On LDC I found out that the compiler always generates the DWARF
visibility attributes, even if not necessary, leading to bigger binary
sizes. I created an
[issue](https://github.com/ldc-developers/ldc/issues/3870) about that.



I ended up not starting the TypeSystem nor DWARFFASTParser
implementation. I will try to hopefully go forward with it next week.

Read this on my blog, [here](https://lsferreira.net/posts/d-saoc-2021-
09).

--=20
Sincerely,
Lu=C3=ADs Ferreira   lsferreira.net
Nov 18 2021