x86 codegen fix for the release

Stephen Weeks MLton@sourcelight.com
Thu, 5 Jul 2001 15:49:36 -0700


Matthew, I need a fix to the x86 codegen implementation of Thread_switchTo, in
conjunction with the bugfix for signals/threads.  The C macro now looks like the
following.

#define Thread_switchTo(frameSize, ret, thread)					\
	do {									\
		GC_thread t = thread;						\
		stackTop += (frameSize);					\
		*(uint*)stackTop = (ret ## _index);				\
	 	gcState.currentThread->stack->used =				\
			stackTop + WORD_SIZE - gcState.stackBottom;		\
	 	gcState.currentThread = t;					\
		gcState.stackBottom =						\
			((pointer)t->stack) + sizeof(struct GC_stack);		\
		stackTop = gcState.stackBottom + t->stack->used - WORD_SIZE;	\
		gcState.stackLimit =						\
			gcState.stackBottom + t->stack->reserved		\
			- 2 * gcState.maxFrameSize;				\
		gcState.canHandle--; /* atomicEnd */				\
		if (gcState.signalIsPending && 0 == gcState.canHandle)		\
			gcState.limit = gcState.base;				\
		Return();							\
		ret:								\
		stackTop -= (frameSize);					\
	} while (0)

The only change is the "if" statement after gcState.canHandle--.

		if (gcState.signalIsPending && 0 == gcState.canHandle)		\
			gcState.limit = gcState.base;				\