[Issue 424] Unexpected OPTLINK Termination at EIP=0044C37B

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 14 16:55:09 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=424





------- Comment #10 from wbaxter at gmail.com  2007-11-14 18:55 -------
(In reply to comment #1)
> While important, I don't think it's a blocker. 30,000 lines of code in one
> module is unusually large, and can be split into smaller source files.

I believe I'm running into this too, and my files have a reasonable number of
lines.  However, the code is structured so that *everything* is templated, and
doesn't get instantiated until main.d.  This is a very common way to write
heavily generic code.  The actual library in question in which this is
happening OpenMeshD (http://www.dsource.org/projects/openmeshd), which is a
port of a  C++ template library to D.

Why I think I'm seeing this same problem:

1) Optlink is dying and popping up a MsgBox saying "Unexpected OPTLINK
Termination at EIP=0044C37B"  The EIP number is different that the one
previously reported, but I'm guessing that doesn't matter (just a random memory
address?).

2) The thing that triggered the crashing was adding a function with a big block
of type-checking case statements like this:
   else if (ti==typeid(VectorT!(byte,   2))) { 
       renderer_ = new PropRenderer!(VectorT!(byte,   2)); 
   }

   So it's causing a lot of templates to be instantiated, which could be
pushing the number of "fixups" in main.d over the 16K limit.

3) If I start commenting out those "else if" lines one by one, eventually
compilation will work again. It doesn't seem to matter which lines I comment
out.  If I get rid of enough of them, then it compiles.

4) Compiling with -O -release instead of -g -debug allows me to uncomment a few
more of the lines.

5) "main.obj" is between 1-2MB even in release mode.

All that seems to add up to an OPTLINK upper limit bug.  If not with # of
fixups then with something.

I'm using DMD 1.023 on Windows XP.

I've checked the code into the OpenMesh/D repository in its buggy state so it
can be checked out for debugging.

To reproduce, check out revision 111 of OpenMesh from the svn repository:

If you don't have dsss installed, install it first
(http://www.dsource.org/projects/dsss)

Then:

$ mkdir scratch
$ cd scratch
$ svn co -r111 http://svn.dsource.org/projects/openmeshd/trunk .
$ cd OpenMeshD\OpenMesh\Apps\GLViewer
$ dsss net deps 
$ dsss build -version=OPTLINKIsMyFriend

If there are complaints about Helix things, you may need to go to the Helix dir
and do a "dsss build && dsss install"


-- 



More information about the Digitalmars-d-bugs mailing list