Hi D community!

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

LLVM upstream follow up update

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.

Fixed issues

Generate artificial tag on generated main files

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. In the meanwhile, I accidentally found and fixed a pre-release regression caused by the OutBuffer move when testing this.

Associative arrays are now named with its qualified type name

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 and the associated issue.

Attempt to fix the calling convention

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.

Other reported issues

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 about that.

What is next?

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

You can also read this on the D programming language forum, here, and discuss there.

Read about the previous week and next week.