Optional ModuleInfo (Part 2): Backend Optimizations#7768
Optional ModuleInfo (Part 2): Backend Optimizations#7768dlang-bot merged 1 commit intodlang:masterfrom JinShil:better_betterC
Conversation
|
Thanks for your pull request, @JinShil! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
|
FYI: the auto-tester changes are unrelated, see braddr/d-tester#66 |
|
Nice work! Do you plan opening similar pull requests for GDC? |
Much of my motivation for doing this work is so I can eventually use D this way with GDC and ARM Cortex-M microcontrollers. However, I don't know anything about the differences between DMD and GDC. I was going to wait for you and @ibuclaw to begin merging the 2.079 frontend with GDC, try it out, and see what needs to be done (hoping you'll get in touch with me when the time comes). If there's anything I can do to facilitate getting this and some of my other DMD PRs into GDC, please let me know. I still have a few more things I'd like to do to DMD to make minimal-runtime programming in D more polished, but everything I'm doing here in DMD is so I can eventually use these features in GDC. |
Adding an extra check to
I don't think that will happen for a while. The splitting of betterC into granular codegen options should be backported, however. Also the time is nigh for fast compile-times, have pinged you in the relevant PR. |
I'm not sure what you mean by that. Are you saying we should expose the 3 options (useTypeInfo, useExceptions, useModuleInfo) as separate switches in DMD? |
|
Backport means gdc. Otherwise I would have said upstream. |
|
@JinShil ok. It's indeed a good idea to implement all this stuff in DMD upstream first, then add the remaining parts in GDC 👍 When we talk about |
This pull request is a follow up to #7395 and the rationale for this change is basically the same.
If
ModuleInfoisn't declared in the runtime, there's no reason for the compiler (1) emit an error and (2) generate object code for it. PR #7395 took care of (1) and this PR takes care of (2). That is, prior to this PR, ifModuleInfowas not declared in the runtime, the backend still generated__start_minfo,__stop_minfo, and friends.To make this work, the
betterCbackend config flag is split into its 3 component parts. That way theuseExceptionsflag can be used to turn on/off EH code generation, and theuseModuleInfoflag can be used to turn on/off module info code generation independently. TheuseModuleInfoconfig flag is set withparams.useModuleInfo && Module.moduleinfo.-betteCfunctionality still works the same, but now there's a little more fine tuning that can be done by what is declared or not declared in the runtime.Benefits
This will be of interest to users wishing to incrementally or partially port D to new platforms, users hoping to target resource constrained platforms, and users wishing to use D as a library from other languages without druntime.
If this PR is merged, I should be able to do one more followup that can get an empty
mainprogram down to 56 bytes with or without the-betterCflag.