Source Code
Plan
Proposal
SAOC Projects
Report for week 1 of milestone 1
Light Weight D Runtime.
30th September, 2021
Symmetry Autumn of Code, Week 2 of Milestone 1.
Hi all,
My apologies for posting this update late. Over the past week, I completed testing for task 3 - manual deallocation of delegates. I'm pleased to say that from my internal tests it appears to be working well. Tests have been completed on an STM32F407. Progress has been made on task 1 - support for ModuleInfo
and static/module constructors and destructors.
I've had to slightly deviate from the plan due to how LDC handles module information. The original plan was based off DMD's implementation, but those hooks are unavailable on LDC (obviously, in retrospect -_- ). Instead, LDC relies on a linked list, and the initial pointer is available as _Dmodule_ref
. The linked list contains pointers to ModuleInfo
, which LWDR can then iterate over.
There hasn't been much formal code written, instead I've been doing tests and ensuring that it behaves as expected. There was a bug where a shared static this() {...}
constructor was unable to see TLS variables, despite them being allocated. It was due to an alignment issue during allocation. This still needs to be corrected - it is a very quick fix, fortunately.
To reduce program size, I have been applying LDC_no_moduleinfo
and LDC_no_typeinfo
pragmas to LWDR's internal modules and types, respectively. Public facing modules and types do not have these pragmas. In debug mode, which the -O0
and -gc
flags, this saved ~1KB of program memory.
To cut down on the size of ModuleInfo
, I have made it so the unitTest
function is only compiled in when unit tests are active. This is in accordance with my previous work to reduce the size of vtables for TypeInfo
. It may interfere with custom unit testing libraries.
Going forward next week, I will need to fix the alignment issue, and work on the minfo
module, which will handle ctor sorting and dispatches calls to module constructors and destructors.
All the best,
Dylan Graham