> I'm new to LDC and LLVM, so I appreciate any pointers you can give me
> on how this can be accomplished in LDC (if it's possible) and which parts of
> LDC should I see/modify, etc.
Currently we don't differentiate between stack stores and GC-memory stores. I
guess you'd want to split DtoLoad and DtoStore in gen/tollvm.cpp into two
pairs of functions and then replace all existing uses by one or the other. I'm
pretty sure there are still places where we create loads and stores manually,
though. If you haven't looked at it already, I'd also like to point you to our
short but useful 'hacking guide'
( http://www.dsource.org/projects/ldc/wiki/Hacking ).
> For now, my idea is to use this read/write barriers to collect data
> about how many pointers reads/writes are in a program and eventually
> implement a reference counting GC (probably toy-ish but still).
Sounds interesting! If you do any changes that might be generally useful (like
the aforementioned split), make sure to send in the patch!
Also, feel free to ask questions on IRC - you'll probably get quicker answers.
Best regards
Christian
I think it makes sense to look into LLVM a bit first.
has a lot of different links describing different parts of LLVM.
A good place to start is with the IR language reference:
http://llvm.org/docs/LangRef.html
This should give a good idea of how LDC might generate code for
different D constructs.
Next, I think for a project like this it makes sense to use LLVM's
framework for garbage collection:
http://llvm.org/docs/GarbageCollection.html
Getting all the load/store codegen updated is probably going to be a
bit painful, since unfortunately this kind of thing hasn't really been
considered across the codegen code.
grepping for DtoLoad, DtoStore, CreateLoad, CreateStore, LoadInst,
StoreInst should find all instances though.
> Thanks a lot.
Good luck and let us know if there's anything :)
-Tomas