www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: modifying the DMD compiler

Brad Roberts Wrote:

 Jarrett Billingsley wrote:
 On Sat, Dec 13, 2008 at 1:25 PM, torhu <no spam.invalid> wrote:
 On 13.12.2008 17:16, Moritz wrote:

 Im a student of computer science and at university, we're working on a
 distributed shared memory system, implemented as a C library.

 Im also a great fan of D, and so Im asking myself if I could connect D
 to the C library (which is no problem, as far as I know) and then modify
 the memory allocation of the compiler to place objects into the
 distributed memory (I would also need to disable garbage collection, but
 that should be no problem).

 Ive already reviewed the sourcecode of the dmd (the parts of it that are
 shipped with the dmd) and found out malloc() is called in Mem.c

 So I guess a rather simple way to do what I need would be to overwrite
 the new() operator or to add another operator to allocate distributed
 memory (something like new_shared() maybe).

http://www.digitalmars.com/d/1.0/class.html#allocators If you're using Tango or dmd 2.x you can also replace the GC with your own version if you need to.

He's... he's modifying the DMD source, which is in C++.

While he's asked about how to modify the compiler, I suspect what he's really interested is in modifying the runtime so that applications that are written in D can take advantage of what he's doing. Modifying the compiler would be of minimal value. Later, Brad

First of all, thank you for your answers. Im not really interested in modifying the source, I thought I had no other choice to get objects into our shared memory. But I guess the 'placement new' solution will work perfectly for me, so theres no need to touch the holy DMD :-)
Dec 15 2008