Jump to page: 1 2 3
Thread overview
Re: DMD + nedmalloc?
Jun 05, 2009
davidl
Jun 05, 2009
Brad Roberts
Jun 05, 2009
Robert Fraser
Jun 05, 2009
davidl
Jun 05, 2009
davidl
Jun 05, 2009
davidl
Jun 05, 2009
davidl
Jun 05, 2009
davidl
Jun 05, 2009
davidl
Jun 05, 2009
davidl
Jun 05, 2009
davidl
Re: DMD + nedmalloc? last one
Jun 05, 2009
davidl
Jun 05, 2009
davidl
Jun 05, 2009
Robert Clipsham
Jun 05, 2009
dsimcha
Jun 05, 2009
Robert Jacques
Jun 05, 2009
davidl
June 05, 2009
On Thu, Jun 4, 2009 at 8:50 PM, Jarrett Billingsley <jarrett.billingsley@gmail.com> wrote:

>
> http://www.digitalmars.com/d/archives/digitalmars/D/nedmalloc_47148.html http://lists.puremagic.com/pipermail/digitalmars-d/2007-January/013224.html

Oops, meant to post this link instead:

http://www.digitalmars.com/d/archives/digitalmars/D/Compiling_nedmalloc_w_DMC_46240.html
June 05, 2009
在 Fri, 05 Jun 2009 08:51:25 +0800,Jarrett Billingsley <jarrett.billingsley@gmail.com> 写道:

> On Thu, Jun 4, 2009 at 8:50 PM, Jarrett Billingsley <jarrett.billingsley@gmail.com> wrote:
>
>>
>> http://www.digitalmars.com/d/archives/digitalmars/D/nedmalloc_47148.html http://lists.puremagic.com/pipermail/digitalmars-d/2007-January/013224.html
>
> Oops, meant to post this link instead:
>
> http://www.digitalmars.com/d/archives/digitalmars/D/Compiling_nedmalloc_w_DMC_46240.html

Even if you can compile it to binary, it still won't run correctly because of the dmc codegen problem.

I will attach a compilable nedmalloc source, corresponding compile batch, and a simple test app. In two post of this thread because of the attachment size limitation of 51k.

The bug is:

malloc.c.h:1870
interlockedcompareexchange(&malloc_global_mutex_status, -1, 0) == 0) {
004020f7: 837dfc00                cmp dword [ebp-0x4], 0x0
004020fb: 7530                    jnz 0x40212d  init_malloc_global_mutex
malloc.c.h:1875
004020fd: 6a00                    push 0x0
004020ff: 6aff                    push 0xff
00402101: 68b8e74200              push dword 0x42e7b8
00402106: e811100200              call 0x42311c
__InterlockedCompareExchange

*Notice:

The prototype of the func for last two params are longs. So it should be:

push 0x00000000
push 0xffffffff

not:
push 0x0
push 0xff

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/

June 05, 2009
在 Fri, 05 Jun 2009 08:51:25 +0800,Jarrett Billingsley <jarrett.billingsley@gmail.com> 写道:

> On Thu, Jun 4, 2009 at 8:50 PM, Jarrett Billingsley <jarrett.billingsley@gmail.com> wrote:
>
>>
>> http://www.digitalmars.com/d/archives/digitalmars/D/nedmalloc_47148.html http://lists.puremagic.com/pipermail/digitalmars-d/2007-January/013224.html
>
> Oops, meant to post this link instead:
>
> http://www.digitalmars.com/d/archives/digitalmars/D/Compiling_nedmalloc_w_DMC_46240.html

attachment 2

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/

June 05, 2009
在 Fri, 05 Jun 2009 10:51:51 +0800,davidl <davidl@nospam.org> 写道:

> 在 Fri, 05 Jun 2009 08:51:25 +0800,Jarrett Billingsley
> <jarrett.billingsley@gmail.com> 写道:
>
>> On Thu, Jun 4, 2009 at 8:50 PM, Jarrett Billingsley
>> <jarrett.billingsley@gmail.com> wrote:
>>
>>>
>>> http://www.digitalmars.com/d/archives/digitalmars/D/nedmalloc_47148.html
>>> http://lists.puremagic.com/pipermail/digitalmars-d/2007-January/013224.html
>>
>> Oops, meant to post this link instead:
>>
>> http://www.digitalmars.com/d/archives/digitalmars/D/Compiling_nedmalloc_w_DMC_46240.html
>
> attachment 2
>

Or, rather than dmc's codegen bug, I think I might trigger the nasty C "bug" actually. C can call a function without any prior declaration of it, and compiler needs to accept that, and create corresponding mangled name.
The issue is probably the winbase.h is not up to date.

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/
June 05, 2009
I modified the nedmalloc source to compatible for dmc. And need to update
the winbase.h of dmc
1.use the file in my attachment to overwrite the winbase.h which used by
DMC.
2.run buildnedmalloc.bat
3.run buildtestd.bat to generate the test.exe

June 05, 2009
attachment 2

June 05, 2009
attachment 3

June 05, 2009
attachment 4

June 05, 2009
attachment 5

June 05, 2009
attachment 6

« First   ‹ Prev
1 2 3