[dmd-internals] changeset 455
Robert Clipsham
robert at octarineparrot.com
Wed Apr 28 15:08:37 PDT 2010
On 28/04/10 22:53, Jason House wrote:
> As one who attempted to do quick surgical fixes and failed, I appreciate
That doesn't surprise me, I don't think there's such thing as a quick
surgical fix in dmd, there's so many things you don't expect to break
but do with even trivial changes, unless you know the bit of code you're
working with well.
> your efforts! I'm curious, how long did you spend researching before you
> could start making useful changes?
It took me about 3 or 4 days to reverse engineer various parts of the
DWARF info[1] to figure out how it worked, figure out how dmd wrote the
DWARF info, and track down/fix the bug in total. Subsequent DWARF bugs
took next to no time to track down and fix, as I'm not pretty familiar
with that part of the codebase.
> Every time I try peeking under the hood of dmd, I wish there was some
> kind of basic overview document. Even a few sentences at the top of a
> file indicating its purpose would be a great help. It's probably 10x
> better still if I stop acting so lazy and dedicate a few hours to
> getting a basic sense of what the code is doing!
An overview document would be nice for a lot of people, it needs someone
to write it though. I've spent a lot of time in the dmd front end/other
compiler front ends over the past year or so, so I'm pretty familiar
with the layout and how things work now, that said, most bugs would
still take me a few days. I think the best way to figure out what's
happening is to head to mars.c and read through main(), seeing how it
works. You can skip the first half that parses options etc. This should
give you a rough idea of how it all fits together, it will take some
time though.
--
[1] It was mostly reverse engineered, I used the spec, the gdb source
and dmd source as a reference... I tried reading the spec, it was going
in one eye and out the other though... I found it far easier to reverse
engineer it and use various sources as a reference.
More information about the dmd-internals
mailing list