Closed Bug 826779 Opened 12 years ago Closed 12 years ago

Get DMD to build on Windows

Categories

(Core :: DMD, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file)

I have a patch which makes Windows build successfully with --enable-dmd.  I'd like to land it for now, but I haven't tested DMD yet.  I'll do that work in bug 819839.
Attached patch Patch (v1)Splinter Review
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Attachment #697994 - Flags: review?(netzen)
Comment on attachment 697994 [details] [diff] [review]
Patch (v1)

Review of attachment 697994 [details] [diff] [review]:
-----------------------------------------------------------------

::: memory/replace/dmd/DMD.cpp
@@ +49,5 @@
> +  return si.dwPageSize;
> +}
> +static void* valloc(size_t size)
> +{
> +  return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);

> To reserve and commit pages in one step, call VirtualAlloc 
> with MEM_COMMIT | MEM_RESERVE.
>
> The function fails if you attempt to commit a page that has not been 
> reserved. The resulting error code is ERROR_INVALID_ADDRESS.

This MSDN info doc is a bit confusing to me.
I think reserving only matters for rounding though if you have the first parameter non null.  So what you have is fine as far as I can tell.

I wouldn't be opposed to passing in MEM_RESERVE | MEM_COMMIT
Attachment #697994 - Flags: review?(netzen) → review+
Comment on attachment 697994 [details] [diff] [review]
Patch (v1)

Review of attachment 697994 [details] [diff] [review]:
-----------------------------------------------------------------

::: memory/replace/dmd/DMD.cpp
@@ +47,5 @@
> +  SYSTEM_INFO si;
> +  GetSystemInfo(&si);
> +  return si.dwPageSize;
> +}
> +static void* valloc(size_t size)

Why have you defined valloc()?
(In reply to Brian R. Bondy [:bbondy] from comment #2)
> Comment on attachment 697994 [details] [diff] [review]
> Patch (v1)
> 
> Review of attachment 697994 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: memory/replace/dmd/DMD.cpp
> @@ +49,5 @@
> > +  return si.dwPageSize;
> > +}
> > +static void* valloc(size_t size)
> > +{
> > +  return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
> 
> > To reserve and commit pages in one step, call VirtualAlloc 
> > with MEM_COMMIT | MEM_RESERVE.
> >
> > The function fails if you attempt to commit a page that has not been 
> > reserved. The resulting error code is ERROR_INVALID_ADDRESS.
> 
> This MSDN info doc is a bit confusing to me.
> I think reserving only matters for rounding though if you have the first
> parameter non null.  So what you have is fine as far as I can tell.
> 
> I wouldn't be opposed to passing in MEM_RESERVE | MEM_COMMIT

OK, I'll do that, but I don't think that makes any difference.

(In reply to Nicholas Nethercote [:njn] from comment #3)
> Comment on attachment 697994 [details] [diff] [review]
> Patch (v1)
> 
> Review of attachment 697994 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: memory/replace/dmd/DMD.cpp
> @@ +47,5 @@
> > +  SYSTEM_INFO si;
> > +  GetSystemInfo(&si);
> > +  return si.dwPageSize;
> > +}
> > +static void* valloc(size_t size)
> 
> Why have you defined valloc()?

Because the Microsoft CRT does not support valloc, which is later on called in this file.
https://hg.mozilla.org/mozilla-central/rev/2c7233ca6ffd
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Component: General → DMD
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: