On Wed, Aug 03, 2011 at 04:57:42PM +0200, Fabian Groffen wrote:
> On 03-08-2011 16:55:58 +0200, Stefan Manegold wrote:
> > On Wed, Aug 03, 2011 at 04:51:50PM +0200, Fabian Groffen wrote:
> > > On 03-08-2011 16:46:58 +0200, Stefan Manegold wrote:
> > > > Changeset: e680b640d816 for MonetDB
> > > > URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e680b640d816
> > > > Modified Files:
> > > >         monetdb5/mal/mal_stack.c
> > > > Branch: Aug2011
> > > > Log Message:
> > > > 
> > > > re-activate "dark code" of function reallocStack() to fix compilation
> > > > 
> > > > it appears that mal_box now requires the "dark code" of
> > > > mal_stack's function reallocStack() ...
> > > 
> > > Please revert and disable the call to reallocStack.  That function is
> > > broken as hell.
> > 
> > What is the good replacement for the use of reallocStack() in mal_box, then?
> 
> Just don't call the function.

hm, from function depositBox() in monetdb5/mal/mal_box.mx:
[...]
        if (i < 0) {
                i = newVariable(box->sym, GDKstrdup(name), type);
                if (box->val->stksize <= i)
                        box->val =reallocStack(box->val, STACKINCR);
        }
[...]

what happens if the stack is not expanded as required?


> (It returns an alloca'd pointer, or fails with an assertion.)

the current reallocStack() in monetdb5/mal/mal_stack.c uses GDKzalloc(), not 
alloca():

MalStkPtr
reallocStack(MalStkPtr s, int cnt)
{
        int k;
        MalStkPtr old = s;

        if (s->stksize > cnt)
                return s;
        k = ((cnt / STACKINCR) + 1) * STACKINCR;
        s = (MalStkPtr) GDKzalloc(stackSize(k));
        memcpy(s, old, stackSize(old->stksize));
        s->stksize = k;
        GDKfree(old);
        return s;
}


... does not look too "evil" to me ...


Stefan


> _______________________________________________
> Checkin-list mailing list
> [email protected]
> http://mail.monetdb.org/mailman/listinfo/checkin-list
> 

-- 
| Stefan.Manegold @ CWI.nl | DB Architectures (INS1) |
| http://CWI.nl/~manegold/ | Science Park 123 (L321) |
| Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam  (NL) |
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to