Runtime bug? and other questions

Daniel Wang danwang@cs.princeton.edu
25 Jan 2000 20:20:56 -0500


Daniel Wang <danwang@vista.CS.Princeton.EDU> writes:

> I've run into a bug with the runtime, and I'm not sure if it's because I'm
> generating bogus code, or if its just a boundary case you haven't caught
> yet.


See the patch below.. this fixes the bug when linking with libmlton-gbd.a

I'm still running into a bug, where my code is dieing. I'm convinced that
I'm generating valid code for the backend. This is code that doesn't even
use any of my extensions to MLTON. I think there stacklimit check is being
done incorrectly. As if I increase the slop space allocated at the end of
every stack, I can get my code to work a bit more reliably.

Also is there a way to set the initial stacksize from the command line?


1999-12-24/src/runtime/gc.c
*** orig/mlton-1999-12-24/src/runtime/gc.c      Fri Dec 24 18:43:33 1999
--- mlton-1999-12-24/src/runtime/gc.c   Tue Jan 25 19:52:24 2000
***************
*** 557,563 ****
        {
                uint offset;
                GC_stack stack;
! 
                stack = s->currentThread->stack;
                assert(isWordAligned(stack->reserved));
                assert(s->stackBottom == stackBottom(stack));
--- 557,563 ----
        {
                uint offset;
                GC_stack stack;
!               if (s->currentThread != BOGUS_THREAD) {
                  stack = s->currentThread->stack;
                  assert(isWordAligned(stack->reserved));
                  assert(s->stackBottom == stackBottom(stack));
***************
*** 570,575 ****
--- 570,576 ----
                    assert(s->stackBottom + offset 
                           <= s->stackTop + WORD_SIZE);
                    offset = *(uint*)(s->stackBottom + offset + WORD_SIZE);
+                 }
                }
        }