Mail Archives: cygwin-developers/2001/03/22/15:57:14
Hi!
Wednesday, 21 March, 2001 Egor Duda deo AT logos-m DOT ru wrote:
ED> well, i've managed to build it with -DMALLOC_PROVIDED, though it was a
ED> bit tricky, and it turned out that cygwin1.dll is not the one to
ED> blame. i fear that it's bug in ash -- it fails to evaluate complex
ED> expressions.
well, i've found the reason. moreover, i've found that as was once
patched to fix this bug, but later, patch was reverted. i wonder why.
did it have some ill side effects?
=============================================================================
Thu Oct 12 14:28:00 2000 Corinna Vinschen <corinna AT vinschen DOT de>
* memalloc.c: Revert previous patch until it's need is proved.
Tue Oct 10 16:46:00 2000 Corinna Vinschen <corinna AT vinschen DOT de>
Patch suggested by Andy Mortimer <Andy DOT Mortimer AT software DOT aeat DOT com>:
* memalloc.c: Add member `refcnt' to struct stack_block.
(stalloc): Initialize refcnt when allocating a new block.
(setstackmark): Increment refcnt when reusing a stack block.
(popstackmark): Decrement refcnt when dropping usage of a stack block.
(growstackblock): Reallocate a block only if it's used only once.
=========================================================================
the proof of necessity of this patch is following: ash sometimes marks
a points on its internal stack via setstackmark and later restores to
saved state via popstackmark. "state" is simply a pointer to the
record on top of the stack. everythink works fine, until substitutions
are small enough to fit into 504 bytes of stack record. but if it
don't fit, we call growstackblock. it reallocates stack record, and
that means that mark pointer saved earlier no longer points to stack
record. so when we call popstackmark it frees all stack, hits the
bottom and calls free(stackbase), while stackbase is a static
variable.
If Andy's patch is wrong, i think i can propose another way -- to
divide stack_block into two separately dynamically allocated parts:
one of prev and data pointers, and other to contain all data. so we
will realloc () only the latter while saving "mark pointers" only to
the former.
Corinna, should i submit a patch or you'll reapply Andy's one?
Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19
- Raw text -