What does "Compiled code too complex" error message of Hugs mean?

Ch. A. Herrmann herrmann@infosun.fmi.uni-passau.de
Wed, 31 Jan 2001 15:32:01 +0100 (MET)


Hi,

>>>>> "Jan" == Jan Kort <kort@wins.uva.nl> writes:

    Jan> 400, you should increase it to 1000 or so.  I have it at 10000,
    Jan> but that's probably not necesary in your case and if you
    Jan> increase constants too much starting up Hugs will become
    Jan> slower.

that's a general problem with hugs that you have a lot of definitions
which determine the size of arrays. I've got problems with the code
and the stack size yet, so I have hugs installed with different
settings which is not very convenient. 

Maybe hugs will become obsolete by the new fast interactive ghc,
but if not I would suggest to implement as many arrays as possible
dynamically and make all other settings available as a program
parameter. You also could have an option which selects a 
permanent check of the control stack to avoid overflows
where safety is more important than speed.

The following piece of C code duplicates the size of an array
and could be applied in the case that both the pointer to the array
and its size reside in a single variable. **data is a pointer to
the variable carrying the former and *size a pointer to the variable
carrying the latter value. elemsize is the memory requirement of
a single array element.

void array_expand(void **data, int elemsize, int *size)
{
   void *newdata;
   newdata = (void *)malloc(elemsize*2*(*size));
   memcpy(newdata,*data,elemsize*(*size));
   free(*data);
   *data=newdata;
   (*size)*=2;
}

Bye
-- 
 Christoph Herrmann
 E-mail:  herrmann@fmi.uni-passau.de
 WWW:     http://brahms.fmi.uni-passau.de/cl/staff/herrmann.html