digitalmars.D - modifying the DMD compiler
- Moritz (23/23) Dec 13 2008 Hello,
- torhu (5/18) Dec 13 2008 D supports 'placement new' like in C++:
- Jarrett Billingsley (2/26) Dec 13 2008 He's... he's modifying the DMD source, which is in C++.
- Brad Roberts (7/34) Dec 13 2008 While he's asked about how to modify the compiler, I suspect what he's
- Moritz (3/39) Dec 15 2008 First of all, thank you for your answers. Im not really interested in mo...
Hello, 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). But there are a lot of questions, which I would like to ask here, before I start to code... 1. The most elegant way to modify the compiler would be to create a class "sharable" and all objects inheriting from it would be created in distributed memory, but I guess this way would be rather complicated, wouldnt it? 2. Is a modification like the one with new_shared() or those described in 1 possible with the DMD or do I have to modify the GDC? 3. Any hints whatsoever to make my task easier? Thanks in advance for your help!
Dec 13 2008
On 13.12.2008 17:16, Moritz wrote:Hello, 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).D supports 'placement new' like in C++: 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.
Dec 13 2008
On Sat, Dec 13, 2008 at 1:25 PM, torhu <no spam.invalid> wrote:On 13.12.2008 17:16, Moritz wrote:He's... he's modifying the DMD source, which is in C++.Hello, 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).D supports 'placement new' like in C++: 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.
Dec 13 2008
Jarrett Billingsley wrote:On Sat, Dec 13, 2008 at 1:25 PM, torhu <no spam.invalid> wrote: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, BradOn 13.12.2008 17:16, Moritz wrote:He's... he's modifying the DMD source, which is in C++.Hello, 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).D supports 'placement new' like in C++: 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.
Dec 13 2008
Brad Roberts Wrote:Jarrett Billingsley wrote: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 :-)On Sat, Dec 13, 2008 at 1:25 PM, torhu <no spam.invalid> wrote: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, BradOn 13.12.2008 17:16, Moritz wrote:He's... he's modifying the DMD source, which is in C++.Hello, 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).D supports 'placement new' like in C++: 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.
Dec 15 2008