[Issue 3983] Regression(2.037): struct with == can't be member of struct with template opEquals

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3983


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #2 from Walter Bright  2010-06-27 
23:15:27 PDT ---
http://www.dsource.org/projects/dmd/changeset/564

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4277] delegate reference wrong scope var value

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4277



--- Comment #3 from changlon  2010-06-27 21:19:19 PDT ---
(In reply to comment #2)
> I test this bug in linux and windows, dmd1.062 print wrong address in linux
> too.
> 
> dmd 2.047 is work for windows and linux.
> 
> 
> I use obj2asm to compare the d1 and d2 object file, but i have no ideal where
> is wrong .
> 
> 
> http://gool.googlecode.com/files/bug4277.tar
> this package include the bug2177.d (for both dmd1 and dmd2), 1.asm (from dmd1
> generate bug2177.o file) and 2.asm (from dmd2 generate bug2177.o file).

sorry , i mean bug4277.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4277] delegate reference wrong scope var value

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4277


changlon  changed:

   What|Removed |Added

Version|1.057   |D1
 OS/Version|Windows |All


--- Comment #2 from changlon  2010-06-27 21:18:05 PDT ---
I test this bug in linux and windows, dmd1.062 print wrong address in linux
too.

dmd 2.047 is work for windows and linux.


I use obj2asm to compare the d1 and d2 object file, but i have no ideal where
is wrong .


http://gool.googlecode.com/files/bug4277.tar
this package include the bug2177.d (for both dmd1 and dmd2), 1.asm (from dmd1
generate bug2177.o file) and 2.asm (from dmd2 generate bug2177.o file).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3569] DMD Stack Overflow with a struct member function inside a C-style struct initializer

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3569


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #7 from Walter Bright  2010-06-27 
20:50:24 PDT ---
http://www.dsource.org/projects/dmd/changeset/563

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 859] Improve compiler inlining

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=859



--- Comment #5 from Leandro Lucarella  2010-06-27 20:01:35 
PDT ---
(In reply to comment #4)
> @Leandro Lucarella: ldc seems to inline the predicate just fine, although the
> generated code is still slightly different.

Yes, LDC is better at inlining because it doesn't use the front-end inlining
code, it let the LLVM optimizer do the job instead (I think they inhibited the
DMDFE inliner precisely because of this issues).

This bug report is about the DMD implementation.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 859] Improve compiler inlining

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=859


nfx...@gmail.com changed:

   What|Removed |Added

 CC||nfx...@gmail.com


--- Comment #4 from nfx...@gmail.com 2010-06-27 19:00:28 PDT ---
@Leandro Lucarella: ldc seems to inline the predicate just fine, although the
generated code is still slightly different.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 859] Improve compiler inlining

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=859


Leandro Lucarella  changed:

   What|Removed |Added

   Keywords||performance
 CC||llu...@gmail.com
   Platform|x86 |All
Version|1.00|D1 & D2
 OS/Version|Windows |All


--- Comment #3 from Leandro Lucarella  2010-06-27 18:49:49 
PDT ---
To avoid opening a new bug, I'll reuse this ancient bug report, since the
summary is pretty much the same I'll write for this.

I'm having some performance problems moving some stuff from a lower-level
C-style to a higher-lever D-style. Here is an example:

---
int find_if(bool delegate(ref int) predicate)
{
for (int i = 0; i < 100; i++)
if (predicate(i))
return i;
return -1;
}

int main()
{
//  for (int i = 0; i < 100; i++)
//  if (i == 99)
//  return i;
//  return -1;
return find_if((ref int i) { return i == 99; });
}
---

The program produced by this source executes 4 times more instructions than the
more direct (lower-level) version commented out. I would expect DMD to inline
all functions/delegates and produce the same asm for both, but that's not the
case.

This is a reduced test-case, but I'm working on improving the GC and I'm really
hitting this problem. If I use this higher-level style in the GC, a Dil run for
generating the Tango docs is 3.33 times slower than the C-ish style used by the
current GC.

So I think this is a real problem for D, it's really important to be able to
encourage people to use the higher-level D constructs.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3716] Regression (2.037) with multi dimensional array literals

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3716


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #5 from Walter Bright  2010-06-27 
18:35:14 PDT ---
http://www.dsource.org/projects/dmd/changeset/562

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4398] dmd always uses Windows name mangling for _d_throw

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4398



--- Comment #4 from Leandro Lucarella  2010-06-27 17:00:08 
PDT ---
First of all, thanks for tackling this!

I wonder if there is any way to avoid code duplication in druntime, as (unless
I'm missing something) the _d_throw() body seems to be the same for Windows and
Posix, only the function signature changes.

Isn't extern (System) -which, btw, seems to be missing in the docs- exactly for
this case?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4399] New: Incomplete extern (...) docs

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4399

   Summary: Incomplete extern (...) docs
   Product: D
   Version: D1 & D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: spec
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: llu...@gmail.com


--- Comment #0 from Leandro Lucarella  2010-06-27 16:59:59 
PDT ---
Documentation on the extern storage class is both very sparse and very scarce.

* Most documentation is only about extern (C) and is present in an article
about C compatibility or the ABI docs.

* I couldn't find any mention to extern (System) in all the specs.

* extern (C++) is only found in the article about interfacing with C++

* The only mention of extern (D) I found is in the ABI description.

* extern (Windows) is mostly mentioned only in the D for Win32 article.

I think it would be nice to have a central place where all extern (...)
declarations are explained (or at least listed with links to their usage). A
table like the available predefined versions for the version statement would be
nice.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4314] Regression(1.062): Expression array1 && array2 doesn't compile

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4314


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #2 from Walter Bright  2010-06-27 
15:59:34 PDT ---
http://www.dsource.org/projects/dmd/changeset/561

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3463] Integrate Precise Heap Scanning Into the GC

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3463



--- Comment #17 from nfx...@gmail.com 2010-06-27 14:49:50 PDT ---
PS: I forgot to handle TypeInfo_Typedef. Apply this change in object_.d:

@@ -370,6 +370,7 @@ class TypeInfo_Typedef : TypeInfo

 override TypeInfo next() { return base; }
 override uint flags() { return base.flags(); }
+override PointerMap pointermap() { return base.pointermap(); }
 override void[] init() { return m_init.length ? m_init : base.init(); }

 TypeInfo base;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3463] Integrate Precise Heap Scanning Into the GC

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3463


nfx...@gmail.com changed:

   What|Removed |Added

 Attachment #680 is|0   |1
   obsolete||


--- Comment #16 from nfx...@gmail.com 2010-06-27 14:36:30 PDT ---
Created an attachment (id=682)
D1 - patch for dmd for creating pointer bitmasks

(forgot some minor stuff - also, this patch is loosely against dmd 1.062;
Walter forgot to tag the 1.062 release in svn)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3463] Integrate Precise Heap Scanning Into the GC

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3463



--- Comment #15 from nfx...@gmail.com 2010-06-27 14:21:58 PDT ---
I posted two patches to enable precise GC heap scanning under D1/Tango. All
user programs will make use of the precise scanning; no modifications required.

The dmd patch makes dmd generate an additional field in TypeInfo_Struct and
ClassInfo. These fields point to pointer bitmasks for the referenced type. The
patch is written in such a way, that it won't break unpatched Tango or Phobos1
runtimes. In particular, this means the patched compiler should be useable with
an unpatched Phobos1. (And I don't intend to write a Phobos1 patch. Phobos1 is
ded.)

The tango patch makes use of the generated bitmasks. It is based on dsimcha's
patch. The mark phase and the bitmask format are completely different, but the
brain-drilling changes to add bitmask pointers to the memory blocks are the
same. This patch is also designed in such a way, that the patched runtime can
be used with an unpatched compiler (in this case, it defaults to conservative
scanning). The patch also contains a test program (pm.d) for the compiler
generated bitmasks.

The patch should be able to handle all D types. The internal nodes for
associative arrays are still scanned conservatively. You would have to
dynamically allocate and fill pointer maps for each AA, and I'll just say:
sorry, but no.

Note that the bitmask format is different compared to dsimcha's patch. Now it's
a bitmap, where each bit represents an aligned, pointer sized chunk of memory.

Also, I don't use templated TypeInfos as dsimcha was suggesting. I'm convinced
this approach would slow down compile times and generate masses of bloat. It
also would be hard to implement. The question what the TypeInfo of a TypeInfo
template instance should be was unsolved, too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3463] Integrate Precise Heap Scanning Into the GC

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3463



--- Comment #14 from nfx...@gmail.com 2010-06-27 14:08:34 PDT ---
Created an attachment (id=681)
D1 - patch for Tango's runtime to enable precise GC scanning

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3463] Integrate Precise Heap Scanning Into the GC

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3463



--- Comment #13 from nfx...@gmail.com 2010-06-27 14:07:33 PDT ---
Created an attachment (id=680)
D1 - patch for dmd for creating pointer bitmasks

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4398] dmd always uses Windows name mangling for _d_throw

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4398



--- Comment #3 from Johannes Pfau  2010-06-27 11:04:12 
PDT ---
I wanted to say "but I could _not_ get
it to work with e.g. alias".

A different solution to this problem is to use extern(C) everywhere, even for
windows. This also solves the 64bit problem. However, I'm not sure why
__stdcall was used on windows, maybe it is needed (performance related?).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4398] dmd always uses Windows name mangling for _d_throw

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4398



--- Comment #2 from Johannes Pfau  2010-06-27 10:53:23 
PDT ---
Created an attachment (id=679)
Patch for druntime

This is the patch required for druntime.

In /src/rt/deh2.d "void _d_throw(Object *h)" must be extern(Windows) for
windows and extern(C) for all other platforms.

In /src/rt/deh.c "void __stdcall _d_throw(Object *h)" must have __stdcall for
windows and "void _d_throw(Object *h)" for all other platforms.

The other 2 symbols modified in the dmd patch are not used in druntime.

This patch places the whole functions in version blocks. Therefore a lot of
code is duplicated. I guess this could be done in a better way, but I could get
it to work with e.g. alias.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4398] dmd always uses Windows name mangling for _d_throw

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4398



--- Comment #1 from Johannes Pfau  2010-06-27 10:46:51 
PDT ---
Created an attachment (id=678)
Patch for dmd2

Patch for dmd2.
This patch also fixes the _seh_longjmp_unw...@4 and _cpp_longjmp_unw...@4
symbols. This might not be necessary, it seems those symbols are used on
windows only.

This also requires a patch to druntime, and both must be applied or there will
be link errors on linux.

BTW: If I understand windows name mangling correctly, @4 means the arguments
have size 4 bytes. As the argument is a pointer hardcoding it to 4 will not
work on 64bit.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4398] New: dmd always uses Windows name mangling for _d_throw

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4398

   Summary: dmd always uses Windows name mangling for _d_throw
   Product: D
   Version: D1 & D2
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: johannesp...@gmail.com


--- Comment #0 from Johannes Pfau  2010-06-27 10:41:17 
PDT ---
When calling _d_throw dmd always uses the name _d_th...@4 regardless of the
operating system. Dynamic ELF libraries support versioning symbols using the
syntax n...@version. Therefore when ld encounters _d_th...@4 it reads "symbol
_d_throw, version 4" and complains that there is no version 4. As long as this
isn't fixed Dynamic D libraries can't be created on operating systems using ELF
executables.

See also:
http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=112648
and the links referred in the newspost.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4397] New: D1 const does not work

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4397

   Summary: D1 const does not work
   Product: D
   Version: D1 & D2
  Platform: Other
OS/Version: All
Status: NEW
  Keywords: wrong-code
  Severity: regression
  Priority: P1
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: nfx...@gmail.com


--- Comment #0 from nfx...@gmail.com 2010-06-27 10:30:32 PDT ---
In the following example, foo() will create an array literal on each call,
instead of returning a statically shared / compile time value. On D2, the same
may happen when using enum instead of const (I didn't test it).

In many cases, this codegen bug may go unnoticed, which makes it just worse.

$ cat rtz.d
struct X {
int[] a;
}

const cX = X([1,2]);

X foo() {
return cX;
}

$ dmd -c rtz.d
$ objdump -d -Mintel rtz.o -r
...
 <_D3rtz3fooFZS3rtz1X>:
   0:   55  push   ebp
   1:   8b ec   movebp,esp
   3:   83 ec 08subesp,0x8
   6:   53  push   ebx
   7:   6a 02   push   0x2
   9:   6a 01   push   0x1
   b:   6a 02   push   0x2
   d:   b8 00 00 00 00  moveax,0x0
e: R_386_32 _D11TypeInfo_Ai6__initZ
  12:   50  push   eax
  13:   e8 fc ff ff ff  call   14 <_D3rtz3fooFZS3rtz1X+0x14>
14: R_386_PC32  _d_arrayliteralT
  18:   89 c1   movecx,eax
  1a:   bb 02 00 00 00  movebx,0x2
  1f:   89 5d f8movDWORD PTR [ebp-0x8],ebx
  22:   89 4d fcmovDWORD PTR [ebp-0x4],ecx
  25:   8b 55 fcmovedx,DWORD PTR [ebp-0x4]
  28:   8b 45 f8moveax,DWORD PTR [ebp-0x8]
  2b:   83 c4 10addesp,0x10
  2e:   5b  popebx
  2f:   c9  leave  
  30:   c3  ret

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4396] New: mkdir race prevents concurrent compiling with DMD using make -j

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4396

   Summary: mkdir race prevents concurrent compiling with DMD
using make -j
   Product: D
   Version: D1 & D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: patch
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: llu...@gmail.com


--- Comment #0 from Leandro Lucarella  2010-06-27 07:10:43 
PDT ---
Since DMD creates directories as needed, when using make -j to compile some
modules concurrently, if 2 modules lives in the same directory, that directory
doesn't exist and both are compiled at the same time, there are times where
this set of steps are performed:

1) dmd m1.d checks if dstdir exist (it doesn't)
2) dmd m2.d checks if dstdir exist (it doesn't)
3) dmd m1.d creates dstdir successfully
4) dmd m2.d tries to create dstdir but it fails because dmd m1.d already
created it.

Here is a simple patch. Created against D1 svn but I guess it will apply to D2
cleanly also.

---
diff --git a/src/root/root.c b/src/root/root.c
index 3d491a4..9df951c 100644
--- a/src/root/root.c
+++ b/src/root/root.c
@@ -957,7 +957,10 @@ void FileName::ensurePathExists(const char *path)
 #if POSIX
 if (mkdir(path, 0777))
 #endif
-error("cannot create directory %s", path);
+{
+if (errno != EEXIST)
+error("cannot create directory %s", path);
+}
 }
 }
 }
---

I'm not sure how the mkdir() API for windows behaves regarding errno, I
couldn't find any reference of mkdir() for windows.

Adding a strerror() to the error message could be useful too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4395] New: Nested map fails

2010-06-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4395

   Summary: Nested map fails
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: simen.kja...@gmail.com


--- Comment #0 from Simen Kjaeraas  2010-06-27 05:09:13 
PDT ---
auto fn1 = ( string s ) {
return s;
};
auto fn2 = ( string s ) {
return map!fn1( [""] );
};
auto idirs = map!fn2( [""] );

The above code fails with the following error message:

foo.d(114): Error: struct foo.main.Map!(fn2,string[]).Map inner struct Map
cannot be a field
foo.d(114): Error: struct foo.main.Map!(fn2,string[]).Map inner struct Map
cannot be a field

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---