dlang / project-ideas

Collection of impactful projects in the D ecosystem
36 stars 12 forks source link

GDC (GCC-based D compiler) #10

Open burner opened 5 years ago

burner commented 5 years ago

The GDC compiles uses GCC as a backend to utilize this powerful backend. Recently, GDC has been accepted as GCC frontend and will be part of the GCC9 release. However, GDC still has lots of tasks that the potential students could work on.

One idea would be to improve GDC\'s support for betterC by adding a compiler interface to allow using a modular runtime. Right now when GDC uses some feature (TypeInfo, asserts, unittests), it just emits a call to an `extern(C)` function. A much better approach would be to have a defined D API (e.g. `rt.assert.onAssertFailure(...)`). The compiler can then check if it finds `rt.assert.onFailure`. If not, the compiler can the simply disable that feature and provide nice error messages. This could be done for TypeInfo, Exceptions, Asserts, Switch errors, unit test support, etc. In the end, the vision would be to be able to ship a compiler completely without runtime. This compiler should be able to produce bare bones code without any further configuration. Then add a dependency to `drt:core` in the dub configuration to get class support, `dr:exception` for exceptions, etc. The compiler could then automatically detect availability of these features. (Of course manually adding -I paths would work in exactly the same way).

For more ideas, interested students are encouraged to browse GDC\'s issue list or getting in touch with the GDC development team.

ibuclaw commented 5 years ago

Half this information is outdated / partially irrelevant.

  1. Bugzilla is here: https://gcc.gnu.org/bugzilla/buglist.cgi?component=d&product=gcc
  2. How is one supposed to get in touch with the development team via a wiki?
  3. There already is some effort to replace rt library functions with templates, this is not specific to gdc per say. Making the bulk of this content a duplicate of #25.
  4. "GDC has been accepted as GCC frontend and will be part of the GCC9 release". This is in the wrong tense, gdc is part of gcc-9, the release being last week.
  5. gdc already takes a pay-as-you-go approach to things (it omits many auto-generated parts if they don't exist in object.d). Of course, there's always scope for improvement. :-)
wilzbach commented 5 years ago

@ibuclaw: now that we have you here, could you maybe briefly describe how students could get involved with GDC (what are good starting points?) and what potential projects could be (what are bigger chunks of work that is outstanding?). Thanks!

Laeeth commented 5 years ago

One thing that Iain would know well but only partially is GDC specific is to describe the process of porting D to a new platform. The games company at dconf described a top down approach but Iain favours a more incremental and pragmatic one, I think.

ibuclaw commented 5 years ago

@Laeeth, that could be a project in its own right, feel free to assign me to that if one is created. I'll think about gdc tasks tomorrow, though right now I can only think of CI infrastructure related things.